Win32 problem

Started by
11 comments, last by orlando2004 17 years ago
Hello allz wasnt sure where to post this so i figured here would be good! Im creating a networked piece of game software and for the life of me i cant remmber how some of the windows api works since iv been doing for directX for awhile now. i just need to know how to handel button clicked flags int he message proc. under the WM_COMMAND !
Advertisement
Have you tried looking through MSDN? It's an excellent resource for anything to do with windows development.
NextWar: The Quest for Earth available now for Windows Phone 7.
Yes but all they have is stuff to do with Dialog boxs where as i am not using them !
the same should be done i think.But the ideal is that you switch through the id of the controls and when id is pressed handle the action..


will give more details if needed.

i just cant seem to remmber how to switch for the actual control being used !
say the handle to the control that was clicked was HWND Send;


case WM_COMMAND:
switch(LOWORD(wParam)) // This switch identifies the control
{

switch(HIWORD(wParam)) // Find out what message it was
{
case BN_CLICKED: // This means that the list is about to display
MessageBox(hwnd,"Test",NULL,MB_OK);
break;
}
break;
}
break;
try this

case WM_COMMAND:
switch(LOWORD(wParam)) {
case IDM_FILE_SAVE:
break;
case IDM_FILE_CLOSE:
break;
}

where case xxx is the value of the button when created. The resouce identifier I beleive it is called. Should do what you want but have not tested it. The "Control notification message" is stored in HIGHWORK(wParam) it is specific to control and as said above i think you would put an extra case with value BN_CLICKED

MSDN http://msdn2.microsoft.com/en-us/library/ms647591.aspx
You see im not useing a resource editor! im useing Visaul C++ express edition that dosent have a resource editor!
resource editor not needed. you have the handle to the button use it instead it should be held in lparam
MSDN says WM_COMMAND's lparam for a control holds the handle to the control winodw in this case a handle to the button.
When i try using the windows handle in the case i get this error

error C2051: case expression not constant

i created the button using CreateWindowEx

This topic is closed to new replies.

Advertisement