Bring a .NETCF Form to the foreground

Sometimes calling BringToFront for your form is not enough to bring your app to the foreground. You can P/Invoke SetForegroundWindow which will activate your app and bring the window to the front of the Z-Order:-


public void SetForegroundWindow()
    this.Capture = true;
    IntPtr hwnd = OpenNETCF.Win32.Win32Window.GetCapture();
    this.Capture = false;

or VB

Public Sub SetForegroundWindow
    Me.Capture = True
    Dim hwnd As IntPtr = OpenNETCF.Win32.Win32Window.GetCapture()
    Me.Capture = False
End Sub