#define BUTTON_ID as parameter in win32 c++

228 views Asked by At

We usually assign the button id by #define BUTTON_ID 1001.Is it possible to assign the id of button as parameter of function? this is my code:

    HWND createButton(HWND hWnd, HINSTANCE hInst, BUTTON_ID1) {
            return CreateWindow(L"button", L"Label",
                WS_CHILD | WS_VISIBLE | BS_DEFPUSHBUTTON,
                100, 200,
                50, 20,
                hWnd, (HMENU)BUTTON_ID1,
                hInst, NULL); 
   }

If yes, how to do that? Any help I would appreciate!

1

There are 1 answers

0
Marfin. F On BEST ANSWER

Ahh, never mind. Since the datatype is HMENU then I'll set

    HWND createButton(HWND hWnd, HINSTANCE hInst, HMENU BUTTON_ID1) {
           return button
  }

HMENU as the parameter. Sorry guys.