Ender7584
28th December 2005 23:31 UTC
Refreshing the install window
Hey,
Background:
When my install is running, and something like the screensaver activates, or they ctr-alt-delete, it doesn't redraw itself. The result, is just white patches all over my installer window.
It's because I'm using the plugin, wansis, and since the author is completly gone I cant get him to modify it. If I knew how, I would have already. I know how to refresh the window, but I don't know when to do it.
Overall question:
Is there a way to tell that my window isn't drawn?
Also, here is what Im doing to refresh my window. Is there an easier way?
FindWindow $1 "#32770" "" $HWNDPARENT
GetDlgItem $0 $1 1018
SendMessage $0 ${SW_HIDE} 0 0
GetDlgItem $0 $1 1044
SendMessage $0 ${SW_HIDE} 0 0
GetDlgItem $0 $1 1035
SendMessage $0 ${SW_HIDE} 0 0
GetDlgItem $0 $1 1018
SendMessage $0 ${SW_SHOW} 0 0
GetDlgItem $0 $1 1044
SendMessage $0 ${SW_SHOW} 0 0
GetDlgItem $0 $1 1035
SendMessage $0 ${SW_SHOW} 0 0
Thank you
Anders
29th December 2005 03:50 UTC
calling InvalidateRect & UpdateWindow or RedrawWindow with erase and all_children with the system plugin is probably better.
unless you subclass the window its hard to tell when you should update, but the fact that the window does not repaint means that the drawing stuff in the plugin is not written correctly
Anders
29th December 2005 05:37 UTC
I did some more testing, i could not get the white parts to stay white (xp sp2) but if i cover parts of the window with another window, then click(and hold) the titlebar of the installer i can see the white patches for a second, the reason for this is that wansis creates its own window that "hosts" the real nsis window. This window is created with COLOR_WINDOW as the backround brush (this is normally white), and the window does not handle the WM_ERASEBKGND message so windows does what its supposed to do; fill the window with the background brush, so this is where the white comes from. The real nsis window inside the wansis window(and the dlg inside that again) also has problems, but i did not look into why, possible reasons are: the author doesnt use the wa_dlg "framework" correctly or the problem is with the wa_dlg "framework" itself.
I was able to reduce the white parts (most of the window gets filled with the skins background color, not perfect but better, the border is still white)
onGUIInit
>; !insertmacro SKINCONFIG 1 1
${SKINIT} winamp
Pop$0
StrCmp$0 "success" noerror
MessageBox MB_ICONEXCLAMATION
|MB_OK "wansis error: $0"
noerror:
## NEW CODE STARTS HERE ###
System::Call "User32::GetParent(i $hwndParent)i.s"
pop $1
System::Call "User32::GetWindowLong(i $1, i -16)i.s"
pop $0
intop$0 $0 | 0x2000000
System::Call "User32::SetWindowLong(i $1, i -16,i $0)i"
${SETSKIN} winamp #nasty hack to repaint
## END ##
>FunctionEnd
>
i did this to the classic example that comes with wansis (adds WS_CLIPCHILDREN style to wansis window)
wansis has several other bugs, Ex; The Install button looses its skinning when you type in the dest dir text box (seems to happen only when the "mode" changes (valid/invalid dest dir)). The showdetails button and progressbar is not skinned (And i could go on and on)
Even the code that converts strings to uppercase is broken (not sure if this is a problem, those strings are only compared to hardcoded classnames, but the comment says convert to uppercase and that is not the case(heh), anything above 'z' will be converted aswell)
In other words, wansis is horribly broken and I would not recommend using it
Ender7584
3rd January 2006 21:19 UTC
Thanks for all your help. I'm just about to look at everything you did, and hopefully it will provide a workaround.
Is there a better way then wansis to get my installer looking like it is now (aka skinned). Writing more code isn't much of a problem, I just don't know how to go about doing it. I haven't messed to much with the GUI. If there is a way, a link to an example would be awesome.
Thank you again,
Ender7584