本文整理汇总了C++中GET_WM_COMMAND_ID函数的典型用法代码示例。如果您正苦于以下问题:C++ GET_WM_COMMAND_ID函数的具体用法?C++ GET_WM_COMMAND_ID怎么用?C++ GET_WM_COMMAND_ID使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GET_WM_COMMAND_ID函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: switch
/*static*/
INT_PTR CALLBACK Win32PopupDialog::Callback(HWND dialog, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{
case WM_INITDIALOG:
{
Win32PopupDialog* popupDialog = popups[GetCurrentThreadId()];
HWND parentWindow = (popupDialog == NULL ? NULL : popupDialog->windowHandle);
if (parentWindow == NULL)
{
parentWindow = GetDesktopWindow();
}
RECT parentRect, dialogRect;
GetWindowRect(parentWindow, &parentRect);
GetWindowRect(dialog, &dialogRect);
int x = parentRect.left + (parentRect.right - parentRect.left) / 2;
int y = parentRect.top + (parentRect.bottom - parentRect.top) / 2;
x -= (dialogRect.right - dialogRect.left) / 2;
y -= (dialogRect.bottom - dialogRect.top) / 2;
SetWindowPos(dialog, HWND_TOP, x, y, 0, 0, SWP_NOSIZE);
if (popupDialog->showInputText)
{
if (GetDlgCtrlID((HWND) wParam) != ID_INPUT_FIELD)
{
HWND inputText = GetDlgItem(dialog, ID_INPUT_FIELD);
SetFocus(inputText);
SendMessage(inputText, EM_SETSEL,
0, popupDialog->inputText.length());
return FALSE;
}
}
return TRUE;
}
case WM_COMMAND:
if(GET_WM_COMMAND_ID(wParam, lParam) == IDOK)
{
Win32PopupDialog::HandleOKClick(dialog);
EndDialog(dialog, 0);
}
else if(GET_WM_COMMAND_ID(wParam, lParam) == IDCANCEL)
{
EndDialog(dialog, 0);
}
break;
}
return FALSE;
}
示例2: switch
/*static*/
INT_PTR CALLBACK Win32PopupDialog::Callback(HWND hDlg, UINT iMsg, WPARAM wParam, LPARAM lParam)
{
switch (iMsg)
{
case WM_INITDIALOG:
{
Win32PopupDialog* popupDialog = popups[GetCurrentThreadId()];
HWND hwndOwner = (popupDialog == NULL ? NULL : popupDialog->windowHandle);
if (hwndOwner == NULL)
{
hwndOwner = GetDesktopWindow();
}
RECT rcOwner;
RECT rcDlg;
RECT rc;
GetWindowRect(hwndOwner, &rcOwner);
GetWindowRect(hDlg, &rcDlg);
CopyRect(&rc, &rcOwner);
// Offset the owner and dialog box rectangles so that right and bottom
// values represent the width and height, and then offset the owner again
// to discard space taken up by the dialog box.
OffsetRect(&rcDlg, -rcDlg.left, -rcDlg.top);
OffsetRect(&rc, -rc.left, -rc.top);
OffsetRect(&rc, -rcDlg.right, -rcDlg.bottom);
SetWindowPos(hDlg,
HWND_TOP,
rcOwner.left + (rc.right / 2),
rcOwner.top + (rc.bottom / 2),
0, 0, // Ignores size arguments.
SWP_NOSIZE);
return TRUE;
}
case WM_COMMAND:
if(GET_WM_COMMAND_ID(wParam, lParam) == IDOK)
{
Win32PopupDialog::HandleOKClick(hDlg);
EndDialog(hDlg, 0);
}
else if(GET_WM_COMMAND_ID(wParam, lParam) == IDCANCEL)
{
EndDialog(hDlg, 0);
}
break;
}
return FALSE;
}
示例3: About
//---------------------------------------------------------------------------
// About
//
// About dialog proc
//
// RETURNS: Per Windows convention...
//---------------------------------------------------------------------------
BOOL APIENTRY About (HWND hDlg, WORD message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{
case WM_COMMAND:
if ((GET_WM_COMMAND_ID (wParam, lParam) == IDOK) ||
(GET_WM_COMMAND_ID (wParam, lParam) == IDCANCEL))
{
EndDialog(hDlg, TRUE);
return (TRUE);
}
break;
}
return (FALSE);
(lParam);
}
示例4: AboutDlg
/***************************** Public Function ****************************\
*
* BOOL APIENTRY AboutDlg(hDlg, message, wParam, lParam)
* HWND hDlg;
* WORD message;
* WPARAM wParam;
* LONG lParam;
*
*
* Effects: none.
*
\***************************************************************************/
BOOL APIENTRY
AboutDlg(
HWND hDlg,
WORD message,
WPARAM wParam,
LONG lParam
)
{
UNREFERENCED_PARAMETER(lParam);
switch (message) {
case WM_INITDIALOG:
break;
case WM_COMMAND:
EndDialog(hDlg, GET_WM_COMMAND_ID(wParam, lParam));
/* idok or idcancel */
break;
default:
return FALSE;
break;
}
return(TRUE);
}
示例5: DialPassCallBackProc
static BOOL CALLBACK DialPassCallBackProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
static RASDIALPARAMS *Param;
char Tmp[RAS_NAME_LEN+25];
switch (message)
{
case WM_INITDIALOG :
Param = (RASDIALPARAMS *)lParam;
sprintf(Tmp, MSGJPN238, Param->szEntryName);
SendMessage(hDlg, WM_SETTEXT, 0, (LPARAM)Tmp);
SendDlgItemMessage(hDlg, RASPASS_USER, EM_LIMITTEXT, UNLEN, 0);
SendDlgItemMessage(hDlg, RASPASS_PASS, EM_LIMITTEXT, PWLEN, 0);
SendDlgItemMessage(hDlg, RASPASS_USER, WM_SETTEXT, 0, (LPARAM)Param->szUserName);
SendDlgItemMessage(hDlg, RASPASS_PASS, WM_SETTEXT, 0, (LPARAM)Param->szPassword);
return(TRUE);
case WM_COMMAND :
switch(GET_WM_COMMAND_ID(wParam, lParam))
{
case IDOK :
SendDlgItemMessage(hDlg, RASPASS_USER, WM_GETTEXT, UNLEN+1, (LPARAM)Param->szUserName);
SendDlgItemMessage(hDlg, RASPASS_PASS, WM_GETTEXT, PWLEN+1, (LPARAM)Param->szPassword);
EndDialog(hDlg, YES);
break;
case IDCANCEL :
EndDialog(hDlg, NO);
break;
}
return(TRUE);
}
return(FALSE);
}
示例6: ChessPromotionDialogProc
BOOL CALLBACK ChessPromotionDialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
UserDidSomething();
switch (message)
{
case WM_INITDIALOG:
CheckDlgButton(hDlg, IDC_QUEEN, TRUE);
CenterWindow(hDlg, GetParent(hDlg));
hPromoteDlg = hDlg;
return TRUE;
case WM_COMMAND:
switch (GET_WM_COMMAND_ID(wParam, lParam))
{
case IDOK:
case IDCANCEL:
if (IsDlgButtonChecked(hDlg, IDC_KNIGHT))
EndDialog(hDlg, KNIGHT);
else if (IsDlgButtonChecked(hDlg, IDC_BISHOP))
EndDialog(hDlg, BISHOP);
else if (IsDlgButtonChecked(hDlg, IDC_ROOK))
EndDialog(hDlg, ROOK);
else EndDialog(hDlg, QUEEN);
return TRUE;
}
break;
case WM_DESTROY:
hPromoteDlg = NULL;
break;
}
return FALSE;
}
示例7: windows_systemcommand_routine
long windows_systemcommand_routine ( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam )
{
LRESULT
lRc;
switch ( GET_WM_COMMAND_ID ( wParam, lParam ) )
{
case SC_SCREENSAVE:
{
return ( 0 );
break;
}
default:
{
lRc = DefWindowProc ( application_window, message, wParam, lParam );
break;
}
}
return ( lRc );
}
示例8: DispCommand
LRESULT DispCommand(LPCMDI lpcmdi,
HWND hwnd,
WPARAM wparam,
LPARAM lparam)
{
WORD wCommand = GET_WM_COMMAND_ID(wparam, lparam);
int icmd = 0;
CMD *rgcmd = lpcmdi->rgcmd;
int ccmd = lpcmdi->ccmd;
// Message packing of wparam and lparam have changed for Win32,
// so use the GET_WM_COMMAND macro to unpack the commnad
for (icmd = 0; icmd < ccmd; icmd++)
{
if (rgcmd[icmd].wCommand == wCommand)
{
return rgcmd[icmd].pfncmd(hwnd,
wCommand,
GET_WM_COMMAND_CMD(wparam, lparam),
GET_WM_COMMAND_HWND(wparam, lparam));
}
}
return DispDefault(lpcmdi->edwp, hwnd, WM_COMMAND, wparam, lparam);
}
示例9: DefWindowProc
LRESULT CALLBACK CTSFMainWnd::_WndProc( HWND hWnd,
UINT uMessage,
WPARAM wParam,
LPARAM lParam)
{
CTSFMainWnd *pThis = (CTSFMainWnd*)GetWindowLongPtr(hWnd, THIS_POINTER_OFFSET);
if((NULL == pThis) && (uMessage != WM_NCCREATE))
{
return DefWindowProc(hWnd, uMessage, wParam, lParam);
}
switch (uMessage)
{
case WM_NCCREATE:
{
LPCREATESTRUCT lpcs = (LPCREATESTRUCT)lParam;
pThis = (CTSFMainWnd*)(lpcs->lpCreateParams);
SetWindowLongPtr(hWnd, THIS_POINTER_OFFSET, (LONG_PTR)pThis);
//set the window handle
pThis->m_hWnd = hWnd;
}
break;
case WM_CREATE:
return pThis->_OnCreate();
case WM_SIZE:
return pThis->_OnSize(LOWORD(lParam), HIWORD(lParam));
case WM_DESTROY:
return pThis->_OnDestroy();
case WM_SETFOCUS:
return pThis->_OnSetFocus();
case WM_KILLFOCUS:
return pThis->_OnKillFocus();
case WM_ACTIVATE:
return pThis->_OnActivate(wParam);
case WM_INITMENUPOPUP:
return pThis->_OnInitMenuPopup(wParam, lParam);
case WM_COMMAND:
return pThis->_OnCommand( GET_WM_COMMAND_ID(wParam, lParam),
GET_WM_COMMAND_CMD(wParam, lParam),
GET_WM_COMMAND_HWND(wParam, lParam));
case WM_NCDESTROY:
pThis->m_hWnd = NULL;
break;
}
return DefWindowProc(hWnd, uMessage, wParam, lParam);
}
示例10: AboutDialogProc
INT_PTR CALLBACK AboutDialogProc(HWND hDlg, UINT Msg, WPARAM wParam, LPARAM lParam)
{
switch (Msg)
{
case WM_INITDIALOG:
{
char tmp[256];
CenterWindow(hDlg);
hBrush = CreateSolidBrush(RGB(235, 233, 237));
HBITMAP hBmp = (HBITMAP)LoadImage(GetModuleHandle(NULL), MAKEINTRESOURCE(IDB_SPLASH), IMAGE_BITMAP, 0, 0, LR_SHARED);
SendMessage(GetDlgItem(hDlg, IDC_ABOUT), STM_SETIMAGE, IMAGE_BITMAP, (LPARAM)hBmp);
hFont = CreateFont(-11, 0, 0, 0, 400, 0, 0, 0, 0, 3, 2, 1, 34, TEXT("Verdana"));
hFontFX = CreateFont(-12, 0, 0, 0, 400, 0, 0, 0, 0, 3, 2, 1, 34, TEXT("Verdana"));
SetWindowFont(GetDlgItem(hDlg, IDC_TEXT1), hFont, true);
SetWindowFont(GetDlgItem(hDlg, IDC_TEXT2), hFont, true);
SetWindowFont(GetDlgItem(hDlg, IDC_TEXT3), hFont, true);
SetWindowFont(GetDlgItem(hDlg, IDC_TEXT4), hFont, true);
SetWindowFont(GetDlgItem(hDlg, IDC_SICKFX), hFontFX, true);
win_set_window_text_utf8(GetDlgItem(hDlg, IDC_BUILD), "Build time: " __DATE__" - " __TIME__"");
snprintf(tmp, WINUI_ARRAY_LENGTH(tmp), "Version: %s", MAME_VERSION);
win_set_window_text_utf8(GetDlgItem(hDlg, IDC_BUILDVER), tmp);
return true;
}
case WM_CTLCOLORDLG:
return (LRESULT) hBrush;
case WM_CTLCOLORSTATIC:
case WM_CTLCOLORBTN:
hDC = (HDC)wParam;
SetBkMode(hDC, TRANSPARENT);
SetTextColor(hDC, GetSysColor(COLOR_WINDOWTEXT));
if ((HWND)lParam == GetDlgItem(hDlg, IDC_SICKFX))
SetTextColor(hDC, RGB(63, 72, 204));
return (LRESULT) hBrush;
case WM_COMMAND:
switch (GET_WM_COMMAND_ID(wParam, lParam))
{
case IDOK:
case IDCANCEL:
DeleteObject(hFont);
DeleteObject(hFontFX);
DeleteObject(hBrush);
EndDialog(hDlg, 0);
return true;
}
break;
}
return false;
}
示例11: DialCallBackProc
static BOOL CALLBACK DialCallBackProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
static RASDIALPARAMS *Param;
static HRASCONN hRasConn;
char Tmp[RAS_NAME_LEN+25];
DWORD Sts;
switch (message)
{
case WM_INITDIALOG :
Param = (RASDIALPARAMS *)lParam;
hWndDial = hDlg;
hRasConn = NULL;
sprintf(Tmp, MSGJPN223, Param->szEntryName);
SendMessage(hDlg, WM_SETTEXT, 0, (LPARAM)Tmp);
Sts = (*m_RasDial)(NULL, NULL, Param, 0, &RasDialFunc, &hRasConn);
if(Sts != 0)
EndDialog(hDlg, NO);
return(TRUE);
case WM_COMMAND :
switch(GET_WM_COMMAND_ID(wParam, lParam))
{
case IDCANCEL :
RasHangUpWait(hRasConn);
EndDialog(hDlg, NO);
break;
}
return(TRUE);
case WM_DIAL_MSG :
if(lParam != 0)
{
/* エラー発生 */
if((*m_RasGetErrorString)((UINT)lParam, (LPTSTR)Tmp, RAS_NAME_LEN+25) != 0)
sprintf(Tmp, MSGJPN224);
RasHangUpWait(hRasConn);
MessageBox(hDlg, Tmp, MSGJPN225, MB_OK | MB_ICONSTOP);
EndDialog(hDlg, NO);
}
else if(wParam & RASCS_DONE)
{
/* 終了 */
EndDialog(hDlg, YES);
}
else
{
/* ステータス変更 */
MakeRasConnMsg(Param->szPhoneNumber, wParam, Tmp);
SendDlgItemMessage(hDlg, DIAL_STATUS, WM_SETTEXT, 0, (LPARAM)Tmp);
}
return(TRUE);
}
return(FALSE);
}
示例12: MainDlgProc
static LRESULT CALLBACK MainDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch (uMsg)
{
case WM_INITDIALOG: {
HYPCTRL hc; // can be reused for new hyperlink controls
InitHypCtrl(&hc);
hc.ulStyle = ulHover;
hc.szLink = _T("http://smorgasbordet.com/pellesc");
hc.szTooltip = _T("Visit Pelles C Website");
CreateHypCtrl(hwndDlg, &hc, 10, 10, 0, 0);
InitHypCtrl(&hc);
hc.ulStyle = ulHover;
hc.szLink = _T("mailto:[email protected]");
hc.szText = _T("[email protected]");
hc.szTooltip = _T("Send program author a mail");
CreateHypCtrl(hwndDlg, &hc, 10, 30, 0, 0);
InitHypCtrl(&hc);
hc.ulStyle = ulHover;
hc.bPlaySound = FALSE;
hc.szText = _T("Callback Test 1");
hc.cbFn = HypCtrlCallback;
hc.cbID = 1;
CreateHypCtrl(hwndDlg, &hc, 10, 50, 0, 0);
InitHypCtrl(&hc);
hc.ulStyle = ulHover;
hc.bPlaySound = FALSE;
hc.szText = _T("Callback Test 2");
hc.cbFn = HypCtrlCallback;
hc.cbID = 2;
CreateHypCtrl(hwndDlg, &hc, 10, 70, 0, 0);
return TRUE;
}
case WM_COMMAND:
switch (GET_WM_COMMAND_ID(wParam, lParam))
{
case IDOK:
EndDialog(hwndDlg, TRUE);
return TRUE;
}
break;
case WM_CLOSE:
EndDialog(hwndDlg, 0);
return TRUE;
}
return FALSE;
}
示例13: WidthProc
/******************************************************************************
* BOOL APIENTRY WidthProc(hDial, message, wParam, lParam)
*
* purpose: dialog function for Width menu function
*
* params: same as for all dialog fns.
*
* side effects: changes Box width variable
*
*****************************************************************************/
BOOL APIENTRY
WidthProc(
HWND hDial,
WORD message,
WPARAM wParam,
LONG lParam
)
{
INT i;
BOOL fOk;
UNREFERENCED_PARAMETER(lParam);
switch (message) {
default:
return FALSE;
case WM_INITDIALOG:
SetDlgItemInt(hDial, BOX_WIDTH, newWidth, FALSE);
break;
case WM_COMMAND:
switch (GET_WM_COMMAND_ID(wParam, lParam)) {
case IDOK:
fChanged = TRUE;
i = GetDlgItemInt(hDial, BOX_WIDTH, (LPBOOL)&fOk, FALSE);
if (fOk && i < wBoxLim)
newWidth = i;
else
ErrorBox(hDial, vszWidthOutOfBounds);
case IDCANCEL:
EndDialog(hDial, GET_WM_COMMAND_ID(wParam, lParam) != IDCANCEL);
break;
default:
break;
}
}
return TRUE;
}
示例14: MainWndProc
LRESULT CALLBACK MainWndProc( HWND hWnd,
UINT uMessage,
WPARAM wParam,
LPARAM lParam)
{
switch (uMessage)
{
case WM_CREATE:
break;
case WM_CLOSE:
if(IsWindow(g_hwndPropSheet))
DestroyWindow(g_hwndPropSheet);
DestroyWindow(hWnd);
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
case WM_COMMAND:
switch (GET_WM_COMMAND_ID(wParam, lParam))
{
case IDM_MODAL:
DoModalPropSheet(hWnd);
break;
case IDM_MODELESS:
g_hwndPropSheet = DoModelessPropSheet(hWnd);
break;
case IDM_WIZARD:
DoWizardPropSheet(hWnd);
break;
case IDM_EXIT:
PostMessage(hWnd, WM_CLOSE, 0, 0);
break;
case IDM_ABOUT:
DialogBox(g_hInst, MAKEINTRESOURCE(IDD_ABOUT_DIALOG), hWnd, About);
break;
}
return TRUE;
default:
break;
}
return DefWindowProc(hWnd, uMessage, wParam, lParam);
}
示例15: rawDlgProc
BOOL CALLBACK rawDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) {
DWORD c,d;
switch (uMsg) {
case WM_CLOSE:
EndDialog(hDlg,TRUE);
return 0;
case WM_INITDIALOG:
{
char *LFpsftag;
//char LFpsftag[500001];
LFpsftag = malloc(strlen(infoDlgpsftag)*3+1);
// <= includes terminating null
for (c=0, d=0; c <= strlen(infoDlgpsftag); c++, d++) {
LFpsftag[d]=infoDlgpsftag[c];
if (infoDlgpsftag[c]=='\n') {
LFpsftag[d++]='\r';
LFpsftag[d]='\r';
LFpsftag[d]='\n';
}
}
SetDlgItemText(hDlg,IDC_RAWTAG,LFpsftag);
free(LFpsftag);
break;
}
case WM_COMMAND:
switch (GET_WM_COMMAND_ID(wParam, lParam)) {
case IDOK:
GetDlgItemText(hDlg,IDC_RAWTAG,infoDlgpsftag,50000);
// remove 0x0d (in PSF a newline is 0x0a)
for (c=0,d=0; c < strlen(infoDlgpsftag); c++) {
if (infoDlgpsftag[c] != 0x0d) {
infoDlgpsftag[d]=infoDlgpsftag[c];
d++;
}
}
infoDlgpsftag[d]='\0';
case IDCANCEL:
EndDialog(hDlg,TRUE);
break;
}
default:
return 0;
}
return 1;
}