Hello,
I'm trying to hide or remove the title bar of a particular window using the SetWindowLongA function of User32.dll.
I tried the code below, but it failed.
LibFunc>User32,SetWindowLongA,r,%nHandle%,-16,0
Pages referenced:
https://learn.microsoft.com/ko-kr/windo ... indowlonga
viewtopic.php?t=1759
If there is any other way, I would appreciate it if you could let me know.
How to hide or remove Windows title bar
Moderators: Dorian (MJT support), JRL
- Grovkillen
- Automation Wizard
- Posts: 1131
- Joined: Fri Aug 10, 2012 2:38 pm
- Location: Bräcke, Sweden
- Contact:
Re: How to hide or remove Windows title bar
This technique changes the title of a window. Removing it would simply be make the title blank.
After reading Grovkillen's response I'm not sure whether you want to rename a window, remove it from the taskbar or remove the titlebar from the window.
If you want to remove the titlebar, things get a little more complex. This modified from Marcus here
Open Notepad then run the following. Should work similarly with most windows. Be aware that with the title bar gone you may find it tedious to close the window. Notepad can be closed by selecting the window and then pressing Alt + F4
After reading Grovkillen's response I'm not sure whether you want to rename a window, remove it from the taskbar or remove the titlebar from the window.
If you want to remove the titlebar, things get a little more complex. This modified from Marcus here
Open Notepad then run the following. Should work similarly with most windows. Be aware that with the title bar gone you may find it tedious to close the window. Notepad can be closed by selecting the window and then pressing Alt + F4
Code: Select all
GetWindowHandle>Notepad*,wndhndl
Let>WS_CAPTION=12582912
Let>WS_MINIMIZEBOX=131072
Let>WS_MAXIMIZEBOX=65536
Let>WS_SYSMENU=524288
Let>WS_THICKFRAME=262144
Let>WS_POPUP=2147483648
Let>WS_CHILD=1073741824
Let>WS_VISIBLE=268435456
Let>WS_BORDER=8388608
//get current style
LibFunc>user32,GetWindowLongA,style,wndhndl,-16
//modify style to remove borders and size frame
Let>style={(%style% And Not %WS_CAPTION%)}
Let>style={(%style% And Not %WS_THICKFRAME%)}
LibFunc>user32,SetWindowLongA,sres,wndhndl,-16,style
//refresh - we have to tell it the frame changed
Let>SWP_FRAMECHANGED=32
Let>SWP_NOMOVE=2
Let>SWP_NOZORDER=4
Let>SWP_NOSIZE=1
Let>flags={(%SWP_FRAMECHANGED% OR %SWP_NOMOVE% OR %SWP_NOZORDER% OR %SWP_NOSIZE%)}
LibFunc>user32,SetWindowPosA,r,wndhndl,0,0,0,0,0,flags
Re: How to hide or remove Windows title bar
모두 도움을 주셔서 감사합니다.JRL wrote: ↑Thu Jun 20, 2024 8:22 pmThis technique changes the title of a window. Removing it would simply be make the title blank.
After reading Grovkillen's response I'm not sure whether you want to rename a window, remove it from the taskbar or remove the titlebar from the window.
If you want to remove the titlebar, things get a little more complex. This modified from Marcus here
Open Notepad then run the following. Should work similarly with most windows. Be aware that with the title bar gone you may find it tedious to close the window. Notepad can be closed by selecting the window and then pressing Alt + F4
Code: Select all
GetWindowHandle>Notepad*,wndhndl Let>WS_CAPTION=12582912 Let>WS_MINIMIZEBOX=131072 Let>WS_MAXIMIZEBOX=65536 Let>WS_SYSMENU=524288 Let>WS_THICKFRAME=262144 Let>WS_POPUP=2147483648 Let>WS_CHILD=1073741824 Let>WS_VISIBLE=268435456 Let>WS_BORDER=8388608 //get current style LibFunc>user32,GetWindowLongA,style,wndhndl,-16 //modify style to remove borders and size frame Let>style={(%style% And Not %WS_CAPTION%)} Let>style={(%style% And Not %WS_THICKFRAME%)} LibFunc>user32,SetWindowLongA,sres,wndhndl,-16,style //refresh - we have to tell it the frame changed Let>SWP_FRAMECHANGED=32 Let>SWP_NOMOVE=2 Let>SWP_NOZORDER=4 Let>SWP_NOSIZE=1 Let>flags={(%SWP_FRAMECHANGED% OR %SWP_NOMOVE% OR %SWP_NOZORDER% OR %SWP_NOSIZE%)} LibFunc>user32,SetWindowPosA,r,wndhndl,0,0,0,0,0,flags
JRL이 알려준 코드가 제게 맞는 것 같습니다만 아쉽게도 제가 하려고하는 크롬 창에는 적용되지 않는 것 같습니다.
작동하는 윈도우와 불가능한 윈도우가 있는것 같아요.
저는 윈도우11을 사용하고 있습니다.
크롬의 타이틀바를 제거하여 내용을 다이얼로그 패널 크기에 맞추려는 작업을 시도하고 있었습니다.
- Grovkillen
- Automation Wizard
- Posts: 1131
- Joined: Fri Aug 10, 2012 2:38 pm
- Location: Bräcke, Sweden
- Contact:
Re: How to hide or remove Windows title bar
Ah, JRL's answer makes me revaluate my answer. You're asking to remove the title bar of the individual window, my answer is regarding the Taskbar.
Re: How to hide or remove Windows title bar
Perhaps SetParent would do what you want. See Marcus' example here. The sample uses Internet Explorer, you will want to use a different browser of your choice. The reason I think SetParent might help is that the browser window can be positioned in the dialog such that the upper portion of the browser window will be hidden. No way a user can move the browser within the dialog.
When the dialog is closed the Browser window closes as does the browser application.
When the dialog is closed the Browser window closes as does the browser application.