LRESULT PASCAL WaveHookProc( HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam ) /*++ Routine Description: Hook procedure for wave file selection common file dialog. This hook procedure is required to provide help, put the window in the foreground, and provide a test button for listening to a wave file. Arguments: hwnd - window handle to the dialog box message - message number wParam - first message parameter lParam - second message parameter Return Value: TRUE - did not process the message FALSE - did process the message --*/ { char szWave[MAX_PATH]; if (message==WM_INITDIALOG) { SetForegroundWindow( hwnd ); } else if (message == WM_COMMAND) { switch (wParam) { case ID_TEST_WAVE: GetDlgItemText( hwnd, edt1, szWave, sizeof(szWave) ); PlaySound( szWave, NULL, SND_FILENAME ); break; case psh15: // // get the help file name // GetHelpFileName( szHelpFileName, sizeof( szHelpFileName ) ); // // call winhelp // WinHelp( hwnd, szHelpFileName, HELP_FINDER, IDH_WAVEFILE ); break; } } return FALSE; }
BOOL CALLBACK DLLExport setupProc(HWND hDlg,uint msgType,WPARAM wParam,LPARAM lParam) { setupParams _far * spa; EDITDATA _far * edPtr; switch (msgType) { case WM_INITDIALOG: // Init dialog SetWindowLong(hDlg, DWL_USER, lParam); spa = (setupParams far *)lParam; edPtr = spa->edpt; return TRUE; case WM_COMMAND: // Command spa = (setupParams far *)GetWindowLong(hDlg, DWL_USER); edPtr = spa->edpt; switch (wmCommandID) { case IDOK: // Close the dialog EndDialog(hDlg, IDOK); return 0; case IDCANCEL: // User pressed cancel, don't save anything // Close the dialog EndDialog(hDlg, IDCANCEL); return 0; case ID_HELP: { // Call the mvHelp function // spa->kv->mvHelp(GetHelpFileName(), 0 /*HH_DISPLAY_TOPIC*/, NULL /*(LPARAM)"index.html"*/); } return 0; default: break; } break; default: break; } return FALSE; }
LRESULT PASCAL BrowseHookProc( HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam ) /*++ Routine Description: Hook procedure for directory browse common file dialog. This hook procedure is required to provide help, put the window in the foreground, and set the edit so that the common file dialog dll thinks the user entered a value. Arguments: hwnd - window handle to the dialog box message - message number wParam - first message parameter lParam - second message parameter Return Value: TRUE - did not process the message FALSE - did process the message --*/ { if (message==WM_INITDIALOG) { SetForegroundWindow( hwnd ); } else if (message==WM_PAINT) { SetDlgItemText( hwnd, edt1, "drwatson.log" ); } else if (message==WM_COMMAND && wParam==psh15) { // // get the help file name // GetHelpFileName( szHelpFileName, sizeof( szHelpFileName ) ); // // call winhelp // WinHelp( hwnd, szHelpFileName, HELP_FINDER, IDH_LOGFILELOCATION ); } return FALSE; }
BOOL PrepareDataForCommonUi( PUIDATA pUiData, PCOMPROPSHEETUIHEADER pComPropSheetUIHdr, PDLGPAGE pDlgPage, PACKPROPITEMPROC pPackItemProc ) /*++ Routine Description: Allocate memory and partially fill out the data structures required to call common UI routine. Arguments: pUiData - Pointer to our UIDATA structure pComPropSheetUIHdr - Pointer to COMPROPSHEETUIHEADER structure pDlgPage - Pointer to dialog pages pPackItemProc - Callback function to fill out OPTITEM and OPTTYPE array Return Value: TRUE if successful, FALSE otherwise --*/ { PCOMPROPSHEETUI pComPropSheetUI; PFORM_INFO_1 pFormsDB; PACKINFO packInfo; DWORD cForms; DWORD count; HANDLE hheap = pUiData->hheap; // // Get a list of forms in the forms database // pFormsDB = GetFormsDatabase(pUiData->hPrinter, &cForms); if (pFormsDB == NULL || cForms == 0) { Error(("Couldn't get system forms\n")); return FALSE; } FilterFormsDatabase(pFormsDB, cForms, pUiData->pmpd); // // Enumerate the list of supported forms // count = EnumPaperSizes(NULL, pUiData->pmpd, pFormsDB, cForms, DC_PAPERS); Assert(count != GDI_ERROR); pUiData->cFormNames = count; pUiData->pFormNames = HeapAlloc(hheap, HEAP_ZERO_MEMORY, sizeof(WCHAR)*count*CCHPAPERNAME); pUiData->pPapers = HeapAlloc(hheap, HEAP_ZERO_MEMORY, sizeof(WORD)*count); pUiData->pPaperSelections = HeapAlloc(hheap, HEAP_ZERO_MEMORY, sizeof(WORD)*count); if (!pUiData->pFormNames || !pUiData->pPapers || !pUiData->pPaperSelections) return FALSE; EnumPaperSizes(pUiData->pFormNames, pUiData->pmpd, pFormsDB, cForms, DC_PAPERNAMES); EnumPaperSizes(pUiData->pPapers, pUiData->pmpd, pFormsDB, cForms, DC_PAPERS); EnumPaperSizes(pUiData->pPaperSelections, pUiData->pmpd, pFormsDB, cForms, DC_EXTRA); MemFree(pFormsDB); // // Allocate memory to hold COMPROPSHEETUI data structures and initialize it // if (! (pComPropSheetUI = HeapAlloc(hheap, HEAP_ZERO_MEMORY, sizeof(COMPROPSHEETUI)))) return FALSE; pComPropSheetUIHdr->pData = pComPropSheetUI; pComPropSheetUI->cbSize = sizeof(COMPROPSHEETUI); pComPropSheetUI->UserData = (DWORD) pUiData; pComPropSheetUI->pDlgPage = pDlgPage; pComPropSheetUI->cDlgPage = 0; pComPropSheetUI->hInstCaller = ghInstance; pComPropSheetUI->pCallerName = (PWSTR) IDS_PCLXL_DRIVER; pComPropSheetUI->pOptItemName = pUiData->pDriverName; pComPropSheetUI->CallerVersion = DRIVER_VERSION; pComPropSheetUI->OptItemVersion = 0; pComPropSheetUI->IconID = IDI_CPSUI_PRINTER2; if (HasPermission(pUiData)) pComPropSheetUI->Flags = CPSUIF_UPDATE_PERMISSION; if (! (pComPropSheetUI->pHelpFile = GetHelpFileName(pUiData->hPrinter, hheap))) { Error(("Couldn't find help file\n")); } // // Count the number of treeview items // memset(&packInfo, 0, sizeof(packInfo)); packInfo.pUiData = pUiData; if (! pPackItemProc(&packInfo)) { Error(("Counting treeview items failed\n")); return FALSE; } // // Allocate memory to hold OPTITEM's and OPTTYPE's // Assert(packInfo.cOptItem > 0 && packInfo.cOptType > 0); packInfo.pOptItem = HeapAlloc(hheap, HEAP_ZERO_MEMORY, sizeof(OPTITEM)*packInfo.cOptItem); packInfo.pOptType = HeapAlloc(hheap, HEAP_ZERO_MEMORY, sizeof(OPTTYPE)*packInfo.cOptType); if (!packInfo.pOptItem || !packInfo.pOptType) return FALSE; // // Pack the document or printer properties information into treeview items // packInfo.cOptItem = packInfo.cOptType = 0; pComPropSheetUI->pOptItem = packInfo.pOptItem; if (! pPackItemProc(&packInfo)) { Error(("Packing treeview items failed\n")); return FALSE; } pComPropSheetUI->cOptItem = packInfo.cOptItem; return TRUE; }
void CSetupDialog::OnHelp() { m_mV->mvHelp(GetHelpFileName(), 0 /*HH_DISPLAY_TOPIC*/, NULL /*(LPARAM)"index.html"*/); }
void MenuInstanceData::DisplayHelp() const { const string filename = GetHelpFileName(this); if (!printfile(filename, true)) { GenerateMenu(); } }