Search code examples
visual-c++resource-id

resource IDs in VC++


I define resource IDs as below: #define _RESOURCE_ID 150 #define IDR_OPBUTTON _RESOURCE_ID + 10

When I use below code to change the text of button, it doesn't work: SetDlgItemText(hWnd, IDR_OPBUTTON, _T("-"));
But if I give it a number directly, it does work: #define IDR_OPBUTTON 160

Can anybody tell me why? Thanks in advance!
Also, I tried function GetDlgItemInt for a textbox, it has the same behavior.


Solution

  • Did you try to put parenthesis?

    #define IDR_OPBUTTON (_RESOURCE_ID + 10)