Processing the WM_COMMAND Message

To process menu commands, add the WM_COMMAND case to your application's main window procedure. Following is the WM_COMMAND case for the Label application's window procedure.

case WM_COMMAND:

switch (LOWORD(wParam))

{

case IDM_CUT:

if (EditCopy())

EditDelete();

break;

case IDM_COPY:

EditCopy();

break;

case IDM_PASTE:

EditPaste();

break;

case IDM_DELETE:

EditDelete();

break;

case IDM_EXIT:

DestroyWindow(hwnd);

}

break;

To carry out the Copy and Cut commands, the window procedure calls the application-defined EditCopy function. For more information, see Copying Information to the Clipboard. To carry out the Paste command, the window procedure calls the application-defined EditPaste function. For more information about the EditPaste function, see Pasting Information from the Clipboard.