PDA

View Full Version : using our own icons



sandyrepope
30-07-2007, 01:06
How can I have my script use my icon?

I mean, line at the top of the dialog. I'd like to show my icon there before the text title.

Thanks
Sandy

Petr Schreiber
30-07-2007, 08:25
Hi Sandy,

here I think you must use API. But it is pretty easy !

First declare function to load images:


%WM_SETICON = &H080
%ICON_SMALL = 0
%ICON_BIG = 1
%IMAGE_ICON = 1
%LR_LOADFROMFILE = &H0010
DECLARE FUNCTION LoadImage LIB "USER32.DLL" ALIAS "LoadImageA" (BYVAL hInst AS DWORD, lpsz AS ASCIIZ, BYVAL uType AS DWORD, BYVAL cxDesired AS LONG, BYVAL cyDesired AS LONG, BYVAL fuLoad AS DWORD) AS DWORD


... then just before DIALOG SHOW:


DIALOG SEND hDlg, %WM_SETICON, %ICON_SMALL, LoadImage(%NULL, app_sourcepath+"icon.ico", %IMAGE_ICON, 0, 0, %LR_LOADFROMFILE)
DIALOG SEND hDlg, %WM_SETICON, %ICON_BIG, LoadImage(%NULL, app_sourcepath+"icon.ico", %IMAGE_ICON, 0, 0, %LR_LOADFROMFILE)


Of course your icon can have different name than "icon.ico" :)


Bye,
Petr

ErosOlmi
30-07-2007, 09:06
Maybe worth to add as native command.
Thanks Petr.

sandyrepope
30-07-2007, 23:27
Petr, Thank you for the code. I don't really understand it yet but it works. I guess I need to learn more about icons, both big and small.

Thanks
Sandy

Petr Schreiber
31-07-2007, 09:13
Hi Sandy,

I'm sorry for being brief. Usable source to study Win32 is Microsoft Developer Network (http://www.msdn.com)

When you enter "WM_SETICON" in search box and hit enter you will get lot of answers, but the first is enough in this case.
It says:


An application sends the WM_SETICON message to associate a new large or small icon with a window. The system displays the large icon in the ALT+TAB dialog box, and the small icon in the window caption.


Hope it helps,
Petr

sandyrepope
31-07-2007, 15:44
Petr, Thanks for the link. That is a very good link to have when trying to learn and I can already tell that I'll be reading a lot. There is a lot to learn so it will take me a while.

Thanks again,
Sandy

ErosOlmi
07-10-2007, 00:29
Almost forgot about this. New preview will have:

DIALOG SET ICON hDlg, IconFileName

Ciao
Eros

Randall
07-10-2007, 01:12
Almost forgot about this. New preview will have: DIALOG SET ICON hDlg, IconFileName

Yea !

Do you guys ever sleep? ;)