Page 1 of 2

Icons from resource DLL (solved)

Posted: Thu May 06, 2021 1:14 am
by Wolfgang Ciriack
Hello Roger,
is there a possibility, that eXPress uses Icons from a Ressource DLL ?
I don't succeed with that. That is what I tried:

Code: Select all

nResDll := DllLoad( "Resource.dll")
DC_BitmapResourceFile({nResDll})
DC_SetIconResource(11001, 11300)

* ICJ_LKW  = Icon with Nr. 11120
* BMP_BILD  = Bitmap

oIcon := XbpIcon():New():Create()
oIcon:Load(FVWFILE_RESFILE, ICJ_LKW, 32, 32)
@200, 100 DCPUSHBUTTONXP SIZE 80, 80 CAPTION "TEST" BITMAP oIcon ALIGN XBPALIGN_BOTTOM + XBPALIGN_HCENTER CONFIG M->oGDL:oBtnConf1
@200, 200 DCPUSHBUTTONXP SIZE 80, 80 CAPTION "TEST" BITMAP ICJ_LKW  ALIGN XBPALIGN_BOTTOM + XBPALIGN_HCENTER CONFIG M->oGDL:oBtnConf1
@200, 300 DCPUSHBUTTONXP SIZE 80, 80 CAPTION "TEST" BITMAP BMP_BILD ALIGN XBPALIGN_BOTTOM + XBPALIGN_HCENTER CONFIG M->oGDL:oBtnConf1
Button 1 and 3 are shown correct, but button 2 do not show the Icon.
Is it possibible, to force eXPress to use the icons from a resource dll, so that i do not have to recode my hole app ?

Re: Icons from resource DLL

Posted: Thu May 06, 2021 6:30 am
by rdonnay
Send me your DLL so I can try it.

Re: Icons from resource DLL

Posted: Thu May 06, 2021 6:47 am
by Wolfgang Ciriack
Have send it by mail.

Re: Icons from resource DLL

Posted: Thu May 06, 2021 8:41 am
by Wolfgang Ciriack
Can not send you the DLL file by mail, although it is in a zip file and has another extention the mail is blocked because of an potential security risk.
I will send you a link, where you can download the file later today.

Re: Icons from resource DLL

Posted: Fri May 07, 2021 6:03 am
by Wolfgang Ciriack
Hello Roger,
were you be able to download my Resource.dll from the link i send you ?

Re: Icons from resource DLL

Posted: Fri May 07, 2021 8:34 am
by rdonnay
Yes, I have your files.
Working on it now.

Re: Icons from resource DLL

Posted: Sat May 08, 2021 8:19 am
by rdonnay
I looked a lot at the code to see if there was a way that I could modify DC_GetBitmap() and DC_BitmapResourceFile() so they would allow icons from a DLL. It looks like this is not possible from a DLL handle, but instead must use the DLL name.

It will take a lot of code changes to try to mix bitmaps and icons in a DLL.
I would prefer not to do this because I run the risk of breaking some already complicated code.
Also, nobody has ever asked for this until now.

Re: Icons from resource DLL

Posted: Sat May 08, 2021 8:41 am
by Wolfgang Ciriack
Hello Roger,
Thanks for looking at it.
So one way would be to change Icons to Bitmaps ?
Or what can you recommend ?

Edit: I will change my code to all commands which uses an icon to GetIc(nr) with

Code: Select all

function GetIc(nr)
LOCAL oIcon := XbpIcon():New():Create()
   oIcon:Load(FVWFILE_RESFILE, nr)
return oIcon
That works for me.
Or is there a better solution ?

Re: Icons from resource DLL

Posted: Sun May 09, 2021 9:02 am
by rdonnay
I suggest the following:

Code: Select all

@200, 100 DCPUSHBUTTONXP SIZE 80, 80 CAPTION "TEST" BITMAP GetIcon(ICJ_LKW) ALIGN XBPALIGN_BOTTOM + XBPALIGN_HCENTER

FUNCTION GetIcon( nResource )

LOCAL oIcon := XbpIcon():new():create()
oIcon:Load(FVWFILE_RESFILE,nResource)
RETURN oIcon

Re: Icons from resource DLL

Posted: Mon May 10, 2021 10:26 pm
by Wolfgang Ciriack
Thanks Roger, this is exact my solution.
Now i have to do a lot of edit work.