Yes, I searched and all threads related to this problem have not been solved properly.
No, I don't want to use SendKeys, because It needs focus + doesn't work on Vista/7.
How can i send a message to an application in the background/minimized to tray with the keys: CTRL + M
This is what I've got:
Code:Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As String) As Long Private Const WM_KEYDOWN = &H100 Private Const WM_KEYUP = &H101 Private Const VK_CONTROL = &H11 Private Const VK_M = &H4D Private Sub Form_Load() Dim a As Long Dim b As Long a = FindWindow(vbNullString, "Untitled - Notepad") 'Example1 b = FindWindowEx(a, 0&, "Edit", vbNullString) 'Example2 'MsgBox a SendMessage b, WM_KEYDOWN, VK_CONTROL, vbNullString SendMessage b, WM_KEYDOWN, VK_M, vbNullString SendMessage b, WM_KEYUP, VK_M, vbNullString SendMessage b, WM_KEYUP, VK_CONTROL, vbNullString End Sub


Reply With Quote
