Link to home
Start Free TrialLog in
Avatar of sudhakar_koundinya
sudhakar_koundinya

asked on

Sending BN_CLICKED message using SendMessage or PostMessgae

Hi All,

Can any body give me a solution in which I need to post/send BN_Clicked message using SendMessage or PostMessage methods

I have tried like this. But they are not working.
SendMessage(h, WM_COMMAND, 0, BN_CLICKED);
PostMessage(h, WM_COMMAND, 0, BN_CLICKED);


Thanks
Sudhakar
ASKER CERTIFIED SOLUTION
Avatar of rcarlan
rcarlan

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of sudhakar_koundinya
sudhakar_koundinya

ASKER

I worked as suggested by you
::SendMessage(hwnd, WM_COMMAND, MAKELONG(GetDlgCtrlID(h), BN_CLICKED), h);
                                      or
::PostMessage(hwnd, WM_COMMAND, MAKELONG(GetDlgCtrlID(h), BN_CLICKED), h);

But I Get following error

StdAfx.cpp
error C2664: 'SendMessageA' : cannot convert parameter 4 from 'struct HWND__ *' to 'long'
        This conversion requires a reinterpret_cast, a C-style cast or function-style cast
 error C2664: 'PostMessageA' : cannot convert parameter 4 from 'struct HWND__ *' to 'long'
        This conversion requires a reinterpret_cast, a C-style cast or function-style cast
Error executing cl.exe.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial