emendelson Posted October 2, 2021 Share Posted October 2, 2021 Is there existing code that can hide the titlebar and menubar of a running application (like Notepad)? I've searched for an answer to this and see that the answer will make use of _WinAPI_SetWindowLog and $GWL_Style, but I haven't been to figure out the correct syntax. I'll be grateful for any examples or instruction Link to comment Share on other sites More sharing options...
Solution AlessandroAvolio Posted October 2, 2021 Solution Share Posted October 2, 2021 (edited) Hello, this could help you. #include <GuiConstants.au3> #include <WinAPISysWin.au3> #include <GuiMenu.au3> Main() Func Main() Local $hWnd, $iStyle, $hMenu, $aWinPos Run("notepad") $hWnd = WinWait("[Class:Notepad]", "") Sleep(50) ;~ Retrieves the handle of the menu assigned to the given window $hMenu = _GUICtrlMenu_GetMenu($hWnd) ;~ Deletes menu items from the specified menu For $i = _GUICtrlMenu_GetItemCount ($hMenu) - 1 To 0 Step -1 _GUICtrlMenu_RemoveMenu($hMenu, $i) Next ;~ Retrieves style about the specified window $iStyle = _WinAPI_GetWindowLong($hWnd, $GWL_STYLE) ;~ Remove title bar $iStyle = BitXOR($iStyle, $WS_POPUPWINDOW) _WinAPI_SetWindowLong($hWnd, $GWL_STYLE, $iStyle) ;~ Refresh window style $aWinPos = WinGetPos($hWnd) WinMove($hWnd, "", $aWinPos[0], $aWinPos[1], $aWinPos[2] + 1) Return 0 EndFunc Edited October 2, 2021 by AlessandroAvolio Zedna, argumentum and Gianni 3 Link to comment Share on other sites More sharing options...
emendelson Posted October 2, 2021 Author Share Posted October 2, 2021 (edited) That is perfect, thank you! I've also been trying it with the DOSBox-X emulator, which seems to rebuild its window when it opens. I've got it working by waiting for the window to appear the first time, then waiting for a second, and then getting the handle of the window by title, after it's been rebuilt. It works perfectly. Thank you again! Edited October 2, 2021 by emendelson Found the answer AlessandroAvolio 1 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now