|
-
March 31st, 2004, 04:27 PM
#1
Visual C++ 6.0 Resource Icon ?
I'm pretty new to Visual C++, but proficient in Microsoft 'C'. When using VC++, with a Win 32 App, I am trying to import a 16x16 icon to display at the top left of the top border next to the Application Name. After I import my .ico file as a resource, it is labelled as IDI_ICON1. But, when I put IDI_ICON1 as the argument in LoadIcon(), I get 'undeclared identifier IDI_ICON1'. Any ideas on how to get VC++ to recognize my new icon?
-
March 31st, 2004, 09:43 PM
#2
Re: Visual C++ 6.0 Resource Icon ?
Originally posted by dodge55
But, when I put IDI_ICON1 as the argument in LoadIcon(), I get 'undeclared identifier IDI_ICON1'. Any ideas on how to get VC++ to recognize my new icon?
How are using IDI_ICON as an argument?
Should be:
MAKEINTRESOURCE(IDI_ICON)
-
March 31st, 2004, 10:57 PM
#3
Re:
In the standard WinAPI shell skeleton, there is a LoadIcon(NULL,IDI_APPLICATION) which puts the standard default icon next to the Application name. I thought if I defined my own icon (.ico), I could change IDI_APPLICATION to IDI_ICON1 or whatever the resource name for my icon is.
-
March 31st, 2004, 11:09 PM
#4
IDI_APPLICATION is not really a resource ID, it is name for a pre-defined icon (Default application icon).
See LoadIcon in the Platform SDK: Windows User Interface documentation for more info.
You can specify your own icon, but you need to use MAKEINTRESOURCE to create the value to be used for lpIconName, from your resource ID.
Again this is explained in the docs for LoadIcon.
LoadIcon Function
Example:
Code:
wcex.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_ICON1));
Last edited by RussG1; March 31st, 2004 at 11:18 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|