Jump to content

Move the MenuBar in a form


Recommended Posts

Hello,

I would like to move the menubar that I have created to the bottom of the screen, but I am not able to do this. Is it even possible? I'll explain what I am trying to achieve.

I work for a school district and have embedded a browser in a form with not menu options. I have also disabled the use of ALT F4 and the windows keys, to prevent students from exiting the kiosk mode. This all works.

We are using a cloud webOS and so the full screen mode is going to be their default screen. What happens is that when the user logs into their webOS desktop, part of the their task bar is cut (only a little bit), and I think it is because the "Menu Bar" is pushing the screen down. If I could move the bar to the bottom of the screen I assumed everything would then get pushed up and for the most part, no one would be none the wiser.

Here is my code:

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_icon=favicon.ico
#AutoIt3Wrapper_Res_Comment=Stoneware
#AutoIt3Wrapper_Res_Description=Cloud
#AutoIt3Wrapper_Res_Fileversion=1.0.0.0
#AutoIt3Wrapper_Res_Language=1033
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <IE.au3>
#include <GUIConstants.au3>
#include <WindowsConstants.au3>
#include <AD.au3>
#include <DateTimeConstants.au3>

$ie = _IECreateEmbedded()
$form=GUICreate("Cloud",@DesktopWidth,@DesktopHeight,0,0,$WS_POPUP,$WS_EX_TOPMOST)
GUISetState(@SW_SHOW)
GUICtrlCreateObj($ie,0,0,@DesktopWidth,@DesktopHeight)
_IENavigate($ie, "https://website.com")
$Shutdown = GUICtrlCreateMenu("&Shutdown")
$ShutdownPC = GUICtrlCreateMenuItem("&Shutdown Computer " & @ComputerName, $Shutdown)
$Logoff = GUICtrlCreateMenu("&Logoff")
$LogoffPC = GUICtrlCreateMenuItem("&Logoff Computer " & @ComputerName, $Logoff)
$Exit = GUICtrlCreateMenu("&Exit")
$ExitApp = GUICtrlCreateMenuItem("&Exit Browser", $Exit)
$Time = GUICtrlCreateMenu("&Time")
$TimeApp = GUICtrlCreateMenuItem(, $Time)
HotKeySet("!{F4}","_Denied")
HotKeySet("^w","_Denied")
HotKeySet("^{ESC}","_Denied")
HotKeySet("^+{ESC}","_Denied")
HotKeySet("!{TAB}","_Denied")
HotKeySet("!+{TAB}","_Denied")
Run('TASKKILL /F /PID ' & ProcessExists('explorer.exe'))
Func _Denied()
    MsgBox(0,"Access Denied","You do not have permissions to exit this program.")
EndFunc
_AD_Open()
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

        Case $ExitApp

            If _AD_IsMemberOf("CHS_Office", @UserName) Then
                Run("explorer.exe")
                Exit
            ElseIf _AD_IsMemberOf("CHS_Teachers", @UserName) Then
                Run("explorer.exe")
                Exit
            ElseIf _AD_IsMemberOf("EMS_Office", @UserName) Then
                Run("explorer.exe")
                Exit
            ElseIf _AD_IsMemberOf("EMS_Teachers", @UserName) Then
                Run("explorer.exe")
                Exit
            ElseIf _AD_IsMemberOf("TCHS_Office", @UserName) Then
                Run("explorer.exe")
                Exit
            ElseIf _AD_IsMemberOf("TCHS_Teachers", @UserName) Then
                Run("explorer.exe")
                Exit
            ElseIf _AD_IsMemberOf("WMS_Office", @UserName) Then
                Run("explorer.exe")
                Exit
            ElseIf _AD_IsMemberOf("WMS_Teachers", @UserName) Then
                Run("explorer.exe")
                Exit
            ElseIf _AD_IsMemberOf("WSH_Office", @UserName) Then
                Run("explorer.exe")
                Exit
            ElseIf _AD_IsMemberOf("WSH_Teachers", @UserName) Then
                Run("explorer.exe")
                Exit
            ElseIf _AD_IsMemberOf("BL_Office", @UserName) Then
                Run("explorer.exe")
                Exit
            ElseIf _AD_IsMemberOf("BL_Teachers", @UserName) Then
                Run("explorer.exe")
                Exit
            ElseIf _AD_IsMemberOf("CE_Office", @UserName) Then
                Run("explorer.exe")
                Exit
            ElseIf _AD_IsMemberOf("CE_Teachers", @UserName) Then
                Run("explorer.exe")
                Exit
            ElseIf _AD_IsMemberOf("CK_Office", @UserName) Then
                Run("explorer.exe")
                Exit
            ElseIf _AD_IsMemberOf("CK_Teachers", @UserName) Then
                Run("explorer.exe")
                Exit
            ElseIf _AD_IsMemberOf("CO_Office", @UserName) Then
                Run("explorer.exe")
                Exit
            ElseIf _AD_IsMemberOf("CO_Teachers", @UserName) Then
                Run("explorer.exe")
                Exit
            ElseIf _AD_IsMemberOf("EA_Office", @UserName) Then
                Run("explorer.exe")
                Exit
            ElseIf _AD_IsMemberOf("EA_Teachers", @UserName) Then
                Run("explorer.exe")
                Exit
            ElseIf _AD_IsMemberOf("IN_Office", @UserName) Then
                Run("explorer.exe")
                Exit
            ElseIf _AD_IsMemberOf("IN_Teachers", @UserName) Then
                Run("explorer.exe")
                Exit
            ElseIf _AD_IsMemberOf("LL_Office", @UserName) Then
                Run("explorer.exe")
                Exit
            ElseIf _AD_IsMemberOf("LL_Teachers", @UserName) Then
                Run("explorer.exe")
                Exit
            ElseIf _AD_IsMemberOf("MO_Office", @UserName) Then
                Run("explorer.exe")
                Exit
            ElseIf _AD_IsMemberOf("MO_Teachers", @UserName) Then
                Run("explorer.exe")
                Exit
            ElseIf _AD_IsMemberOf("OM_Office", @UserName) Then
                Run("explorer.exe")
                Exit
            ElseIf _AD_IsMemberOf("OM_Teachers", @UserName) Then
                Run("explorer.exe")
                Exit
            ElseIf _AD_IsMemberOf("SL_Office", @UserName) Then
                Run("explorer.exe")
                Exit
            ElseIf _AD_IsMemberOf("SL_Teachers", @UserName) Then
                Run("explorer.exe")
                Exit
            ElseIf _AD_IsMemberOf("TH_Office", @UserName) Then
                Run("explorer.exe")
                Exit
            ElseIf _AD_IsMemberOf("TH_Teachers", @UserName) Then
                Run("explorer.exe")
                Exit
            ElseIf _AD_IsMemberOf("WW_Office", @UserName) Then
                Run("explorer.exe")
                Exit
            ElseIf _AD_IsMemberOf("WW_Teachers", @UserName) Then
                Run("explorer.exe")
                Exit
            ElseIf _AD_IsMemberOf("WH_Office", @UserName) Then
                Run("explorer.exe")
                Exit
            ElseIf _AD_IsMemberOf("WH_Teachers", @UserName) Then
                Run("explorer.exe")
                Exit
            ElseIf _AD_IsMemberOf("Tech", @UserName) Then
                Run("explorer.exe")
                Exit
            ElseIf _AD_IsMemberOf("CHS_Students", @UserName) Then
                MsgBox(0,"Denied","You do not have permissions to Exit this application")

            ElseIf _AD_IsMemberOf("EMS_Students", @UserName) Then
                MsgBox(0,"Denied","You do not have permissions to Exit this application")

            ElseIf _AD_IsMemberOf("TCHS_Students", @UserName) Then
                MsgBox(0,"Denied","You do not have permissions to Exit this application")

            ElseIf _AD_IsMemberOf("WMS_Students", @UserName) Then
                MsgBox(0,"Denied","You do not have permissions to Exit this application")

            ElseIf _AD_IsMemberOf("WSH_Students", @UserName) Then
                MsgBox(0,"Denied","You do not have permissions to Exit this application")

            ElseIf _AD_IsMemberOf("BL_Students", @UserName) Then
                MsgBox(0,"Denied","You do not have permissions to Exit this application")

            ElseIf _AD_IsMemberOf("CE_Students", @UserName) Then
                MsgBox(0,"Denied","You do not have permissions to Exit this application")

            ElseIf _AD_IsMemberOf("CK_Students", @UserName) Then
                MsgBox(0,"Denied","You do not have permissions to Exit this application")

            ElseIf _AD_IsMemberOf("CO_Students", @UserName) Then
                MsgBox(0,"Denied","You do not have permissions to Exit this application")

            ElseIf _AD_IsMemberOf("EA_Students", @UserName) Then
                MsgBox(0,"Denied","You do not have permissions to Exit this application")

            ElseIf _AD_IsMemberOf("IN_Students", @UserName) Then
                MsgBox(0,"Denied","You do not have permissions to Exit this application")

            ElseIf _AD_IsMemberOf("LL_Students", @UserName) Then
                MsgBox(0,"Denied","You do not have permissions to Exit this application")

            ElseIf _AD_IsMemberOf("MO_Students", @UserName) Then
                MsgBox(0,"Denied","You do not have permissions to Exit this application")

            ElseIf _AD_IsMemberOf("OM_Students", @UserName) Then
                MsgBox(0,"Denied","You do not have permissions to Exit this application")

            ElseIf _AD_IsMemberOf("SL_Students", @UserName) Then
                MsgBox(0,"Denied","You do not have permissions to Exit this application")

            ElseIf _AD_IsMemberOf("TH_Students", @UserName) Then
                MsgBox(0,"Denied","You do not have permissions to Exit this application")

            ElseIf _AD_IsMemberOf("WW_Students", @UserName) Then
                MsgBox(0,"Denied","You do not have permissions to Exit this application")

            ElseIf _AD_IsMemberOf("WH_Students", @UserName) Then
                MsgBox(0,"Denied","You do not have permissions to Exit this application")
            EndIf

        Case $LogoffPC
            If _AD_IsMemberOf("CHS_Office", @UserName) Then
                Exit

            ElseIf _AD_IsMemberOf("CHS_Teachers", @UserName) Then
                Exit

            ElseIf _AD_IsMemberOf("EMS_Office", @UserName) Then
                Exit

            ElseIf _AD_IsMemberOf("EMS_Teachers", @UserName) Then
                Exit

            ElseIf _AD_IsMemberOf("TCHS_Office", @UserName) Then
                Exit

            ElseIf _AD_IsMemberOf("TCHS_Teachers", @UserName) Then
                Exit

            ElseIf _AD_IsMemberOf("WMS_Office", @UserName) Then
                Exit

            ElseIf _AD_IsMemberOf("WMS_Teachers", @UserName) Then
                Exit

            ElseIf _AD_IsMemberOf("WSH_Office", @UserName) Then
                Exit

            ElseIf _AD_IsMemberOf("WSH_Teachers", @UserName) Then
                Exit

            ElseIf _AD_IsMemberOf("BL_Office", @UserName) Then
                Exit

            ElseIf _AD_IsMemberOf("BL_Teachers", @UserName) Then
                Exit

            ElseIf _AD_IsMemberOf("CE_Office", @UserName) Then
                Exit

            ElseIf _AD_IsMemberOf("CE_Teachers", @UserName) Then
                Exit

            ElseIf _AD_IsMemberOf("CK_Office", @UserName) Then
                Exit

            ElseIf _AD_IsMemberOf("CK_Teachers", @UserName) Then
                Exit

            ElseIf _AD_IsMemberOf("CO_Office", @UserName) Then
                Exit

            ElseIf _AD_IsMemberOf("CO_Teachers", @UserName) Then
                Exit

            ElseIf _AD_IsMemberOf("EA_Office", @UserName) Then
                Exit

            ElseIf _AD_IsMemberOf("EA_Teachers", @UserName) Then
                Exit

            ElseIf _AD_IsMemberOf("IN_Office", @UserName) Then
                Exit

            ElseIf _AD_IsMemberOf("IN_Teachers", @UserName) Then
                Exit

            ElseIf _AD_IsMemberOf("LL_Office", @UserName) Then
                Exit

            ElseIf _AD_IsMemberOf("LL_Teachers", @UserName) Then
                Exit

            ElseIf _AD_IsMemberOf("MO_Office", @UserName) Then
                Exit

            ElseIf _AD_IsMemberOf("MO_Teachers", @UserName) Then
                Exit

            ElseIf _AD_IsMemberOf("OM_Office", @UserName) Then
                Exit

            ElseIf _AD_IsMemberOf("OM_Teachers", @UserName) Then
                Exit

            ElseIf _AD_IsMemberOf("SL_Office", @UserName) Then
                Exit

            ElseIf _AD_IsMemberOf("SL_Teachers", @UserName) Then
                Exit

            ElseIf _AD_IsMemberOf("TH_Office", @UserName) Then
                Exit

            ElseIf _AD_IsMemberOf("TH_Teachers", @UserName) Then
                Exit

            ElseIf _AD_IsMemberOf("WW_Office", @UserName) Then
                Exit

            ElseIf _AD_IsMemberOf("WW_Teachers", @UserName) Then
                Exit

            ElseIf _AD_IsMemberOf("WH_Office", @UserName) Then
                Exit

            ElseIf _AD_IsMemberOf("WH_Teachers", @UserName) Then
                Exit

            ElseIf _AD_IsMemberOf("TCAPS_Tech", @UserName) Then
                Exit

            ElseIf _AD_IsMemberOf("CHS_Students", @UserName) Then
                MsgBox(0,"Denied","You do not have permissions to logoff")

            ElseIf _AD_IsMemberOf("EMS_Students", @UserName) Then
                MsgBox(0,"Denied","You do not have permissions to logoff")

            ElseIf _AD_IsMemberOf("TCHS_Students", @UserName) Then
                MsgBox(0,"Denied","You do not have permissions to logoff")

            ElseIf _AD_IsMemberOf("WMS_Students", @UserName) Then
                MsgBox(0,"Denied","You do not have permissions to logoff")

            ElseIf _AD_IsMemberOf("WSH_Students", @UserName) Then
                MsgBox(0,"Denied","You do not have permissions to logoff")

            ElseIf _AD_IsMemberOf("BL_Students", @UserName) Then
                MsgBox(0,"Denied","You do not have permissions to logoff")

            ElseIf _AD_IsMemberOf("CE_Students", @UserName) Then
                MsgBox(0,"Denied","You do not have permissions to logoff")

            ElseIf _AD_IsMemberOf("CK_Students", @UserName) Then
                MsgBox(0,"Denied","You do not have permissions to logoff")

            ElseIf _AD_IsMemberOf("CO_Students", @UserName) Then
                MsgBox(0,"Denied","You do not have permissions to logoff")

            ElseIf _AD_IsMemberOf("EA_Students", @UserName) Then
                MsgBox(0,"Denied","You do not have permissions to logoff")

            ElseIf _AD_IsMemberOf("IN_Students", @UserName) Then
                MsgBox(0,"Denied","You do not have permissions to logoff")

            ElseIf _AD_IsMemberOf("LL_Students", @UserName) Then
                MsgBox(0,"Denied","You do not have permissions to logoff")

            ElseIf _AD_IsMemberOf("MO_Students", @UserName) Then
                MsgBox(0,"Denied","You do not have permissions to logoff")

            ElseIf _AD_IsMemberOf("OM_Students", @UserName) Then
                MsgBox(0,"Denied","You do not have permissions to logoff")

            ElseIf _AD_IsMemberOf("SL_Students", @UserName) Then
                MsgBox(0,"Denied","You do not have permissions to logoff")

            ElseIf _AD_IsMemberOf("TH_Students", @UserName) Then
                MsgBox(0,"Denied","You do not have permissions to logoff")

            ElseIf _AD_IsMemberOf("WW_Students", @UserName) Then
                MsgBox(0,"Denied","You do not have permissions to logoff")

            ElseIf _AD_IsMemberOf("WH_Students", @UserName) Then
                MsgBox(0,"Denied","You do not have permissions to logoff")
            EndIf
        Case $ShutdownPC
            Shutdown(5)
    EndSwitch
WEnd
_AD_Close()

Maybe someone can tell me how to fix this without moving the "menu bar". I would actually prefer this, but I am unsure of how it can be down as I thought I was already using just the screen area.

Thanks,

Jeff

Edited by jazzyjeff
Link to comment
Share on other sites

Hi,

I don't know how to move the menu bar, but maybe instead you could set the browser height to compensate for the menu instead.

eg;

GUICtrlCreateObj($ie, 0, 0, @DesktopWidth, @DesktopHeight - 20)

Side note:

you could shorten your code by only checking for permitted Groups/users to Logof/Exit/etc.

If they're not in the permitted list then access is denied.

Not really any need to check every department if they're a student as well..

Don't know if it helps but crude example of shortening the checking procedure.

#region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_icon=favicon.ico
#AutoIt3Wrapper_Res_Comment=Stoneware
#AutoIt3Wrapper_Res_Description=Cloud
#AutoIt3Wrapper_Res_Fileversion=1.0.0.0
#AutoIt3Wrapper_Res_Language=1033
#endregion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <IE.au3>
#include <GUIConstants.au3>
#include <WindowsConstants.au3>
#include <AD.au3>
#include <DateTimeConstants.au3>

; List of permitted users
Global $sPermit = "CHS_Office|CHS_Teachers|EMS_Office|EMS_Teachers|TCHS_Office|TCHS_Teachers|WMS_Office|WMS_Teachers|" & _
        "WSH_Office|WSH_Teachers|BL_Office|BL_Teachers|CE_Office|CE_Teachers|CK_Office|CK_Teachers|" & _
        "CO_Office|CO_Teachers|EA_Office|EA_Teachers|IN_Office|IN_Teachers|LL_Office|LL_Teachers|" & _
        "MO_Office|MO_Teachers|OM_Office|OM_Teachers|SL_Office|SL_Teachers|TH_Office|TH_Teachers|" & _
        "WW_Office|WW_Teachers|Tech"

$ie = _IECreateEmbedded()
$form = GUICreate("TCAPS Cloud", @DesktopWidth, @DesktopHeight, 0, 0, $WS_POPUP, $WS_EX_TOPMOST)
GUISetState(@SW_SHOW)
GUICtrlCreateObj($ie, 0, 0, @DesktopWidth, @DesktopHeight - 20)
_IENavigate($ie, "https://website.com")
$Shutdown = GUICtrlCreateMenu("&Shutdown")
$ShutdownPC = GUICtrlCreateMenuItem("&Shutdown Computer " & @ComputerName, $Shutdown)
$Logoff = GUICtrlCreateMenu("&Logoff")
$LogoffPC = GUICtrlCreateMenuItem("&Logoff Computer " & @ComputerName, $Logoff)
$Exit = GUICtrlCreateMenu("&Exit")
$ExitApp = GUICtrlCreateMenuItem("&Exit Browser", $Exit)
$Time = GUICtrlCreateMenu("&Time")
$TimeApp = GUICtrlCreateMenuItem("", $Time)
HotKeySet("!{F4}", "_Denied")
HotKeySet("^w", "_Denied")
HotKeySet("^{ESC}", "_Denied")
HotKeySet("^+{ESC}", "_Denied")
HotKeySet("!{TAB}", "_Denied")
HotKeySet("!+{TAB}", "_Denied")
Run('TASKKILL /F /PID ' & ProcessExists('explorer.exe'))
_AD_Open()

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $ExitApp
            If _Authorized() Then
                Run("explorer.exe")
                Exit
            Else
                MsgBox(0, "Denied", "You do not have permissions to Exit this application", 5, $form)
            EndIf
        Case $LogoffPC
            If _Authorized() Then
                Exit
            Else
                MsgBox(0, "Denied", "You do not have permissions to logoff", 5, $form)
            EndIf
        Case $ShutdownPC
            Shutdown(5)
    EndSwitch
WEnd
_AD_Close()

;just a small function to check if they're in the permitted list.
Func _Authorized()
    Local $aP = StringSplit($sPermit, "|")
    For $i = 1 To $aP[0]
        If _AD_IsMemberOf($aP[$i], @UserName) Then Return 1
    Next
    Return 0
EndFunc   ;==>_Authorized

Func _Denied()
    MsgBox(0, "Access Denied", "You do not have permissions to exit this program.")
EndFunc   ;==>_Denied

Sorry I can't really check if it works as I don't have AD set up on this PC atm.

Cheers

Edit: I also notice that Ctrl+Alt+Del is still accessible, is it blocked in kiosk mode?

If not I can probably point you in the direction to block it without using hotkeys (since hotkeys can't be set for Ctrl+Alt+Del as they are reserved by windows)

Edited by smashly
Link to comment
Share on other sites

Smashly,

Thanks for your quick reply! The change to the @DesktopHeight macro setting worked. The form now works great!

I never would have thought to create a separate function that would permit specified user groups. I haven't tested this yet, but when I do I'll let you know. It certainly makes the code look a lot neater

If you have any ideas on CTRL-ALT-DEL I would love to hear them! I played around with the idea of using the scancode registry change for certain keys, but this wasn't practical for the environment we're in.

I then would have gone with the idea of blocking this via group policy, but if it can be just off for the duration of the application running, that would be great!

Thanks for your help.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...