Keeping a Windows application on top of other windows and in focus - always

前端 未结 4 1340
无人共我
无人共我 2020-12-18 12:41

I am creating a kiosk application and I want to ensure it is always, no matter what, on top of other Windows applications and the Windows task bar.

I am already bloc

4条回答
  •  感动是毒
    2020-12-18 13:17

    In this scenario you can run your application in full screen with always your window on top. I use the following snippet in some of my opengl apps (from http://nehe.gamedev.net/). It is in win32 but I think you can use pinvoke or System.Management.ManagementClass("Win32_VideoController")

        DEVMODE dmScreenSettings;                               // Device Mode
        memset(&dmScreenSettings,0,sizeof(dmScreenSettings));   // Makes Sure Memory's Cleared
        dmScreenSettings.dmSize=sizeof(dmScreenSettings);       // Size Of The Devmode Structure
        dmScreenSettings.dmPelsWidth    = width;                // Selected Screen Width
        dmScreenSettings.dmPelsHeight   = height;               // Selected Screen Height
        dmScreenSettings.dmBitsPerPel   = bits;                 // Selected Bits Per Pixel
        dmScreenSettings.dmFields=DM_BITSPERPEL|DM_PELSWIDTH|DM_PELSHEIGHT;
    // Try To Set Selected Mode And Get Results.  NOTE: CDS_FULLSCREEN Gets Rid Of Start Bar.
    if(ChangeDisplaySettings(&dmScreenSettings,CDS_FULLSCREEN)!=DISP_CHANGE_SUCCESSFUL);
    

    This will switch your app to full screen and get rid of taskbar and disallow use from doing something other than using your app.

提交回复
热议问题