Archive: Using icons from a DLL on a custom page


Using icons from a DLL on a custom page
I want to add some icons to a custom page.

Is there a way to use icons from a DLL when creating a custom page or do I have to extract all the icons I want to use and then store the full path of each icon file in the InstallOptions INI file?


I don't think that's possible, but LoadImage might surprise us. The documentation isn't very clear on it, it says it will load the icon from a file. If it does then it'll probably take the first icon in the file. Can you please test this and let us know?


Thanks for the suggestion. I've not used anything in System.nsh yet, so I tried to compile the Contrib\System\System.nsi example. There were no errors but when I try to run the EXE all I get is a very brief flash of the program then it disappears.

I'm was using Win98SE and NSIS 2.0b3. I uninstalled 2.0b3, and tried 2.0b2, 2.0b1 and 2.0b0 but had no better luck with this example.


I am sorry, I wasn't clear enough. InstallOptions uses LoadImage to load icons and bitmaps, you don't need System to do it. You can however use ExtractIcon with System and extract the icon to an .ico file at run-time but that will be kind of a waste IMO.

I'll ask brainsucker about the System example, it happens to me too. My own examples work though...


1. Kichik: could you please update sysfunc.nsh from system dir: change GetFullPathName to SearchPath call.
2. Kichik: do you have problems only with splash, i.e. with last example? What are they looking like?
3. pengyou: could you please remove all code between lines
; ---- Sample 1
and
; ---- Sample 3

from system.nsi and try to run it again? May be it'll help us to find problem...


After removing the code for examples 1 and 2, as requested, I could get the system.nsi demo to run as far as the GetFileSysTime example. The time data shown is all zero (year 0, month 0, etc) and when I click the OK button to move on to sample 7, I get a GPF at once:


SYSTEM caused a stack fault in module KERNEL32.DLL at 0187:bff724c1.
Registers:
EAX=002a0037 CS=0187 EIP=bff724c1 EFLGS=00000283
EBX=ff469000 SS=018f ESP=004519ea EBP=004519fe
ECX=0000f343 DS=018f ESI=00451a0e FS=4dcf
EDX=81dc75ac ES=018f EDI=81dc75ac GS=4d56
Bytes at CS:EIP:
6a ff e8 07 ad 01 00 eb e7 55 8b ec 56 57 53 8b
Stack dump:
ff469000 81dc75b4 00451a0e 00451a2a 00451aa8 00451a84 bff729fe 81dc75ac
00451a0e 1697002c 01bf0020 00451a1a 00000022 00000000 00530ea0 00000000

Hope this helps.

[edit]I tried removing just the lines between ;----- Sample 1 and ;----- Sample 2 and found that sample 2 worked ok (the figures for disk space seemed to be accurate).[/edit]

Changed to SearchPath.

It sometimes just exits the installer as it gets to the splash. I tried to put some message boxes in there to see exactly where but everytime I change the location it exits the installer on a different location, sometimes it even works. Even when I don't add anything it sometimes works and sometimes doesn't. I don't even recompile...


All the problems beside callbacks are solved... I'll rewrite stack working rountines and post a new version in a few hours...


Great. Thanks :)


Sorry for dragging up an old thread but I figured it would be better to do so than to start a new one.
I'm currently not able to have InstallOptions use an icon either by setting it to MB_ICONSTOP or by specifying the path to the icon (which would be $SYSDIR\user32.dll,103). It does load .ico files. Am I missing something? Is there a system call I should make? Is there an easier way of doing this?


It wasn't said it is possible, just that it might work and should be tested. According to your test, it doesn't ;)

You can probably make it work with System.dll and some GetDlgItem and SendMessage instructions.


Check and check. Thanks! (Maybe the functionality can be added in the future, nudge nudge? ;))


Maybe. It might already be in InstallOptionsEx.


Negative on that one, just tested with the same result with InstallOptionsEx. Too bad, guess I'll just need to add an additional 34kB to the installer, or dive into the Windows API references again...


Maybe. It might already be in InstallOptionsEx.
You're really thinking I've done all for that plugin. :) That's a great idea though to add. Please post any feature request on "InstallOptionsEx" thread that I'm going to examinate them futuraly.