Using SendMessage Lib

khalik

Member
Joined
Jan 25, 2006
Messages
9
Programming Experience
5-10
Hi Guys

I need find a windows do some activity and close it. from my windows application.

the declaration i have

Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As any) As Long

the lParam is of type any. which gives error


'As Any' is not supported in 'Declare' statements.

how do i fix it. what do i need to do.
 
Your declaration is VB6 code, this is VB.Net, you can also overload the lParam parameter:
VB.NET:
Declare Function SendMessage Lib "user32.dll" Alias "SendMessageA" ( _ 
  ByVal hwnd As Int32, _ 
  ByVal wMsg As Int32, _ 
  ByVal wParam As Int32, _ 
  ByVal lParam As Int32) As Int32
 
Declare Function SendMessage Lib "user32.dll" Alias "SendMessageA" ( _
  ByVal hwnd As Int32, _
  ByVal wMsg As Int32, _
  ByVal wParam As Int32, _
  ByVal lParam As String) As Int32
 
Last edited:
Since you are already working with SendMessage and got hWnd, why not send WM_CLOSE
 
Back
Top