Including and icon to your executable file?
I no this is on the basic side but i am just learning the basics so it kindsa figures!
how do you attatch a chosen icon to your executable file?
Thankz for all your help and revious help!
-----------------------
This space is for sale
-----------------------
-----------------------This space is for sale-----------------------
I can''t remember how I did it, but I have a resource file resource.h, defined as follows
//resource.h-- Used by myresources.rc
#define ICON_MAIN 1000
And a resource file, defined like so
#include "resource.h"
ICON_MAIN ICON "myIcon.ico"
Then I add both the files in my project, and #include "resource.h" in my main file.
I also add myIcon.ico to the project.
With those things added to the project, it just assigns the icon to the executable. I did the code a while ago, so I''m not sure if I use some command to assign it, but I couldn''t find one...
Hope that might help...
//resource.h-- Used by myresources.rc
#define ICON_MAIN 1000
And a resource file, defined like so
#include "resource.h"
ICON_MAIN ICON "myIcon.ico"
Then I add both the files in my project, and #include "resource.h" in my main file.
I also add myIcon.ico to the project.
With those things added to the project, it just assigns the icon to the executable. I did the code a while ago, so I''m not sure if I use some command to assign it, but I couldn''t find one...
Hope that might help...
There''s no command, your code is correct, the first icon in the resource file is the default icon for your executable file. There are commands so that the icon also appears in your window though.
And you don''t even need to include the icon in the project, it just has to be in the same path as the resource file
And you don''t even need to include the icon in the project, it just has to be in the same path as the resource file

--New feature - Windows users, press ALT-F4 to launch the IQ test.
Is it possible to have 2 icons in the project, and select one for the executable? (Or does it just have to be the first one defined?)
Of course, just add entries to the registry and the define. The first one will be the default icon, the others will be selectable when you make a shortcut to the program and go to its properties... And you''ll be able to use them as other things in the prog too of course.
I''m not sure the first one will always be the default one though, windows may choose the first one that has an entry best matching the bpp and icon size set...
--
New feature - Windows users, press ALT-F4 to launch the IQ test.
I''m not sure the first one will always be the default one though, windows may choose the first one that has an entry best matching the bpp and icon size set...
--
New feature - Windows users, press ALT-F4 to launch the IQ test.
--New feature - Windows users, press ALT-F4 to launch the IQ test.
December 12, 2001 01:58 PM
I have a related problem. I store some texture bitmaps in such a resource, but when I make a texture of it, the RGB components get mixed up, so instead of RGB I get RBG. The alignment also becomes a bit off. Any ideas? Here''s how I do it:
HRSRC rsrc = FindResource(HInstance,MAKEINTRESOURCE(1000),RT_BITMAP);
HGLOBAL MemoryHandle = LoadResource(HInstance, rsrc);
BYTE *img = (BYTE *)LockResource(MemoryHandle)+39;
GLuint texture = 0;
glBindTexture(GL_TEXTURE_2D, texture);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
glTexImage2D(GL_TEXTURE_2D, 0, 3, 256, 256, 0, GL_RGB, GL_UNSIGNED_BYTE, img);
HRSRC rsrc = FindResource(HInstance,MAKEINTRESOURCE(1000),RT_BITMAP);
HGLOBAL MemoryHandle = LoadResource(HInstance, rsrc);
BYTE *img = (BYTE *)LockResource(MemoryHandle)+39;
GLuint texture = 0;
glBindTexture(GL_TEXTURE_2D, texture);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
glTexImage2D(GL_TEXTURE_2D, 0, 3, 256, 256, 0, GL_RGB, GL_UNSIGNED_BYTE, img);
bitmaps are usually stored in BGR instead of RGB format
eventually you should check if your card supports the GL_EXT_bgra extension and use GL_BGR_EXT instead of GL_RGB.
if your card doesn''t support this extension you have to manually swap the B and R bytes in your texturearray.
kind regards,
rené
eventually you should check if your card supports the GL_EXT_bgra extension and use GL_BGR_EXT instead of GL_RGB.
if your card doesn''t support this extension you have to manually swap the B and R bytes in your texturearray.
kind regards,
rené
forgot to add that internally each line in a bitmap resource (or file) is padded.
have a look at www.wotsit.org and see how padding is done (easy enough to understand).
just bypassing the headerinformation won''t do any good.
hope this helps.
kind regards,
rené
have a look at www.wotsit.org and see how padding is done (easy enough to understand).
just bypassing the headerinformation won''t do any good.
hope this helps.
kind regards,
rené
forgot to add that internally each line in a bitmap resource (or file) is padded.
have a look at www.wotsit.org and see how padding is done (easy enough to understand).
just bypassing the headerinformation won''t do any good.
hope this helps.
kind regards,
rené
have a look at www.wotsit.org and see how padding is done (easy enough to understand).
just bypassing the headerinformation won''t do any good.
hope this helps.
kind regards,
rené
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement