VBA将前景“新物品警报”窗口带到前线

时间:2017-04-27 19:26:27

标签: vba outlook

我在Windows 10中使用Outlook 2013.我设置了一条规则,当新邮件进入时,在新项目警告窗口中显示一个消息。我可以将“新项目警报窗口”带到前面并保持在其他应用程序之上?还是有其他方法可以在新电子邮件到来时让弹出窗口停留在其他应用程序之上? 感谢。

从[https://superuser.com/questions/251963/how-to-make-outlook-calendar-reminders-stay-on-top-in-windows-7][1]

复制的代码
 Private Declare PtrSafe Function FindWindowA Lib "user32" _
(ByVal lpClassName As String, ByVal lpWindowName As String) As Long

Private Declare PtrSafe Function SetWindowPos Lib "user32" ( _
ByVal hwnd As Long, ByVal hWndInsertAfter As Long, _
ByVal X As Long, ByVal Y As Long, ByVal cx As Long, _
ByVal cy As Long, ByVal wFlags As Long) As Long

Private Const SWP_NOSIZE = &H1
Private Const SWP_NOMOVE = &H2
Private Const FLAGS As Long = SWP_NOMOVE Or SWP_NOSIZE
Private Const HWND_TOPMOST = -1

Private Sub Application_Reminder(ByVal Item As Object)
Dim ReminderWindowHWnd As Variant
On Error Resume Next
ReminderWindowHWnd = FindWindowA(vbNullString, "1 Reminder")
SetWindowPos ReminderWindowHWnd, HWND_TOPMOST, 0, 0, 0, 0, FLAGS

End Sub

0 个答案:

没有答案