Page 1 of 1
DC_IconDefault()
Posted: Thu Mar 19, 2015 1:03 pm
by unixkd
Hi Roger
It appears that DC_IconDefault( [<nIcon>] ) only works with resource file linked to the .EXEcutable program.
My application resource file is a .DLL loaded with the DC_BitmapResourceFile( {DllLoad('PPSRES.DLL')} ). How can this be achieved.
Thanks.
Joe
Re: DC_IconDefault()
Posted: Thu Mar 19, 2015 2:25 pm
by Auge_Ohr
unixkd wrote:It appears that DC_IconDefault( [<nIcon>] ) only works with resource file linked to the .EXEcutable program.
My application resource file is a .DLL loaded with the DC_BitmapResourceFile( {DllLoad('PPSRES.DLL')} ). How can this be achieved.
have a look into Source c:\exp19\Source\Dclipx\_dcmsg.prg
Code: Select all
FUNCTION DC_IconDefault( nIcon )
STATIC snIcon := nil
LOCAL nOldIcon := snIcon
snIcon := IIF(Valtype(nIcon)='N',nIcon,snIcon )
RETURN nOldIcon
it does not "load" any Icon
Re: DC_IconDefault()
Posted: Thu Mar 19, 2015 4:14 pm
by unixkd
Thanks.
How can I set a default ICON for my application. All forms/dialogs will have this ICON.
Joe
Re: DC_IconDefault()
Posted: Thu Mar 19, 2015 7:48 pm
by rdonnay
You are looking at some old code.
I updated this a few builds back.
I don't recall which. This now accepts an XbpIcon object.
Try this:
oIcon := DC_GetBitmap( <nIconRes> )
DC_IconDefault(oIcon)
Code: Select all
FUNCTION DC_IconDefault( noIcon )
STATIC snoIcon := nil
LOCAL noOldIcon := snoIcon
snoIcon := IIF(Valtype(noIcon)$'NO',noIcon,snoIcon )
RETURN noOldIcon
Re: DC_IconDefault()
Posted: Fri Mar 20, 2015 4:35 am
by unixkd
Hi Roger
Your suggested solution did not work. I discover that the DC_GetBitmap() returns the resource ID and not a Bitmap object from the ICON id passed.
Thanks.
Joe
Re: DC_IconDefault()
Posted: Fri Mar 20, 2015 5:07 am
by rdonnay
Send me your .DLL and the resource number.
Better yet, send me a small sample of code too.
I will work on this and give you a solution.
Re: DC_IconDefault()
Posted: Fri Mar 20, 2015 11:05 pm
by unixkd
Hi Roger
I solved the problem.
it is required that one link the ICON resource to the EXE and the function will work correctly.
Thanks.
Joe
Re: DC_IconDefault()
Posted: Sat Mar 21, 2015 5:29 am
by rdonnay
it is required that one link the ICON resource to the EXE and the function will work correctly.
I knew, of course, that this would work, but I thought you were trying to use the resource from a DLL.