Manually inserting a button in .rc file for sdk

Manually inserting a button in .rc file for sdk

giuseppetonello
Advocate Advocate
1,265 Views
4 Replies
Message 1 of 5

Manually inserting a button in .rc file for sdk

giuseppetonello
Advocate
Advocate

In Visual Studio 2012 Express there's no possibility of editing visually the .rc file.

I'm just trying to add a button to the utility wizard.

I think I have to add something to the lines of the dialog in the .rc file, other than that I have no clue on how to do it.

Joey
0 Likes
Accepted solutions (1)
1,266 Views
4 Replies
Replies (4)
Message 2 of 5

istan
Advisor
Advisor

check resedit.net

Message 3 of 5

giuseppetonello
Advocate
Advocate
So, I've tried to draw in another resource editor
and what I've got is a line like that
PUSHBUTTON "Button1",IDC_BUTTON1,19,42,68,17

Then, in the resource.h file, I've added
#define IDC_BUTTON1 1003
(no idead how that 1003 ID is generated)

At this point I was expecting the button to appear. Instead, it compiles fine, but no button is showed.
Joey
0 Likes
Message 4 of 5

kevinvandecar
Community Manager
Community Manager
Accepted solution

Hi Joey,

 

Yes, it's easier to use a resource editor for the layout, etc. however, make sure you are using one that shows the entire panel. The button positions need to be relative to the panel so that the button is positioned correctly. You can review the .rc file in the code editor to see if the position and size values are relative to the panel itself.

 

Also, make sure that the resource ID and it's name does not conflict with another control. Those integer values are generated by the resource editor (in VS anyway), and it will ensure no duplicates. However, when manually editing files, you need to make sure the ID is not duplicated. If it is the same as another resource value, then just bump it up and rebuild-all. If the IDC_BUTTON1 name is also duplicated, you probably will get a compiler error, but just to point out it should also be unique.

 

You might also review the samples in the SDK and copy those definitions into your project if you want to work manually with the code in the .RC/resource.h. In some cases (ie. a spinner/edit combo) you should copy an existing one anyway, as they are considered "custom" controls.

 

Note that I also read recently that Microsoft now has a free "Community" edition. it was not clear for me if this replaces the "Express" version, but it says it includes the resource editor now. It is probably based on VS2015 (and using VC++ 14), so it cannot be directly used with 3ds Max requiring VS 2012 (VC++ 11). However, you might be able to use the newer VS IDE (and resource editor) in a side-by-side install. You will need to use the "toolset" option in the project settings to ensure it is compiling against VC++11 toolset and compiler (I am not sure if this idea is supported in the free versions, but might be something to checkout).

 

Hope it helps,

kevin

 

 

 

 

 


Kevin Vandecar
Developer Technical Services
Autodesk Developer Network



Message 5 of 5

giuseppetonello
Advocate
Advocate
I've actually used vs2015 to do the resource editing and then copied the code back to vs2012. It works.
Joey
0 Likes