これは、ドイツ語版で動作するtboneの回答の拡張版です。
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 Declare PtrSafe Function BringWindowToTop Lib "user32" (ByVal hwnd As Long) As Boolean
Private Declare PtrSafe Function SetForegroundWindow Lib "user32" (ByVal hwnd As Long) As Boolean
Private Declare PtrSafe Function SetFocus Lib "user32" (ByVal hwnd 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 GoTo err
'Loop 25 times as FindWindowA needs exact title which varies according to number of reminder items...
Dim iReminderCount As Integer
For iReminderCount = 1 To 25
'Try two syntaxes...
ReminderWindowHWnd = FindWindowA(vbNullString, iReminderCount & " Erinnerung")
SetWindowPos ReminderWindowHWnd, HWND_TOPMOST, 0, 0, 0, 0, FLAGS
BringWindowToTop (ReminderWindowHWnd)
SetForegroundWindow ReminderWindowHWnd
SetFocus ReminderWindowHWnd
ReminderWindowHWnd = FindWindowA(vbNullString, iReminderCount & " Erinnerung(en)")
SetWindowPos ReminderWindowHWnd, HWND_TOPMOST, 0, 0, 0, 0, FLAGS
BringWindowToTop ReminderWindowHWnd
SetForegroundWindow ReminderWindowHWnd
SetFocus ReminderWindowHWnd
Next
Exit Sub
err:
Debug.Print err.Number & " - " & err.Description & " (iReminderCount = " & iReminderCount & ")"
Resume Next
End Sub
ドイツ語のウィンドウタイトルといくつかの新しい関数(BringWindowToTop
、SetForegroundWindow
およびSetFocus
)を追加しました。
Outlook 2016と共にドイツ語版のWindows 10で動作します。
新しい証明書を生成することはできませんでした([スタート]を押して「証明書」を入力しても何も表示されませんでした)が、署名時にリストで別の証明書を選択しただけです。