how can I deactivate form on Nexio(hand-held pc, CE.NET 4.2)

  • Thread starter Thread starter fairycat
  • Start date Start date
F

fairycat

I made mainform property "controlBox" to false. So basically I can't
use minimize box to deactivate form. Of course I can hide program with
Me.Hide() but I should able to return to my program. If I hide program
there is no button on the taskbar so I cannot return. How can I
minimize my program?? Not in PPC but hand-held PC, CE.NET 4.2. I'm
using C# with .NetCF. I've been looking around for this but couldn't
find any. I thought there would be some kind of simple call to minimize
program but there wasn't. Any help will be appreciated.
 
As you noticed enum FormWindowState does not contain Minimized value.
That is why you should manually send WM_SIZE message for you
application. To do it use ShowWindow P/Invoke with SW_MINIMIZED parameter:

public void Minimize(Form form)
{
form.Capture = true;
IntPtr hwnd = GetCapture();
form.Capture = false;

ShowWindow(hwnd, SW_MINIMIZE);
}

....

const int SW_MINIMIZE = 6;

[DllImport("coredll")]
private static extern bool ShowWindow(IntPtr hwnd, int cmdShow);

[DllImport("coredll")]
private static extern IntPtr GetCapture();


Best regards,
Sergey Bogdanov
http://www.sergeybogdanov.com
 
Back
Top