Archive: Refresh *.ini


Refresh *.ini
Hello,

I have following problem...

I have a costum MUI Page with a list of some software that have to be installed.
I check some Reg Strings to see if the software is installed or not. When the software is not installed you can click a button and install it now.

Now I need a refresh button for this costum page, to show that the software is now installed. Is this possible???


When the page is already displayed, you cannot edit the INI. InstallOptions won't reload the INI while the page is showing. You'd have to use Windows messages or instructions like ShowWindow and EnableWindow to edit the page. How exactly does the page show the software is installed?


The page looks like this:

Software 1 "not installed" Button (Install now)
Software 2 "installed" Button (disabled)
Software 3 "installed" Button (disabled)

When I click on the Installbutton I can install the software.
I need a refresh function to show that the software is now installed.


But what is "software 1 installed"? Is it a label? If it is, simply get its HWND by reading it from the INI and send it WM_SETTEXT. See Examples\InstallOptions\testnotify.nsi for a working example of such an operation.


"Software 1" is a label
"not installed" is a label
"Button (Install now)" is a button


Then modify the second label using SendMessage as explained above.


I dont undertstand winmessages.nsh. What is it good for?? Ive read the docu but i dont know how to use these commands.


It contains definitions like WM_SETTEXT.


I have nearly the same problem, i try to do some checks and want to disply it by checkboxes.

but its only updated on the end of the function.
Its it possible to get a refresh of the UI after the send message command?


Function CustomLeave
GetDlgItem $R0 $HWNDPARENT 1
EnableWindow $R0 0
readinistr $2 '$PLUGINSDIR\systemcheck.ini' 'Field 4' 'HWND'
SendMessage $2 ${BM_SETCHECK} 1 0
Sleep 1000

readinistr $2 '$PLUGINSDIR\systemcheck.ini' 'Field 5' 'HWND'
SendMessage $2 ${BM_SETCHECK} 1 0
Sleep 1000
...
...
EnableWindow $R0 1
FunctionEnd

That piece of code looks fine and should update the display by checking the check boxes. There must be something else in the script preventing it from actually happening. Attach the complete script.



!insertmacro MUI_PAGE_WELCOME
Page custom CustomShow CustomLeave
!insertmacro MUI_PAGE_LICENSE License.rtf
.
.
.
Function CustomShow
GetDlgItem $R0 $HWNDPARENT 1
SendMessage $R0 ${WM_SETTEXT} 1 "STR:Check"
!insertmacro MUI_HEADER_TEXT "System Check" "Checking System requirements"
!insertmacro INSTALLOPTIONS_DISPLAY "systemcheck.ini"
FunctionEnd

Function CustomLeave
GetDlgItem $R0 $HWNDPARENT 1
EnableWindow $R0 0
;TODO check WinVersion

readinistr $2 '$PLUGINSDIR\systemcheck.ini' 'Field 4' 'HWND'
SendMessage $2 ${BM_SETCHECK} 1 0
Sleep 1000

;TODO check browser
readinistr $2 '$PLUGINSDIR\systemcheck.ini' 'Field 5' 'HWND'
SendMessage $2 ${BM_SETCHECK} 1 0
Sleep 1000

!insertmacro IsUserAdmin $0
IntCmp $0 1 Ok AdminWarning
AdminWarning:
MessageBox MB_OK "You have no administration rights on this PC$\nAsk the Administrator for more information."
Abort
OK:
readinistr $2 '$PLUGINSDIR\systemcheck.ini' 'Field 6' 'HWND'
SendMessage $2 ${BM_SETCHECK} 1 0
Sleep 1000
MessageBox MB_OK "DEBUG:STOP"
EnableWindow $R0 1
FunctionEnd

systemcheck.ini:
[Settings]
NumFields=6

[Field 1]
Type=Label
Left=107
Top=73
Right=187
Bottom=82
Text=Administrator rights

[Field 2]
Type=Label
Left=107
Top=52
Right=187
Bottom=61
Text=Browser (IE 7)

[Field 3]
Type=Label
Left=107
Top=33
Right=187
Bottom=42
Text=Windows Version

[Field 4]
Type=CheckBox
Left=91
Top=32
Right=107
Bottom=42
Flags=DISABLED|NOTIFY

[Field 5]
Type=CheckBox
Left=91
Top=52
Right=107
Bottom=62
Flags=DISABLED|NOTIFY

[Field 6]
Type=CheckBox
Left=91
Top=72
Right=107
Bottom=82
Flags=DISABLED|NOTIFY


The checkboxes are disabled, they should be only statusdisplay, not selectabel by user.
Also on enabled they will not updated after setting, seperate labels so the text is black instead of greyout.

Macro "IsUserAdmin" is copied from http:// nsis.sourceforge.net /Check_if_the_current_user_is_an_Administrator

The window will be updated at the end of function, when the Messagebox is displayed,
but i need a update before every sleep

You can't both sleep and update the screen. The function must return in order for the message loop to process drawing of the dialog.


thanx for the fast answer.

If I return after the first check i need another user interaction, is it possible to triger it automatical again? so i can count it how often it is called and jumps out after last loop.

or any other idea how to implements a step-by-step display without interaction?


You would really need to write a plug-in in C/C++ to do this. For example, create a dialog in your Visual Studio designer and then modify it asynchronously in another thread at run time. This is basically how the LockedList plug-in works with a dynamically updated list box.

Stu