Hello Guys
Is it possible to set in the MUI_PAGE_DIRECTORY the destination folder field to readonly and disabling the browse button? All this during runtime.
The reason for this:
I have an installer which only works if you are an admin...
so far so good...
now I'd like to allow a non admin user to update the software meaning:
If the software is already installed
he is allowed to update/replace the executables + config files
but he is not allowd to change the installationpath and so on...
disable MUI_PAGE_DIRECTORY Directory field
11 posts
Not tested but should work.!include WinMessages.nsh
!define MUI_PAGE_CUSTOMFUNCTION_SHOW DirectoryPageShow
!insertmacro MUI_PAGE_DIRECTORY
Function DirectoryPageShow
StrCmp ... SkipDisable
FindWindow $R0 "#32770" "" $HWNDPARENT
GetDlgItem $R1 $R0 1019
SendMessage $R1 ${EM_SETREADONLY} 1 0
GetDlgItem $R1 $R0 1001
EnableWindow $R1 0
SkipDisable:
FunctionEnd
Stu
thanks for the help
exactly what needed
exactly what needed
Hey there I just started learning NSIS yesterday and I need to do exactly what the topics says, but I dunno where and how, Could u please gimme a more detailed explanation about this.
To make a field readonly you have to tell the edit box that it is "readonly" no
In "Windows you do this by sending a Message to the edit box (in Windows everything is a Windows, even a button and so on)
and this does the code above
after this the editbox is "readonly"
but this is some homework for you to find out whats the difference between setting readonly and disable an edit box ;-)
hope it helps
nobs
In "Windows you do this by sending a Message to the edit box (in Windows everything is a Windows, even a button and so on)
and this does the code above
gets the ID of the dialog which contains the edit boxFindWindow $R0 "#32770" "" $HWNDPARENT
gets the id of the edit box in this dialogGetDlgItem $R1 $R0 1019
SendMessage $R1 ${EM_SETREADONLY} 1 0 sends the message "Readonly" to the editboxafter this the editbox is "readonly"
gets the id of the Browse Button in this dialogGetDlgItem $R1 $R0 1001
A Button cannot be set "readonly" so you have to disable it completly (you can do this with the edit box to)EnableWindow $R1 0
but this is some homework for you to find out whats the difference between setting readonly and disable an edit box ;-)
hope it helps
nobs
where can I find the Id's of components (pages, buttons,editboxes a.s.o.)?
try and error 🙁
sorry but as far as I know there is no other way
it sound's more diffecult than it is
the numbers are all over 1000
often you can get it via the code... (e.g. UMUI.nsh)
or by trying around a little bit (there a not so many items on a dialog
sorry but as far as I know there is no other way
it sound's more diffecult than it is
the numbers are all over 1000
often you can get it via the code... (e.g. UMUI.nsh)
or by trying around a little bit (there a not so many items on a dialog
open the appropriate UI stub (C:\Program Files\NSIS\Contrib\UIs) with a resource editor (Visual Studio, ResHacker, etc...)
and find the ID in the page (dialog) you're interested in
and find the ID in the page (dialog) you're interested in
ok, thanks!
I use directory page now.
if I detect some components installed, I disable the directory change.
But it is possible to change directory!
If You press any key on keybord for example.
sie Attachment please.
Can I disable this?
thanks.
I use directory page now.
if I detect some components installed, I disable the directory change.
But it is possible to change directory!
If You press any key on keybord for example.
sie Attachment please.
Can I disable this?
thanks.
try this
FindWindow $R0 "#32770" "" $HWNDPARENT
GetDlgItem $R1 $R0 1019
SendMessage $R1 ${EM_SETREADONLY} 1 0
EnableWindow $R1 0
GetDlgItem $R1 $R0 1001
EnableWindow $R1 0
exact! thanks!