Name

SendDlgItemMessage

Synopsis

SendDlgItemMessage operates similarly to SendMessage. Both functions are synchronous, and both return a value that depends on the message sent. The main difference between these two functions is that you can specify a control ID in SendDlgItemMessage. This allows a message to be sent to a control when you know its ID but not its hwnd:

Public Declare Function SendDlgItemMessage Lib "user32" _
         Alias "SendDlgItemMessageA" _
		(ByVal hDlg As Long, ByVal nIDDlgItem As Long, _
		ByVal wMsg As Long, ByVal wParam As Long, _
		ByVal lParam As Long) As Long

Parameters

hDlg

The handle of the target dialog box.

nIDDlgItem

The ID of the control on the dialog box specified by the hDlg handle. You can find the control ID by using Spy++.

wMsg

The message to send to the target window.

wParam

The first parameter of the message.

lParam

The second parameter of the message.

Return Value

The return value depends on the message sent.

Get Subclassing and Hooking with Visual Basic now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.