Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I am trying to figure out how to obtain the values needed to successfully execute a SendMessage I'm using to try to close a dialog box.

 

My question is how do I figure out the value of my window (the hwnd value), the message I want to send (the wMsg value), and the remaing parameter values (wParam and lParam)?

 

 

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

  • Administrators
Posted

You could always try the FindWindow API

Declare Auto Function SendMessage Lib "user32.dll" (ByVal hWnd As IntPtr, _
 ByVal Msg As Integer, ByVal wParam As UIntPtr, _
 ByVal lParam As IntPtr) As IntPtr

Declare Auto Function FindWindow Lib "user32" (ByVal lpClassName As String, ByVal lpWindowName As String) As IntPtr

'use like
Dim hWnd as IntPtr = FindWindow("", "")

 

and use the returned value as the first parameter to SendMessage. As to what you pass for the other 3 parameters depends on what you are trying to do. For a list of windows Messages you may want to Look on MSDN

Posting Guidelines FAQ Post Formatting

 

Intellectuals solve problems; geniuses prevent them.

-- Albert Einstein

Posted (edited)

Thanks, I found the name of the window now and checked out MSDN. It looks like I could use WM_COMMAND to help me "press" the save button on my dialog box. Would WM_COMMAND be the right choice to do something like this?

 

Thanks so much for your help!

Edited by microcephalic
  • 3 months later...
Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...