How to place the form in the help request mode?

A .NET Windows form may have a help button in the title bar if the HelpButton property is set to true (and you do not show the buttons with the minimum / maximum value). When this help button is pressed, the form enters the help mode, where the cursor changes, and clicking elsewhere on the form does not have the usual effect. Instead, a click fires the HelpRequested event on the clicked control. Great, except that I need a help button and a decrease / maximize button. Therefore, I created my own help button in the client area of ​​my form. When it is clicked, how can I place the form in help mode?

+3
source share
1 answer

Found.

[DllImport("user32.dll")] private static extern int SendMessage(IntPtr hwnd, int msg, IntPtr wp, IntPtr lp);
private const int WM_SYSCOMMAND = 0x112;
private const int SC_CONTEXTHELP = 0xf180;

private void button1_Click(object sender, EventArgs e) {
  button1.Capture = false;
  SendMessage(this.Handle, WM_SYSCOMMAND, (IntPtr)SC_CONTEXTHELP, IntPtr.Zero);
}
+1
source

All Articles