Odd question:
Is there a way that I can disable the Close button (little 'x' in the upper right-hand corner) of an installer window?
Or, perhaps a way to remove the title bar altogether?
First, I thought perhpas a SendMessage or EnableWindow command might do it, but couldn't find a handle to this control or a command to use to do it.
Next, I thought maybe I could use Resource Hacker to do it, but couldn't find a way to get to that part of the Window.
Can anyone give me a push in the right direction?
Disable or remove Windows close button?
14 posts
Edit the dialog in Resource Hacker and remove the WS_SYSMENU style from IDD 105 (or to remove the whole caption, remove WS_CAPTION).
-Stu
-Stu
Perhaps I'm doing something wrong as I cannot make this work. Using Resource Hacker, I changed the file ${NSISDIR}\Contrib\UIs\default.exe to remove WS_SYSMENU. I saved the EXE and confirmed the save by viewing the modified date of default.exe. I then just recompile my NSIS script, but nothing changes. Have I missed a step?
2nd qustion:
I found this article about how to disable the close box that I thought I'd try using the system plugin. I found the function on MSDN, so I decided to GetSystemMenu setup an experiment with Windows Notepad using this function:
2nd qustion:
I found this article about how to disable the close box that I thought I'd try using the system plugin. I found the function on MSDN, so I decided to GetSystemMenu setup an experiment with Windows Notepad using this function:
But each time I run, my result returns 'error'. Can anyone tell me what I might be doing wrong?
FindWindow $5 '' 'Untitled - Notepad'
MessageBox MB_OK "handle of Notepad: $5"
System::Call "user32::GetSystemMenu (i r5,i 0) i.r6"
;MessageBox MB_OK "Return value #1: $R1"
MessageBox MB_OK "Result: $6"
Are you using Modern UI? If so you need to modify modern.exe. Also, when removing the styles, make sure you click the Compile button in Resource Hacker and then File>Save.
-Stu
-Stu
No, I'm not using MUI. (I wanted to start with baby steps). and yes, I did both compile and save.
Anyone have any idea why my System Plugin call isn't working from above?
disable close:
function .onGuiInit
push $1
System::Call "user32::GetSystemMenu(i $HWNDPARENT,i 0) i.s"
pop $1
System::Call "user32::EnableMenuItem(i $1,i 0xF060,i 1)"
pop $1
functionEnd nasty hack to remove titlebar: (windows size is a bit off, and you really should do the proper bit-twiddling to remove the required bits and call Redraw window instead of all those ShowWindow calls)function .onGuiInit
System::Call 'user32::SetWindowLong(i $HWNDPARENT,i -16,i 339871820)'
ShowWindow $HWNDPARENT 0
ShowWindow $HWNDPARENT 2
ShowWindow $HWNDPARENT 0
ShowWindow $HWNDPARENT 1
functionEnd Thanks, Anders!
For some reason, I wasn't getting the handle returned from my GetSystemMenu function, but since your function seems to work, so I'll just go with that. 😉
For some reason, I wasn't getting the handle returned from my GetSystemMenu function, but since your function seems to work, so I'll just go with that. 😉
Originally Posted by Anders View Postdisable close:
nasty hack to remove titlebar: (windows size is a bit off, and you really should do the proper bit-twiddling to remove the required bits and call Redraw window instead of all those ShowWindow calls)function .onGuiInit push $1 System::Call "user32::GetSystemMenu(i $HWNDPARENT,i 0) i.s" pop $1 System::Call "user32::EnableMenuItem(i $1,i 0xF060,i 1)" pop $1 functionEnd
function .onGuiInit System::Call 'user32::SetWindowLong(i $HWNDPARENT,i -16,i 339871820)' ShowWindow $HWNDPARENT 0 ShowWindow $HWNDPARENT 2 ShowWindow $HWNDPARENT 0 ShowWindow $HWNDPARENT 1 functionEnd
Mr Anders
When i use from:
function .onGuiInit System::Call 'user32::SetWindowLong(i $HWNDPARENT,i -16,i 339871820)' ShowWindow $HWNDPARENT 0 ShowWindow $HWNDPARENT 2 ShowWindow $HWNDPARENT 0 ShowWindow $HWNDPARENT 1 functionEnd
This method possible?
Are you using the MoveAnywhere plugin?Originally Posted by r2du-soft View PostMr Anders
When i use from:
Then i cant move installer position in screen with mouse,i want hide title bar but i want change installer position in screen with mouse...function .onGuiInit System::Call 'user32::SetWindowLong(i $HWNDPARENT,i -16,i 339871820)' ShowWindow $HWNDPARENT 0 ShowWindow $HWNDPARENT 2 ShowWindow $HWNDPARENT 0 ShowWindow $HWNDPARENT 1 functionEnd
This method possible?
No i usent that plugin,i search but not found that...
Why do you think it would be possible without a plug-in? This is non-standard Windows behavior.Originally Posted by r2du-soft View PostNo i usent that plugin,i search but not found that...
Search this forum for MoveAnywhere and I'm sure you'll find it...
i use from
to remove installer titlebar in custome pages
now i want restore and show deafult (minimize,close,maximize,titlebar) in Section
how can do it?
i use ShowWindow $HWNDPARENT ${SW_SHOW} but not restore!!
function .onGuiInit System::Call 'user32::SetWindowLong(i $HWNDPARENT,i -16,i 339871820)' ShowWindow $HWNDPARENT 0 ShowWindow $HWNDPARENT 2 ShowWindow $HWNDPARENT 0 ShowWindow $HWNDPARENT 1 functionEnd
now i want restore and show deafult (minimize,close,maximize,titlebar) in Section
how can do it?
i use ShowWindow $HWNDPARENT ${SW_SHOW} but not restore!!
Save the style first
var originalstyleand then you can probably use that to restore instead of using a magic number.
function .onGuiInit
System::Call 'user32::GetWindowLong(i $HWNDPARENT,i -16)i.s
pop $originalstyle