DLL_EXPORT(BOOL) APIENTRY TraysPopupProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { switch (uMsg) { case WM_INITDIALOG: { BOOL bReturnValue = (BOOL)HANDLE_WM_INITDIALOG(hwnd, wParam, lParam, Cls_OnTraysInitDialog); OnActivateDialog(hwnd); return bReturnValue; } case WM_COMMAND: HANDLE_WM_COMMAND(hwnd, wParam, lParam, Cls_OnTraysCommand); break; case WM_MEASUREITEM: HANDLE_WM_MEASUREITEM(hwnd, wParam, lParam, Cls_OnTraysMeasureItem); break; case WM_DRAWITEM: HANDLE_WM_DRAWITEM(hwnd, wParam, lParam, Cls_OnTraysDrawItem); break; case WM_HELP: return (BOOL)OnF1HelpTrays(wParam, lParam); case WM_CONTEXTMENU: return (BOOL)OnContextHelpTrays(wParam, lParam); default: return FALSE; } return TRUE; }
//"Pen and brush settings" dialog procedure INT_PTR CALLBACK PBDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam ) { try { //Message switch switch(uMsg) { //Everything is done with the message cracker macros case WM_INITDIALOG: return HANDLE_WM_INITDIALOG(hwndDlg,wParam,lParam,PBSettings_OnInitDialog); case WM_COMMAND: HANDLE_WM_COMMAND(hwndDlg,wParam,lParam,PBSettings_OnCommand); return FALSE; case WM_NOTIFY: return HANDLE_WM_NOTIFY(hwndDlg,wParam,lParam,PBSettings_OnNotify); case WM_CLOSE: EndDialog(hwndDlg,IDCANCEL); return TRUE; case WM_DRAWITEM: return HANDLE_WM_DRAWITEM(hwndDlg,wParam,lParam,PBSettings_OnDrawItem); } } catch(exception &ex) //Handle exceptions { ErrMsgBox(hMainWindow,ex,_T(__FUNCSIG__),MB_ICONERROR); EndDialog(hwndDlg,IDABORT); } return FALSE; }
//-------------------------------------------------------------------- // Function: TraysProc // // Description: // // Input: hwnd - // uMsg - // wParam - // lParam - // // Modifies: // // Returns: // //-------------------------------------------------------------------- DLL_EXPORT(BOOL) APIENTRY TraysProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { BOOL *pChanged = (BOOL *)lParam; switch (uMsg) { case WM_INITDIALOG: return (BOOL)HANDLE_WM_INITDIALOG(hwnd, wParam, lParam, Cls_OnTrayInitDialog); case WM_COMMAND: HANDLE_WM_COMMAND(hwnd, wParam, lParam, Cls_OnTrayCommand); break; case WM_MEASUREITEM: HANDLE_WM_MEASUREITEM(hwnd, wParam, lParam, Cls_OnMeasureItem); break; case WM_DRAWITEM: HANDLE_WM_DRAWITEM(hwnd, wParam, lParam, Cls_OnDrawItem); break; case WM_HELP: return (BOOL)OnF1HelpTrays(wParam, lParam); case WM_CONTEXTMENU: return (BOOL)OnContextHelpTrays(wParam, lParam); #ifdef WIN32 case WM_NOTIFY: switch (((NMHDR FAR *)lParam)->code) { case PSN_HELP: WinHelp(hwnd, ECL_HELP_FILE, HELP_CONTEXT, IDH_PP_trays); break; case PSN_SETACTIVE: SetWindowLong(hwnd, DWL_MSGRESULT, FALSE); return TRUE; break; case PSN_KILLACTIVE: SetWindowLong(hwnd, DWL_MSGRESULT, FALSE); return TRUE; break; case PSN_APPLY: SaveTrayValues(hwnd); SetWindowLong(hwnd, DWL_MSGRESULT, PSNRET_NOERROR); return TRUE; break; case PSN_RESET: break; default: return FALSE; } break; #else case TSN_CANCEL: break; case TSN_ACTIVE: OnActivateDialog(hwnd); break; case TSN_INACTIVE: *pChanged = TRUE; break; case TSN_OK: case TSN_APPLY_NOW: SaveTrayValues(hwnd); *pChanged = TRUE; break; case TSN_HELP: WinHelp(hwnd, ECL_HELP_FILE, HELP_CONTEXT, IDH_PP_trays); break; #endif // WIN32 default: return FALSE; } return TRUE; }
//========================================================= // Advanced Sheet Dialog Proc DLL_EXPORT(BOOL) APIENTRY AdvancedSheetProc(HWND hwnd, UINT msg, UINT wParam, LONG lParam) { BOOL *pChanged = (BOOL *)lParam, bProcessed = FALSE; switch (msg) { #ifdef WIN32 case WM_HELP: return((BOOL)OnF1HelpAdvanced(wParam, lParam)); break; case WM_CONTEXTMENU: return((BOOL)OnContextHelpAdvanced(wParam, lParam)); break; case WM_NOTIFY: switch (((NMHDR FAR *) lParam)->code) { case PSN_KILLACTIVE: SetWindowLong(hwnd, DWL_MSGRESULT, FALSE); return(TRUE); break; case PSN_SETACTIVE: SetWindowLong(hwnd, DWL_MSGRESULT, FALSE); PostMessage(hAdvanced, WM_COMMAND, MAKEWPARAM((UINT)(IDC_SETTINGS_LIST), (UINT)(LBN_SELCHANGE)), (LPARAM)(HWND)(hSettingsListbox)); return(TRUE); break; case PSN_HELP: WinHelp(hwnd, PRINTER_HELP_FILE, HELP_CONTEXT, IDH_PP_advanced); return(TRUE); case PSN_APPLY: SaveAdvancedValues(msg, wParam, lParam); SetWindowLong(hwnd, DWL_MSGRESULT, PSNRET_NOERROR); return(TRUE); break; default: return(FALSE); } #else // TabSheet Specific Messages case TSN_INACTIVE: *pChanged = TRUE; return(TRUE); break; case TSN_ACTIVE: case TSN_CANCEL: PostMessage(hAdvanced, WM_COMMAND, IDC_SETTINGS_LIST, MAKELPARAM(hSettingsListbox, LBN_SELCHANGE)); return(TRUE); break; case TSN_OK: case TSN_APPLY_NOW: SaveAdvancedValues(msg, wParam, lParam); break; case TSN_HELP: WinHelp(hwnd, PRINTER_HELP_FILE, HELP_CONTEXT, IDH_PP_advanced); break; #endif case WM_DESTROY: HANDLE_WM_DESTROY(hwnd, wParam, lParam, Cls_OnAdvDestroy); break; case WM_COMMAND: HANDLE_WM_COMMAND( hwnd, wParam, lParam, Cls_OnAdvCommand); break; case WM_INITDIALOG: { HCURSOR hCursor = SetCursor(LoadCursor(NULL, IDC_WAIT)); bProcessed = (BOOL)HANDLE_WM_INITDIALOG( hwnd, wParam, lParam, Cls_OnAdvInitDialog); SetCursor(hCursor); } break; case WM_COMPAREITEM: return((BOOL)HANDLE_WM_COMPAREITEM(hSettingsListbox, wParam, lParam, Cls_OnCompareItem)); break; case WM_DRAWITEM: HANDLE_WM_DRAWITEM(hSettingsListbox, wParam, lParam, Cls_OnLBDrawItem); break; case WM_MEASUREITEM: HANDLE_WM_MEASUREITEM(hSettingsListbox, wParam, lParam, Cls_OnLBMeasureItem); break; } return (bProcessed); }