WINAMP.COM | Forums : Powered by vBulletin version 2.3.9 WINAMP.COM | Forums > Developer Center > NSIS Discussion > nsDialogs, NSD_CreateBitmap, NSD_SetImage - JPEG support?
  Last Thread   Next Thread
Author
Thread Post New Thread    Post A Reply
Animaether
Major Dude

Registered: Jun 2001
From:

nsDialogs, NSD_CreateBitmap, NSD_SetImage - JPEG support?

Okay, I just ran into a bit of a stumbling block upgrading to the latest-and-greatest NSIS; using InstallOptionsEx has a drop-in no longer works when using MUI. I can work around it by using an older MUI header file, but I realize that eventually I'll have to move even this mammoth script over to nsDialogs.

However, that presents the next stumbling block.. I tried setting a JPG as a bitmap's image in the past and just again now and... I don't get any image. If I specify a BMP, things are fine.
What am I missing? Is there any way - no matter how contrived - to use a JPG directly for an nsDialogs bitmap control?

We're using JPEG files not just within the installer to cut down on size, but also for downloaded content.

I did think this was covered in the forums before, but I couldn't find anything among the noise in a search for the two rather common keywords.

Quick Link | Report this post to a moderator | IP: Logged

Animaether is offline Old Post 02-06-2009 10:34 AM
Click Here to See the Profile for Animaether Click here to Send Animaether a Private Message Find more posts by Animaether Add Animaether to your buddy list Edit/Delete Message Reply w/Quote
kichik
M.I.A.
[NSIS Dev, Mod]

Registered: Oct 2001
From: Jerusalem, Israel

You could probably replace the LoadImage call in nsDialogs.nsh with a call to OleLoadPicturePath and then get the image handle from the interface this function returns.

__________________
NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius

Quick Link | Report this post to a moderator | IP: Logged

kichik is offline Old Post 02-06-2009 02:17 PM
Click Here to See the Profile for kichik Click here to Send kichik a Private Message Visit kichik's homepage! Find more posts by kichik Add kichik to your buddy list Edit/Delete Message Reply w/Quote
Animaether
Major Dude

Registered: Jun 2001
From:

hehe.. well the "you" part in there is putting a lot of (misplaced) confidence in me - but I'll have a peek through MSDN and the System docs

Quick Link | Report this post to a moderator | IP: Logged

Animaether is offline Old Post 02-06-2009 03:28 PM
Click Here to See the Profile for Animaether Click here to Send Animaether a Private Message Find more posts by Animaether Add Animaether to your buddy list Edit/Delete Message Reply w/Quote
Takhir
Major Dude

Registered: Feb 2004
From: Moscow, Russia

This may help http://nsis.sourceforge.net/Embedded_Banner
You can also search for jpeg on NSIS main page http://nsis.sourceforge.net/Main_Page

Quick Link | Report this post to a moderator | IP: Logged

Takhir is offline Old Post 02-06-2009 04:18 PM
Click Here to See the Profile for Takhir Click here to Send Takhir a Private Message Visit Takhir's homepage! Find more posts by Takhir Add Takhir to your buddy list Edit/Delete Message Reply w/Quote
Animaether
Major Dude

Registered: Jun 2001
From:

yeah, unfortunately the various banner/etc. plugins all have their sets of limitations.. e.g.
- not within a dialog
- fixed place within a dialog
- not clickable

All I really need is basically what kichik wrote... which I *think* I can figure out... except I'm stuck (at least) at...

code:
riid (in parameter) Reference to the identifier of the interface describing the type of interface pointer to return in ppvRet.

...which I mostly see as using 'IID_IPicture' in examples - but where on earth that particular ID is coming from.. *puzzles*

Quick Link | Report this post to a moderator | IP: Logged

Animaether is offline Old Post 02-06-2009 04:51 PM
Click Here to See the Profile for Animaether Click here to Send Animaether a Private Message Find more posts by Animaether Add Animaether to your buddy list Edit/Delete Message Reply w/Quote
Anders
Major Dude

Registered: Jun 2002
From: N/A

IID_IPicture is a guid, {7BF80980-BF32-101A-8BBB-00AA00300CAB} i think, so:

g "{7BF80980-BF32-101A-8BBB-00AA00300CAB}", and the pointer to the COM object param should look something like: *i .r0

Remember when working with COM objects, you need to figure out the correct offset in the vtable when calling methods on COM objects

__________________
IntOp $PostCount $PostCount + 1

Quick Link | Report this post to a moderator | IP: Logged

Anders is offline Old Post 02-06-2009 05:09 PM
Click Here to See the Profile for Anders Click here to Send Anders a Private Message Visit Anders's homepage! Find more posts by Anders Add Anders to your buddy list Edit/Delete Message Reply w/Quote
Anders
Major Dude

Registered: Jun 2002
From: N/A

see http://source.winehq.org/source/inc...tdole2.idl#L303 ...and remember, 0,1 and 2 are IUnknown, so the first method in IPicture is 3 (The system.dll readme has example code for calling COM objects)

__________________
IntOp $PostCount $PostCount + 1

Quick Link | Report this post to a moderator | IP: Logged

Anders is offline Old Post 02-06-2009 05:21 PM
Click Here to See the Profile for Anders Click here to Send Anders a Private Message Visit Anders's homepage! Find more posts by Anders Add Anders to your buddy list Edit/Delete Message Reply w/Quote
Animaether
Major Dude

Registered: Jun 2001
From:

whhooooo... blimey. Nope, in way over my head - will give it another stab after the weekend
( getting an error 128 from the output of the 'e' option... of course finding the user-friendly message for code 128 is another circle of hell altogether )

Quick Link | Report this post to a moderator | IP: Logged

Animaether is offline Old Post 02-06-2009 07:06 PM
Click Here to See the Profile for Animaether Click here to Send Animaether a Private Message Find more posts by Animaether Add Animaether to your buddy list Edit/Delete Message Reply w/Quote
Anders
Major Dude

Registered: Jun 2002
From: N/A

128=ERROR_WAIT_NO_CHILDREN and that makes no sense, maybe you should post some of your code

__________________
IntOp $PostCount $PostCount + 1

Quick Link | Report this post to a moderator | IP: Logged

Anders is offline Old Post 02-06-2009 07:22 PM
Click Here to See the Profile for Anders Click here to Send Anders a Private Message Visit Anders's homepage! Find more posts by Anders Add Anders to your buddy list Edit/Delete Message Reply w/Quote
kichik
M.I.A.
[NSIS Dev, Mod]

Registered: Oct 2001
From: Jerusalem, Israel

You can use err.exe to get information on pretty much every error code in Windows.

__________________
NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius

Quick Link | Report this post to a moderator | IP: Logged

kichik is offline Old Post 02-06-2009 07:26 PM
Click Here to See the Profile for kichik Click here to Send kichik a Private Message Visit kichik's homepage! Find more posts by kichik Add kichik to your buddy list Edit/Delete Message Reply w/Quote
Anders
Major Dude

Registered: Jun 2002
From: N/A

quote:
Originally posted by kichik
You can use err.exe to get information on pretty much every error code in Windows.


except its 404

__________________
IntOp $PostCount $PostCount + 1

Quick Link | Report this post to a moderator | IP: Logged

Anders is offline Old Post 02-06-2009 07:37 PM
Click Here to See the Profile for Anders Click here to Send Anders a Private Message Visit Anders's homepage! Find more posts by Anders Add Anders to your buddy list Edit/Delete Message Reply w/Quote
Animaether
Major Dude

Registered: Jun 2001
From:

got off the vpn, but if I recall correctly - and yes, I know it's utterly wrong... even if I'm remembering and piecing this together right...

code:
System::Call 'oleaut32::OleLoadPicturePath("path to bmp file", , , ,g "long guid thing", *i .r0) i.r1 ? e'


which I think means...
using the System plugin's Call routine,
make a call to from oleaut32.dll's OleLoadPicturePath procedure
with the arguments...
- path or URL to the file
- null
- null
- null
- the guid
- create a new 'pointer' which will hold the result, stick the pointer in $0
- stick the result of the call itself in $1
- get any error message, stick that on the stack

====

As for that err.exe thing - sounds useful, so I googled...
http://www.microsoft.com/downloads/...;displaylang=en

( says Exchange but a MSDN blog noted that it'll do the Win32 errors as well )

Quick Link | Report this post to a moderator | IP: Logged

Animaether is offline Old Post 02-06-2009 07:43 PM
Click Here to See the Profile for Animaether Click here to Send Animaether a Private Message Find more posts by Animaether Add Animaether to your buddy list Edit/Delete Message Reply w/Quote
Anders
Major Dude

Registered: Jun 2002
From: N/A

you need the types for every param, t for text (or w for wide strings) and i for DWORD/pointers

__________________
IntOp $PostCount $PostCount + 1

Quick Link | Report this post to a moderator | IP: Logged

Anders is offline Old Post 02-06-2009 07:52 PM
Click Here to See the Profile for Anders Click here to Send Anders a Private Message Visit Anders's homepage! Find more posts by Anders Add Anders to your buddy list Edit/Delete Message Reply w/Quote
Animaether
Major Dude

Registered: Jun 2001
From:

cool, thanks - I'll review and try again monday
I guess that means I have to explicitly use 'n' for null (instead of just leaving the parameter blank) as well

Quick Link | Report this post to a moderator | IP: Logged

Animaether is offline Old Post 02-07-2009 08:41 AM
Click Here to See the Profile for Animaether Click here to Send Animaether a Private Message Find more posts by Animaether Add Animaether to your buddy list Edit/Delete Message Reply w/Quote
Anders
Major Dude

Registered: Jun 2002
From: N/A

no, you can do "i,i,i" without specifying the actual value, or "i0,i0,i0" to show intent

__________________
IntOp $PostCount $PostCount + 1

Quick Link | Report this post to a moderator | IP: Logged

Anders is offline Old Post 02-07-2009 02:21 PM
Click Here to See the Profile for Anders Click here to Send Anders a Private Message Visit Anders's homepage! Find more posts by Anders Add Anders to your buddy list Edit/Delete Message Reply w/Quote
Animaether
Major Dude

Registered: Jun 2001
From:

alright, just poking at this offline a bit more...

I *think* I've got the picture interface bit working, then...

code:
System::Call 'oleaut32::OleLoadPicturePath(w "<path>", i 0, i 0, i 0, g "{7BF80980-BF32-101A-8BBB-00AA00300CAB}", *i .r0) i .r1 ? e'

It returns a pointer/reference/thing to the interface, the result is zero (which I think means 'ok') and no error code is returned (well, also zero).

So now would come the time to get some data out of that interface. Instead of jumping straight into the deep that is the image handle, I figured I'd get the width of the bitmap first.

However, I then of course get stuck again
code:
System::Call '$0->6(i .r0) i .r1 ? e'

6 = getWidth, as far as the VTable is concerned;
http://msdn.microsoft.com/en-us/library/ms680761(VS.85).aspx
At first I thought I was supposed to just call it as '->6()' and thus have the result in $1 . That crashes, though. However, specifying an out variable (i.r3) as a parameter doesn't do much either;
code:
System::Call '$0->6(i .r3) i .r1 ? e' ; 6 = getWidth Pop $2 ; [$3][$1][$2] = [0][-2147467261][80]

Of course, that error code ($2 - 80) doesn't make sense.. again. But I might be reading err.exe's output wrong.

Anyway, I tried ::Get as well, but that got me an error DMLERRsomethingorother ..

I'll poke at it some more later -_-

Quick Link | Report this post to a moderator | IP: Logged

Animaether is offline Old Post 02-07-2009 03:01 PM
Click Here to See the Profile for Animaether Click here to Send Animaether a Private Message Find more posts by Animaether Add Animaether to your buddy list Edit/Delete Message Reply w/Quote
Anders
Major Dude

Registered: Jun 2002
From: N/A

the argument is a pointer to a OLE_XSIZE_HIMETRIC (whatever that is, lets hope its 4 bytes) so:

System::Call '$0->6(*i.r3)i.r1'

also, you can't use ?e with COM, you must check the return value, 0 = ok (in most cases, could be 1 (S_FALSE) also, negative numbers are errors, when you see them in the output from err.exe, they are the codes starting with S_ or E_ )

__________________
IntOp $PostCount $PostCount + 1

Quick Link | Report this post to a moderator | IP: Logged

Anders is offline Old Post 02-07-2009 03:09 PM
Click Here to See the Profile for Anders Click here to Send Anders a Private Message Visit Anders's homepage! Find more posts by Anders Add Anders to your buddy list Edit/Delete Message Reply w/Quote
Anders
Major Dude

Registered: Jun 2002
From: N/A

code:
Function pre nsDialogs::Create 1018 Pop $0 ${NSD_CreateBitmap} 0 0 100% 100% "" pop $9 !define IID_IPicture {7BF80980-BF32-101A-8BBB-00AA00300CAB} !define ImagePath "$PICTURES\BuddyJesus.jpg" var /GLOBAL pIPicture1 ;lets save it in a var so some other code does not overwrite it (I'm assuming you have a complicated page with lots of code) System::Call 'oleaut32::OleLoadPicturePath(w "${ImagePath}", i 0, i 0, i 0, g "${IID_IPicture}", *i .r0)i.r1' ${If} $1 == 0 StrCpy $pIPicture1 $0 ;save pointer for later, we can't release it now because the image handle needs to stay valid System::Call "$0->3(*i.r0)i.r1" ;IPicture->get_Handle ;might want to check $1 here before setting image SendMessage $9 ${STM_SETIMAGE} ${IMAGE_BITMAP} $0 ${EndIf} nsDialogs::Show ${IfThen} $pIPicture1 <> 0 ${|} System::Call "$pIPicture1->2()" ${|} ;Release FunctionEnd page custom pre


if you need to resize the actual image control to fit the image, you need to call width and height and convert from himetric to pixels, I'm sure google can help out

__________________
IntOp $PostCount $PostCount + 1

Quick Link | Report this post to a moderator | IP: Logged

Anders is offline Old Post 02-07-2009 03:26 PM
Click Here to See the Profile for Anders Click here to Send Anders a Private Message Visit Anders's homepage! Find more posts by Anders Add Anders to your buddy list Edit/Delete Message Reply w/Quote
Animaether
Major Dude

Registered: Jun 2001
From:

Thanks!

Nope - don't think I would've gotten that far on monday - maybe on wednesday. I did get to the 'oh, dur, it's not a number' point *pats self on back*. I'll be going through your changes and try to grok it.. gotta get a handle on the belly of this (powerful) beast.

Thanks again!

Quick Link | Report this post to a moderator | IP: Logged

Animaether is offline Old Post 02-08-2009 11:49 AM
Click Here to See the Profile for Animaether Click here to Send Animaether a Private Message Find more posts by Animaether Add Animaether to your buddy list Edit/Delete Message Reply w/Quote
Animaether
Major Dude

Registered: Jun 2001
From:

Alright - spent some time sunday to turn it into a header file, it's in the wiki (along with a new nsDialogs category), stuck it in the production script and voila... works beautifully - thanks again!

Quick Link | Report this post to a moderator | IP: Logged

Animaether is offline Old Post 02-09-2009 10:57 AM
Click Here to See the Profile for Animaether Click here to Send Animaether a Private Message Find more posts by Animaether Add Animaether to your buddy list Edit/Delete Message Reply w/Quote
kichik
M.I.A.
[NSIS Dev, Mod]

Registered: Oct 2001
From: Jerusalem, Israel

Thanks for creating the nsDialogs category. It was really long due. All those other examples are really useful too.

__________________
NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius

Quick Link | Report this post to a moderator | IP: Logged

kichik is offline Old Post 02-10-2009 08:36 PM
Click Here to See the Profile for kichik Click here to Send kichik a Private Message Visit kichik's homepage! Find more posts by kichik Add kichik to your buddy list Edit/Delete Message Reply w/Quote
Animaether
Major Dude

Registered: Jun 2001
From:

quote:
Originally posted by kichik
Thanks for creating the nsDialogs category. It was really long due. All those other examples are really useful too.


No problem - we've been using NSIS for our installer for several years now and I like to contribute back wherever I can.

I just added a new page with some more minor snippets and created a some topics for a few other bits, that I hope will be helpful to other (budding) nsDialogs users;
http://nsis.sourceforge.net/NsDialogs_FAQ

I don't know for sure these are FAQ items per se, but they were things that I ran into or simply wondered about while moving over to nsDialogs.

Have to move on to some file-finding bits and pieces now, though, but part of that will involve nsDialogs again - will post the result of that as well.

Quick Link | Report this post to a moderator | IP: Logged

Animaether is offline Old Post 02-14-2009 12:45 AM
Click Here to See the Profile for Animaether Click here to Send Animaether a Private Message Find more posts by Animaether Add Animaether to your buddy list Edit/Delete Message Reply w/Quote
All times are GMT. The time now is 09:46 AM. Post New Thread    Post A Reply
  Last Thread   Next Thread
WINAMP.COM | Forums : Powered by vBulletin version 2.3.9 WINAMP.COM | Forums > Developer Center > NSIS Discussion > nsDialogs, NSD_CreateBitmap, NSD_SetImage - JPEG support?
Show Printable Version
 | 
Email this Page
 | 
Subscribe to this Thread

Forum Jump:
 

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is off
vB code is ON
Smilies are ON
[IMG] code is ON