Sign in to follow this  
password

Resource file trouble

Recommended Posts

Here again. Feels like i'm asking too much, but I have no choice when i'm following the steps completely right and some things still doesn't work even though I know i'm doing it right. I'm creating a basic window with a custom cursor and icon, there were errors in the beginning when I had this code: The .rc file
[SOURCE]
CROSSHAIR_CURSOR CURSOR crosshair.cur
COLOR_ICON ICON color.ico
[/SOURCE]
resource.h
[SOURCE]
#define CROSSHAIR_CURSOR 100
#define COLOR_ICON 200
[/SOURCE]
and then it's the windows class: winclass.hIcon = LoadIcon(hinstance, MAKEINTRESOURCE(COLOR_ICON)); winclass.hCursor = LoadCursor(hinstance, MAKEINTRESOURCE(CROSSHAIR_CURSOR)); When I try to compile the resoure file it says it doesn't find the .ico and .cur file even though they are in the same directory. That problem was solved by making a folder in c: and refer to that folder like this: the .rc file
[SOURCE]
CROSSHAIR_CURSOR CURSOR c:\icons\crosshair.cur
COLOR_ICON ICON c:\icons\color.ico
[/SOURCE]
It should work if it's in the same folder! But there are still problems, only the icon works now, the cursor just loads and doesn't show. I gave up after an hour or two it was hopeless. Now when i'm here again I used the string method instead like this: the .rc file
[SOURCE]
CROSSHAIR_CURSOR CURSOR c:\icons\crosshair.cur
COLOR_ICON ICON c:\icons\color.ico
[/SOURCE]
the windows class fields: winclass.hIcon = LoadIcon(hinstance, "COLOR_ICON"); winclass.hCursor = LoadCursor(hinstance, "CROSSHAIR_CURSOR"); This worked just fine, no errors, it showed the cursor, and the icon like it should. But I still can't have the .ico and the .cur file in the same directory, I most copy it to the icons folder in c: else it won't find the files, that's just illogical and annoying error that shouldn't exist. I want to add that microsoft visual c++ is a really bad compilator it's only useful for creating icons and cursors. It always comes with compile errors for source code that works everywhere else, on top of that it's much harder and slowers to use, it's getting on my nerves, that compilator doesn't just make any sense. Using dev c++ mostly.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this