FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Setting up program icons

 
Post new topic   Reply to topic     Forum Index -> DFL
View previous topic :: View next topic  
Author Message
mitja



Joined: 18 Feb 2005
Posts: 19

PostPosted: Wed Jul 27, 2005 9:52 am    Post subject: Setting up program icons Reply with quote

I am new to DFL, so bear with me.

How do I set up large and small program icons?
Back to top
View user's profile Send private message
Chris Miller



Joined: 27 Mar 2004
Posts: 514
Location: The Internet

PostPosted: Wed Jul 27, 2005 2:16 pm    Post subject: Re: Setting up program icons Reply with quote

With your icon editor make a single icon file with 16x16 and 32x32 pixel icons, and maybe 64x64 and others. Create or add an icon resource to your resource file. Make it the first one if you also want that icon to be the exe's icon.

So I have file foo.rc with this in it:
101 ICON DISCARDABLE "foo.ico"

Use the digital mars resource compiler to turn it into a res file. Note that it seems to have problems with bitmaps. You can get it from DMC's basic utilities at http://ftp.digitalmars.com/bup.zip

To compile:
rcc -32 foo.rc

Now I have a res file to use in my DFL app. Load it up with Windows API function LoadIconA() ( http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/resources/icons/iconreference/iconfunctions/loadicon.asp ), pass it to the constructor of a new Icon, and set that icon to the Form's icon property. You'll need to import dfl.winapi.

Code:

import dfl.all, dfl.winapi;

class MyForm: Form
{
   this()
   {
      this.icon = new Icon(LoadIconA(GetModuleHandleA(null), cast(char*)cast(WORD)101));
   }
}


Resource loading should be made easier in DFL in the future. DFL should properly sort out the large and small icons.

- Chris
Back to top
View user's profile Send private message
mitja



Joined: 18 Feb 2005
Posts: 19

PostPosted: Thu Jul 28, 2005 10:20 am    Post subject: Reply with quote

Thanks! It works Very Happy
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> DFL All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group