Question

The button control message BM_CLICK can be sent via defining a pInvoke method as follows:

[DllImport("user32.dll")]
public static extern IntPtr SendMessage(HandleRef hWnd, uint Msg, IntPtr wParam, string lParam);

and then calling the method with the corresponding Msg value, 0x00F5.

Is it possible to call the button control macro Button_Enable in a similar fashion?

Was it helpful?

Solution

No, these macros are only usable from a C or C++ compiler. It is a simple text substitution, look in the windowsx.h SDK header file for the actual text that's generated when you use the macro. You'll see that you have to pinvoke EnableWindow().

You should not be using this at all btw, use an UI Automation library to commandeer another program. If these are your own buttons then use the Enabled property instead.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top