jonny_mac_99
January 16th, 2008, 06:58 AM
Im trying to create a button using the windows defined BUTTON class. However, once the button is created I cannot find the WndProc where I detect the WM_COMMAND message which has the notification code of BN_CLICKED.
I was of the understanding that it goes in the Proc of the parent window which in this case is a Dialog. Therfore I have placed the BN_CLICKED within the WM_COMMAND case of the DlgProc.
code for creating button:
m_hWnd = CreateWindow( L"BUTTON",
L"GUI Button",
WS_VISIBLE | WS_CHILD | BS_PUSHBUTTON | BS_BITMAP,
m_xPos, m_yPos,
24, 24,
m_hParentHWND,
NULL,
m_hInst,
NULL );
hr = GetLastError();
m_hImage = LoadImage( m_hInst, m_bitmap, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE );
SendMessage( m_hWnd, BM_SETIMAGE, IMAGE_BITMAP, (LPARAM)m_hImage );
I've also trued creating my own WNDCLASSEX and registering it using Register class. The class is registered fine but then when I call CreateWindow its says it cannot find the window class????
Anyone any ideas?
I was of the understanding that it goes in the Proc of the parent window which in this case is a Dialog. Therfore I have placed the BN_CLICKED within the WM_COMMAND case of the DlgProc.
code for creating button:
m_hWnd = CreateWindow( L"BUTTON",
L"GUI Button",
WS_VISIBLE | WS_CHILD | BS_PUSHBUTTON | BS_BITMAP,
m_xPos, m_yPos,
24, 24,
m_hParentHWND,
NULL,
m_hInst,
NULL );
hr = GetLastError();
m_hImage = LoadImage( m_hInst, m_bitmap, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE );
SendMessage( m_hWnd, BM_SETIMAGE, IMAGE_BITMAP, (LPARAM)m_hImage );
I've also trued creating my own WNDCLASSEX and registering it using Register class. The class is registered fine but then when I call CreateWindow its says it cannot find the window class????
Anyone any ideas?