- NSIS Discussion
- plugin code question
Archive: plugin code question
JasonFriday13
18th March 2006 23:11 UTC
plugin code question
I am currently re-writing one of my plugins for nsis and I have a question. I am re-writing the bgimage plugin to suit my needs, and I have made the background window have a title bar and system controls (icon, minimize, maximize, and close). The window (not deing a dialog) has a default application icon instead of having the icon from the nsis installer. In the past I have included the icon in the installer and extracted it to the plugins dir, then the plugin loads the icon from the file.
My question is can I load the icon from the nsis installer instead of from the file in the plugins dir. I have already tried loading the icon from the nsis installer with no luck.
Anders
19th March 2006 05:39 UTC
what about WM_GETICON? or ExtractIcon(Ex)
Takhir
19th March 2006 06:51 UTC
ExtractIcon is the best way, but
LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(103)), 0);
works as well ;)
JasonFriday13
19th March 2006 22:11 UTC
I have tried those but not with the parameters in the example. Thanks for the answer, I will try it tonight.
[edit]: I now use scons to build all of my software... all two of my projects :o. I still use VC 6 IDE to edit the source code.
JasonFriday13
20th March 2006 21:57 UTC
It does work. Almost everything else I tried did not work. I didn't know I could use GetModuleHandle(NULL) as the instance handle. Thanks guys.
Joel
21st March 2006 01:39 UTC
Originally posted by JasonFriday13
I didn't know I could use GetModuleHandle(NULL) as the instance handle. Thanks guys.
Why not :)
From msdn:
If this parameter is NULL, GetModuleHandle returns a handle to the file used to create the calling process (.exe file).
:p
JasonFriday13
21st March 2006 02:59 UTC
I actually meant that I didn't know the function existed :rolleyes:. You learn something everyday :o.
JasonFriday13
23rd March 2006 00:47 UTC
I have another question. It is the same question I asked last year about moving a progress bar in my custom dialog, where the value is taken from the instfiles page progress bar. Kichik already gave a solution, but I don't know what subclassing is, and I don't know how to forward messages either. Giving an example .cpp and/or .rc file would be a big help.
JasonFriday13
23rd March 2006 23:55 UTC
Thanks guys, thats just what I need.
JasonFriday13
26th March 2006 22:10 UTC
I have managed to get it working but in a different way. I have noticed there are no PBM_SETPOS messages being sent during the install, so I used PBM_GETPOS and PBM_SETPOS in a window procedure so that it is redrawn whenever the windows procedure gets a message. Problem is that the progress bar does not always move with the installers progress bar. I have attached the test installer that illustrates this.
Takhir
27th March 2006 05:51 UTC
Your custom popup dialog is unavailable all the time it is visible. Nxs plug-in may become a good start point for dialog "with progress bar and cancel button" :)
JasonFriday13
28th March 2006 00:44 UTC
Thanks man, this will be a great starting point. I am still trying to learn C/C++ (hence my bad programming).
JasonFriday13
28th March 2006 22:20 UTC
This is off topic, but I just found out that Afrow UK has been made a moderator. I knew it would be someone with a long history on the forums. Way to go man.
Afrow UK
29th March 2006 13:39 UTC
Thank you :)
-Stu
JasonFriday13
29th March 2006 22:26 UTC
I just relized I was not creating my dialog in a thread (like the banner plugin does). This might fix one of my problems :o.
Joel
30th March 2006 05:20 UTC
Originally posted by JasonFriday13
This is off topic, but I just found out that Afrow UK has been made a moderator. I knew it would be someone with a long history on the forums. Way to go man.
So Stu, how many cookies did you sell? :p
Congratulations
JasonFriday13
23rd May 2006 23:39 UTC
I have a code question, but it is not a plugin question :weird:. It is about the NSIS source code. I am trying to make a stub that has no compression support (smaller exehead, and I am bored :rolleyes: ).
My question is: If the compiler encounters a 'SetCompress off' command,
can I skip the code in the '#ifdef NSIS_COMPRESSION_SUPPORT' and/or 'NSIS_COMPRESS_WHOLE' using a run-time variable? Would that work?
I relise this requires no stub, but it is one of the easiest ways I can think of to have a smaller no compression exehead.
kichik
1st June 2006 08:15 UTC
Compression code is already skipped if SetCompress off is used. When parsed, it sets a variable that's checked before compression. Simply set that variable and change the stub for a compression-less installer.
JasonFriday13
1st June 2006 23:17 UTC
Cool :cool: . Thanks for that. I have already modified the build system to build a compression-less stub, and now to put it all together.