Tech Off Thread

5 posts

Fighting for Top-Most Window in WinCE

Back to Forum: Tech Off
  • User profile image
    NotSoTragic​Hero

    We're having an issue with our project.  Our software switches back and forth between a GPS software and our program.  We have a button that we want to paint over the GPS software.  The purpose of this button is to navigate back to our actual program from the GPS software.  However, we're having some issues with painting and the two applications fighting for a top most position.  When we try to give our button a top most position, it keeps having its LostFocus event called, which makes me believe that the two are indeed fighting for top position.  Assuming this is true, what would be the best way to go about restricting the GPS window from having the top most position?

     

    Thanks ahead of time.

    -Brandon

  • User profile image
    figuerres

    Hmm....

    you may need to do something like i have done...

     

    in an app i wrote i had to take over the device screen, this is a dedicated sales app that the device is *ONLY* allowed to be used for this one app.

     

    i have a way that the managers and techs can take my app out of fullscreen by calling some win32 / ce system calls.

     

    if you are interested i can get some of the code later and post the bits i think you will need.

  • User profile image
    NotSoTragic​Hero

    figuerres said:

    Hmm....

    you may need to do something like i have done...

     

    in an app i wrote i had to take over the device screen, this is a dedicated sales app that the device is *ONLY* allowed to be used for this one app.

     

    i have a way that the managers and techs can take my app out of fullscreen by calling some win32 / ce system calls.

     

    if you are interested i can get some of the code later and post the bits i think you will need.

    Anything would help us at this point.  I'd appreciate that, thanks.  We have tried using SetWindowPos and SetForegroundWindow from coredll, but that hasn't seemed to help so far.

  • User profile image
    figuerres

    NotSoTragicHero said:
    figuerres said:
    *snip*

    Anything would help us at this point.  I'd appreciate that, thanks.  We have tried using SetWindowPos and SetForegroundWindow from coredll, but that hasn't seemed to help so far.

    in my app i found that you must do some things in the right order and it's not as simple as it could be.

     

    here is part of the code, i use the OpenNetCF for part of how it does is't thing.

     

    using System; using System.Text;
     using OpenNETCF.Win32; 
    using System.Windows.Forms; 
    namespace PocketN { 
    public class NoTaskBar { 
    public static void Hide(Form F) {
     F.Capture = true;
     Win32Window hwnd = Win32Window.GetCapture();
     F.Capture = false;
     hwnd.ExtendedStyle |= WS_EX.NOANIMATION;
     } 
    private const uint TOPFULL = 0x20000008; 
    private const uint TOPFULLNOICON = 0x24000008; 
    public static void FullScreen(Form F, bool TaskIcon) { 
    F.SuspendLayout(); F.Capture = true; 
    Win32Window hwnd = Win32Window.GetCapture(); 
    F.Capture = false; F.WindowState = FormWindowState.Normal;
     if (Program.FullScreen) {
     // full 
    if ((Program.CurrentPlatform == Platforms.Casio) && (Program.Taskbar.TaskBarVisible)) { 
    Program.Taskbar.HideTaskBar(); 
    } 
    if (Program.CurrentPlatform != Platforms.Casio) {
     if (!TaskIcon) { 
    hwnd.ExtendedStyle = (WS_EX)TOPFULLNOICON; 
    } else { 
    hwnd.ExtendedStyle = (WS_EX)TOPFULL; 
    } 
    F.Top = 28; F.Left = 0;
     F.Width = Screen.PrimaryScreen.WorkingArea.Width - 6;
     F.Height = Screen.PrimaryScreen.WorkingArea.Height - 6;
     } else {
     if (!TaskIcon) {
     hwnd.ExtendedStyle |= WS_EX.NOANIMATION; 
    } else { 
    hwnd.ExtendedStyle = WS_EX.NONE; 
    }
     F.Top = 0; 
    F.Left = 0;
     F.Width = Screen.PrimaryScreen.Bounds.Width;
     F.Height = Screen.PrimaryScreen.Bounds.Height;
     }
     } else { 
    // normal 
    if ((Program.CurrentPlatform == Platforms.Casio) && (!Program.Taskbar.TaskBarVisible)) {
     Program.Taskbar.ShowTaskBar(); 
    }
     if (!TaskIcon) { 
    hwnd.ExtendedStyle |= WS_EX.NOANIMATION;
     } else {
     hwnd.ExtendedStyle = WS_EX.NONE; 
    } 
    if (Program.CurrentPlatform == Platforms.Casio) { 
    F.Top = 0; F.Left = 0; F.Width = Screen.PrimaryScreen.Bounds.Width;
     F.Height = Screen.PrimaryScreen.WorkingArea.Height - 3; 
    } else {
     F.Top = 28;
     F.Left = 0; 
    F.Width = Screen.PrimaryScreen.WorkingArea.Width - 6; 
    F.Height = Screen.PrimaryScreen.WorkingArea.Height - 6; 
    } 
    }
     F.ResumeLayout(); 
    } 
    } 
    }
     

     

    Insert Code Block SUCKS!!! it totaly hosed the formatting!

  • User profile image
    NotSoTragic​Hero

    figuerres said:
    NotSoTragicHero said:
    *snip*

    in my app i found that you must do some things in the right order and it's not as simple as it could be.

     

    here is part of the code, i use the OpenNetCF for part of how it does is't thing.

     

    using System; using System.Text;
     using OpenNETCF.Win32; 
    using System.Windows.Forms; 
    namespace PocketN { 
    public class NoTaskBar { 
    public static void Hide(Form F) {
     F.Capture = true;
     Win32Window hwnd = Win32Window.GetCapture();
     F.Capture = false;
     hwnd.ExtendedStyle |= WS_EX.NOANIMATION;
     } 
    private const uint TOPFULL = 0x20000008; 
    private const uint TOPFULLNOICON = 0x24000008; 
    public static void FullScreen(Form F, bool TaskIcon) { 
    F.SuspendLayout(); F.Capture = true; 
    Win32Window hwnd = Win32Window.GetCapture(); 
    F.Capture = false; F.WindowState = FormWindowState.Normal;
     if (Program.FullScreen) {
     // full 
    if ((Program.CurrentPlatform == Platforms.Casio) && (Program.Taskbar.TaskBarVisible)) { 
    Program.Taskbar.HideTaskBar(); 
    } 
    if (Program.CurrentPlatform != Platforms.Casio) {
     if (!TaskIcon) { 
    hwnd.ExtendedStyle = (WS_EX)TOPFULLNOICON; 
    } else { 
    hwnd.ExtendedStyle = (WS_EX)TOPFULL; 
    } 
    F.Top = 28; F.Left = 0;
     F.Width = Screen.PrimaryScreen.WorkingArea.Width - 6;
     F.Height = Screen.PrimaryScreen.WorkingArea.Height - 6;
     } else {
     if (!TaskIcon) {
     hwnd.ExtendedStyle |= WS_EX.NOANIMATION; 
    } else { 
    hwnd.ExtendedStyle = WS_EX.NONE; 
    }
     F.Top = 0; 
    F.Left = 0;
     F.Width = Screen.PrimaryScreen.Bounds.Width;
     F.Height = Screen.PrimaryScreen.Bounds.Height;
     }
     } else { 
    // normal 
    if ((Program.CurrentPlatform == Platforms.Casio) && (!Program.Taskbar.TaskBarVisible)) {
     Program.Taskbar.ShowTaskBar(); 
    }
     if (!TaskIcon) { 
    hwnd.ExtendedStyle |= WS_EX.NOANIMATION;
     } else {
     hwnd.ExtendedStyle = WS_EX.NONE; 
    } 
    if (Program.CurrentPlatform == Platforms.Casio) { 
    F.Top = 0; F.Left = 0; F.Width = Screen.PrimaryScreen.Bounds.Width;
     F.Height = Screen.PrimaryScreen.WorkingArea.Height - 3; 
    } else {
     F.Top = 28;
     F.Left = 0; 
    F.Width = Screen.PrimaryScreen.WorkingArea.Width - 6; 
    F.Height = Screen.PrimaryScreen.WorkingArea.Height - 6; 
    } 
    }
     F.ResumeLayout(); 
    } 
    } 
    }
     

     

    Insert Code Block SUCKS!!! it totaly hosed the formatting!

    Thanks bud!  We've hacked it for now, (doing a lot of invalidating  Perplexed ), but we'll probably have to come back to this soon when it comes to deployment time.  I'll take note!

Comments closed

Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation, please create a new thread in our Forums, or Contact Us and let us know.