Icon on MDI and MDI Child

Post Reply
User avatar
Rick Lipkin
Posts: 2397
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Icon on MDI and MDI Child

Post by Rick Lipkin »

To All

I am sure there is a simple solution .. I am not seeing the 'default' icon that is 'burnt' into my executable on the MDI and MDI child windows. All I see is a 'blank' icon in the upper left corner of my application.

In the old 16 bit days .. the icon always appeared on my MDI and MDI childs .. This has not really bothered me until now :D

Just curious what I need to do to to either 'define' or 'redefine' my icon from the resource.

Thanks
Rick Lipkin
SC Dept of Health
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Rick,

For the main window you may do:

Code: Select all

   DEFINE ICON oIcon RESOURCE "test" 

   DEFINE WINDOW oWnd FROM 1, 1 TO 20, 70 TITLE "I am the MDI Frame" ;
      MDI ;
      MENU BuildMenu() ;
      ICON oIcon
and add this to your RC:

test ICON "..\icons\fivewin.ico"

and the same for the mdichilds:

Code: Select all

   DEFINE ICON oIcon RESOURCE "test"

   DEFINE WINDOW oWndChild MDICHILD OF oWnd ICON oIcon
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Rick Lipkin
Posts: 2397
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Post by Rick Lipkin »

Antonio

All my icons are in a file called icons.rc which gets compiled to icons.res. I chose Icons.res to link into my executable.

I was hoping to use the icon resource from the executable ( since it is already burnt in ) ant not add it ( as well ) to my external .dll.

Is it possible to "grab" the icon from the executable ?? or would it be best to also import it into my external .dll and redefine it from there ??

Thanks
Rick Lipkin
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Rick,

You may use them from the EXE, but first you must do a SET RESOURCES TO. So the EXE becomes the place to look for resources.

SET RESOURCES TO
DEFINE ICON ...
SET RESOURCES TO <yourdll.dll>

After defining them, then do a SET RESOURCES TO <yourdll.dll> to set your resources to the DLL.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Rick Lipkin
Posts: 2397
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Post by Rick Lipkin »

Antonio

I like the other idea better ... I will import the icons into my external .dll and burn them into the Executable as well because i am already setting the resources to that file anyway ..

I have been playing with the mdi childs and surprisingly some of the mdichilds seem to inherit the icon from the parent without defining the icon in the child .. wierd. It does not happen all the time and where I define the icon .. I use a Local variable object so it should not filter down to the other modules .. not a big deal .. just curious.

Thanks for your quick responce.

Rick Lipkin
Post Reply