How to find out the numbers in resource headers (#define IDD_BLOAH [number])

Started by
6 comments, last by Subotron 21 years, 3 months ago
This is my first time messing with resource files. I created an .rc file and inserted several things. A menu with 1 item, an icon and a dialogbar. I created a resource header file, and got the first two items working like this: #define IDR_MENU 101 #define IDI_MAIN_ICON 102 #define IDD_TOOLBAR 133 #define IDM_EXIT 40001 (IDM_EXIT is the menu item) Everything worx except the toolbar, which is a dialogbar. I have no idea what number to give it to make it work (I think that''s what''s wrong) I found out the other 3 numbers by looking at other applications and trying out A LOT... I want to know, how do I know which number to give in such a define? I think there should also be a way to auto-generate this header file but it doesn''t because I include these numbers in another header file (I have 3 files, window.cpp, window.h and window.rc. Window.h is the header for both files) The 133 number doesn''t work here, neither does 135 (I got these from another app that uses a dialogbar) Please help me on figuring out how these numbers work! Else I''ll get this problem a lot of times in the future...
Advertisement
the numbers don''t really matter, as long as they''re > 0 and unique and don''t conflict with any of the ids for "standard" controls like IDOK and IDCANCEL. and i *think* that they also have to be less than 65535 (i *think* that''s the upper limit).

what IDE are you using?
I''m not sure

I found out 103 works, but others don''t... I really can''t figure out which number to use when... which are the taken numbers? When I tried 103 before for some icon or so it didn''t work either, but now it does for the dialogbar... I really don''t understand this
you don''t know what tool(s) your using to code in? lets try this. are you using VC++?
lol oh sorry wasn''t paying attention I think yes VC++
If you''re using VC++, then the Resource Editor will assign the numbers for you automatically (and will create the resource.h file, as well).

As anonymous said, the numbers don''t matter as long as they''re unique. I would suspect a problem in your code rather than the number chosen for a resource id.
with the VC++ IDE, if you have added the .rc to your project, you can use the menu option View->Resource Symbols to get a list of the resource ids currently defined and where they''re used in your code. if you have not done so, you should add both the .rc and the resource.h files to your project. you indicate that you created the resource header file, so maybe this is part of the problem. normally that file is created/maintained for you by the IDE, once you''ve created your first resource and attempted to save it.
k I''ll re-create the project then so it makes a seperate header... because not every number seems to work and it''s not a code-fault since I just changed the number with the dialogbox and after some number trying it worked...

Thanks for the comments!

This topic is closed to new replies.

Advertisement