Archive: plugin code question


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.


what about WM_GETICON? or ExtractIcon(Ex)


ExtractIcon is the best way, but

LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(103)), 0);
works as well ;)

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.


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.


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

I actually meant that I didn't know the function existed :rolleyes:. You learn something everyday :o.


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.


http://msdn.microsoft.com/library/de...procedures.asp


Thanks guys, thats just what I need.


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.


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" :)


Thanks man, this will be a great starting point. I am still trying to learn C/C++ (hence my bad programming).


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.


Thank you :)

-Stu


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.


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

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.


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.


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.