Hide MainMenu Control

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is it possible to hide the MainMenu control on a form in .NETcf? I don't see
any property such as Visible etc. Or do I need to use native code for this?

Thanks for any help,
Steve
 
If I understand your question correct, you would like to show/hide the
StartButton. And yes, you will need native code. I'm using the
following:

//------ Hide/Show Taskbar and Taskmanager
private const int SW_HIDE = 0x00;

private const int SW_SHOW = 0x0001;

[DllImport("coredll.dll", CharSet = CharSet.Auto)]

private static extern IntPtr FindWindow(string lpClassName,
string lpWindowName);

[DllImport("coredll.dll", CharSet = CharSet.Auto)]

private static extern bool ShowWindow(IntPtr hwnd, int
nCmdShow);

[DllImport("coredll.dll", CharSet = CharSet.Auto)]

private static extern bool EnableWindow(IntPtr hwnd, bool
enabled);

private static void ShowTaskbar()
{

IntPtr h = FindWindow("HHTaskBar", "");

ShowWindow(h, SW_SHOW);

EnableWindow(h, true);

}

private static void HideTaskbar()
{

IntPtr h = FindWindow("HHTaskBar", "");

ShowWindow(h, SW_HIDE);

EnableWindow(h, false);

}

Attention: Don't forget to Show the taskbar before closing your
application!
 
Thanks for this reply, and the code, but I think it's for something else.
I'm referring to the MainMenu control that can be placed on an individual
form from the Toolbox (on creating a form, a MainMenu is placed by default).
I can remove the menu by just deleting in the IDE, but I can't find a way to
hide/show this menu programmatically.

Although, I think your code would also work if I knew the WinCE window name
of the MainMenu control.

Steve
 
Back
Top