C
clkurtz
I'm working on an windows application, framework 2, language c#. I'm
debugging on Windows Vista and XP.
I need to have the [?] button in the caption bar, but also minimize
box and maximize box.
The only way to have the [?] button visible is to disable minimize and
maximize box. Okay, this is by design, but this is not acceptable to
me, so I need to find another solution.
The idea is to put another button, a normal button called "buttonHelp"
in a conner of my app, that simply enables the "what's this" mode. In
other words I want that after clicking it, the mouse cursor appear
with a small ?, and that clicking any control on the form is shown his
help description.
-------------> First idea:
private void buttonHelp_Click(object sender, EventArgs e)
{
OnHelpButtonClicked(new CancelEventArgs(false));
}
protected override void OnHelpButtonClicked(CancelEventArgs e)
{
base.OnHelpButtonClicked(e);
}
It does not work.
-------------> Second idea:
private const int WM_SYSCOMMAND = 0x0112;
private const int SC_CONTEXTHELP = 0xF180;
DllImport("User32.dll")]
public static extern Int32 SendMessage(IntPtr hWnd, UInt32 Msg, UInt32
wParam, Int32 lParam);
private void buttonHelp_Click(object sender, EventArgs e)
{
unsafe
{
SendMessage(this.Handle, WM_SYSCOMMAND, SC_CONTEXTHELP, 0);
}
}
It does not work, even if the event OnHelpButtonClicked is thrown and
overriding the WndProc event i see that both the real [?] button and
my button seems to have sent the same message (the only difference is
lparam, that should be ignored being the mouse position)
--------------------------------------------
Does anybody have an idea?
I cannot believe that is impossible to have a button that simply put
the app in "what's this" mode if I have maximize and minimize box. I'm
going mad... ;-)
Thank you in advance
debugging on Windows Vista and XP.
I need to have the [?] button in the caption bar, but also minimize
box and maximize box.
The only way to have the [?] button visible is to disable minimize and
maximize box. Okay, this is by design, but this is not acceptable to
me, so I need to find another solution.
The idea is to put another button, a normal button called "buttonHelp"
in a conner of my app, that simply enables the "what's this" mode. In
other words I want that after clicking it, the mouse cursor appear
with a small ?, and that clicking any control on the form is shown his
help description.
-------------> First idea:
private void buttonHelp_Click(object sender, EventArgs e)
{
OnHelpButtonClicked(new CancelEventArgs(false));
}
protected override void OnHelpButtonClicked(CancelEventArgs e)
{
base.OnHelpButtonClicked(e);
}
It does not work.
-------------> Second idea:
private const int WM_SYSCOMMAND = 0x0112;
private const int SC_CONTEXTHELP = 0xF180;
DllImport("User32.dll")]
public static extern Int32 SendMessage(IntPtr hWnd, UInt32 Msg, UInt32
wParam, Int32 lParam);
private void buttonHelp_Click(object sender, EventArgs e)
{
unsafe
{
SendMessage(this.Handle, WM_SYSCOMMAND, SC_CONTEXTHELP, 0);
}
}
It does not work, even if the event OnHelpButtonClicked is thrown and
overriding the WndProc event i see that both the real [?] button and
my button seems to have sent the same message (the only difference is
lparam, that should be ignored being the mouse position)
--------------------------------------------
Does anybody have an idea?
I cannot believe that is impossible to have a button that simply put
the app in "what's this" mode if I have maximize and minimize box. I'm
going mad... ;-)
Thank you in advance