这篇教程C++ CommDlgExtendedError函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中CommDlgExtendedError函数的典型用法代码示例。如果您正苦于以下问题:C++ CommDlgExtendedError函数的具体用法?C++ CommDlgExtendedError怎么用?C++ CommDlgExtendedError使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了CommDlgExtendedError函数的27个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: MCA_color// MW-2005-05-15: Updated for new answer command restructuringbool MCA_color(MCStringRef p_title, MCColor p_initial_color, bool p_as_sheet, bool& r_chosen, MCColor& r_chosen_color){ CHOOSECOLORW chooseclr ; memset(&chooseclr, 0, sizeof(CHOOSECOLORW)); chooseclr.lStructSize = sizeof (CHOOSECOLORW); chooseclr.lpCustColors = (LPDWORD)s_colordialogcolors; Window t_parent_window; t_parent_window = MCModeGetParentWindow(); chooseclr.hwndOwner = t_parent_window != NULL ? (HWND)t_parent_window -> handle . window : NULL; chooseclr.Flags = CC_RGBINIT; chooseclr.rgbResult = RGB(p_initial_color.red >> 8, p_initial_color.green >> 8, p_initial_color.blue >> 8); bool t_success = true; if (!ChooseColorW(&chooseclr)) { DWORD err = CommDlgExtendedError(); r_chosen = false; } else { r_chosen = true; r_chosen_color.red = GetRValue(chooseclr.rgbResult); r_chosen_color.red |= r_chosen_color.red << 8; r_chosen_color.green = GetGValue(chooseclr.rgbResult); r_chosen_color.green |= r_chosen_color.green << 8; r_chosen_color.blue = GetBValue(chooseclr.rgbResult); r_chosen_color.blue |= r_chosen_color.blue << 8; } // SMR 1880 clear shift and button state waitonbutton(); return t_success;}
开发者ID:alilloyd,项目名称:livecode,代码行数:39,
示例2: wcscpy_sstd::string PlayerFileDialogServiceWin::saveFile(const std::string &title, const std::string &path) const{ std::u16string u16title; cocos2d::StringUtils::UTF8ToUTF16(title, u16title); WCHAR buff[MAX_PATH + 1] = {0}; if (path.length() > 0) { std::u16string u16filename; cocos2d::StringUtils::UTF8ToUTF16(path, u16filename); wcscpy_s(buff, (WCHAR*)u16filename.c_str()); } OPENFILENAME ofn = {0}; ofn.lStructSize = sizeof(ofn); ofn.hwndOwner = _hwnd; ofn.lpstrFilter = L"All Files (*.*)/0*.*/0"; ofn.lpstrTitle = (LPCTSTR)u16title.c_str(); ofn.Flags = OFN_DONTADDTORECENT | OFN_ENABLESIZING | OFN_PATHMUSTEXIST | OFN_HIDEREADONLY | OFN_LONGNAMES; ofn.lpstrFile = buff; ofn.nMaxFile = MAX_PATH; std::string result; if (!GetSaveFileName(&ofn)) { // user cancel dialog, GetSaveFileName() will return FALSE DWORD err = CommDlgExtendedError(); if (err) { CCLOG("PlayerFileDialogServiceWin::saveFile() - failed, title (%s), error code = %u", title.c_str(), err); } return result; } cocos2d::StringUtils::UTF16ToUTF8((char16_t*)buff, result); return result;}
开发者ID:1005491398,项目名称:Threes,代码行数:38,
示例3: ZeroMemoryvoid CPECheckSumCalcDlg::OnBnOpenDialogClicked(){ // simple open dialog to get file name OPENFILENAME openFileName; ZeroMemory(&openFileName, sizeof(openFileName)); TCHAR strFileName[MAX_PATH]; ZeroMemory(strFileName, MAX_PATH); openFileName.hwndOwner = AfxGetMainWnd()->GetSafeHwnd(); openFileName.nMaxFile = MAX_PATH; openFileName.Flags = OFN_EXPLORER; openFileName.lpstrFile = strFileName; openFileName.lpstrFilter = _T("Executable files/0*.exe;*.dll/0"); openFileName.lpstrDefExt = _T(""); openFileName.lpstrTitle = _T("Select executable file"); openFileName.lStructSize = sizeof(OPENFILENAMEA); GetOpenFileName(&openFileName); if ((int)CommDlgExtendedError() == 0) { GetDlgItem(IDC_FILEPATHEDIT)->SetWindowText(strFileName); }}
开发者ID:libprot,项目名称:trunk,代码行数:23,
示例4: DumpProcessbool DumpProcess(DWORD pid){ gMemSnap = new MemorySnapshot; char filename[1024]; OPENFILENAME ofln; memset(&filename, 0, sizeof(filename)); memset(&ofln, 0, sizeof(OPENFILENAME)); ofln.lStructSize = sizeof(OPENFILENAME); ofln.hwndOwner = gHWND; ofln.lpstrFile = filename; ofln.nMaxFile = sizeof(filename); ofln.lpstrFilter = "snap/0*.snap/0All/0*.*/0"; ofln.nFilterIndex = 1; ofln.lpstrFileTitle = NULL; ofln.nMaxFileTitle = 0; ofln.lpstrInitialDir = NULL; ofln.lpstrDefExt = ".snap"; ofln.Flags = OFN_PATHMUSTEXIST | OFN_OVERWRITEPROMPT; GetSaveFileName(&ofln); CommDlgExtendedError(); return gMemSnap->Dump(pid, filename);}
开发者ID:CoreSecurity,项目名称:Agafi,代码行数:23,
示例5: chooseprinterstatic HDC chooseprinter(void){ PRINTDLG pd; HDC dc; DWORD rc; char cwd[MAX_PATH]; GetCurrentDirectory(MAX_PATH,cwd); pd.lStructSize = sizeof( PRINTDLG ); pd.hwndOwner = NULL; pd.hDevMode = (HANDLE)NULL; pd.hDevNames = (HANDLE)NULL; pd.Flags = PD_RETURNDC | PD_NOSELECTION | PD_NOPAGENUMS | PD_USEDEVMODECOPIES; pd.nFromPage = 0; pd.nToPage = 0; pd.nMinPage = 0; pd.nMaxPage = 0; pd.nCopies = 1; pd.hInstance = (HINSTANCE)NULL; pd.lCustData = (LPARAM)0; pd.lpfnPrintHook = 0; pd.lpfnSetupHook = 0; pd.lpPrintTemplateName = (LPCSTR) 0; pd.lpSetupTemplateName = (LPCSTR) 0; pd.hPrintTemplate = (HGLOBAL)0; pd.hSetupTemplate = (HGLOBAL)0; dc = PrintDlg( &pd ) ? pd.hDC : NULL; SetCurrentDirectory(cwd); if (!dc) { rc = CommDlgExtendedError(); /* 0 means user cancelled */ if (rc) R_ShowMessage(_("Unable to choose printer")); } return dc;}
开发者ID:Bgods,项目名称:r-source,代码行数:37,
示例6: psdvoid CMyRichEditView::OnPageSetupDlg(){ CPageSetupDialog psd(PSD_INTHOUSANDTHSOFINCHES | PSD_MARGINS | PSD_ENABLEPAGEPAINTHOOK, this); // Initialize margins psd.m_psd.rtMargin.top = 1000; psd.m_psd.rtMargin.left = 1250; psd.m_psd.rtMargin.right = 1250; psd.m_psd.rtMargin.bottom = 1000; psd.m_psd.lpfnPagePaintHook = (LPPAGEPAINTHOOK)PaintHook; if(IDOK == psd.DoModal()) { // Propagate changes to the app AfxGetApp()->SelectPrinter(psd.m_psd.hDevNames, psd.m_psd.hDevMode); } else { TRACE(_T("CommDlgExtendedError returned error %d from ") _T("CPageSetupDialog::DoModal()./n"), (int)CommDlgExtendedError()); }}
开发者ID:terryjintry,项目名称:OLSource1,代码行数:24,
示例7: ExportFileVOID ExportFile(PMAIN_WND_INFO Info){ OPENFILENAME ofn; TCHAR szFileName[MAX_PATH] = _T(""); ZeroMemory(&ofn, sizeof(ofn)); ofn.lStructSize = sizeof(OPENFILENAME); ofn.hwndOwner = Info->hMainWnd; ofn.lpstrFilter = _T("Text (Tab Delimited)(*.txt)/0*.txt/0Text (Comma Delimited)(*.csv)/0*.csv/0"); ofn.lpstrFile = szFileName; ofn.nMaxFile = MAX_PATH; ofn.lpstrDefExt = _T("txt"); ofn.Flags = OFN_EXPLORER | OFN_PATHMUSTEXIST | OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT; if(GetSaveFileName(&ofn)) { if (SaveServicesToFile(Info, szFileName)) return; } if (CommDlgExtendedError() != CDERR_GENERALCODES) MessageBox(NULL, _T("Export to file failed"), NULL, 0);}
开发者ID:Nevermore2015,项目名称:reactos,代码行数:24,
示例8: CallFileRequestervoid CallFileRequester ( void ){ // Aquire HWND from core MaintainGlobalHWND(); // Create space for return filename char pFile[2048]; // Create special dialogue control OPENFILENAME ofn; memset ( &ofn, 0, sizeof(OPENFILENAME) ); ofn.lStructSize = sizeof(OPENFILENAME);// ofn.hwndOwner = hwndOriginalParent;// ofn.hInstance = (HINSTANCE) GetWindowLong(hwndOriginalParent, GWL_HINSTANCE), ofn.Flags = 0; ofn.lpstrFilter = "All Files (*.*)|*.*|Text Files (*.txt)|*.txt||"; ofn.lpstrFile = pFile; ofn.nMaxFile = sizeof(pFile); int iResult = GetOpenFileName ( &ofn ); DWORD dwErr = CommDlgExtendedError();}
开发者ID:Fliper12,项目名称:darkbasicpro,代码行数:24,
示例9: fdvoid CMixereView::LoadAudio(){ CFileDialog fd(TRUE, ".wav", NULL, OFN_ALLOWMULTISELECT | OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, CChannel::GetFileFilter()); // prepare OPENFILENAME struct for multiple select CString Buffer; const BUFSIZE = 0x7fff; LPTSTR FileBuf = Buffer.GetBufferSetLength(BUFSIZE); ZeroMemory(FileBuf, BUFSIZE); fd.m_ofn.lpstrFile = FileBuf; fd.m_ofn.nMaxFile = BUFSIZE; fd.m_ofn.nFileOffset = 0; CString Title(LDS(LOAD_AUDIO)); fd.m_ofn.lpstrTitle = Title; // display the dialog int retc = fd.DoModal(); int Pos = m_CurPos; if (retc == IDOK) { // iterate through the results CStringArray ErrPath; POSITION FilePos; FilePos = fd.GetStartPosition(); while (FilePos != NULL) { CString Path = fd.GetNextPathName(FilePos); if (!LoadAudio(Pos++, Path)) AddStringUnique(ErrPath, Path); } // if audio files couldn't be opened, display error message if (ErrPath.GetSize()) MsgBoxStrList(LDS(CANT_LOAD_AUDIO), ErrPath); } else { if (CommDlgExtendedError()) AfxMessageBox(LDS(FILE_DIALOG_ERROR)); }}
开发者ID:victimofleisure,项目名称:Mixere,代码行数:36,
示例10: strstrbool EFS_Utils::GetSaveName(LPCSTR initial, string_path& buffer, LPCSTR offset, int start_flt_ext){ // unsigned int dwVersion = GetVersion(); // unsigned int dwWindowsMajorVersion = (DWORD)(LOBYTE(LOWORD(dwVersion))); FS_Path& P = *FS.get_path(initial); string1024 flt; LPCSTR def_ext = P.m_DefExt; if (false)//&& dwWindowsMajorVersion == 6 ) { if (strstr(P.m_DefExt, "*.")) def_ext = strstr(P.m_DefExt, "*.") + 2; } MakeFilter(flt, P.m_FilterCaption ? P.m_FilterCaption : "", def_ext); OPENFILENAME ofn; Memory.mem_fill(&ofn, 0, sizeof(ofn)); if (xr_strlen(buffer)) { string_path dr; if (!(buffer[0] == '//' && buffer[1] == '//')) // if !network { _splitpath(buffer, dr, 0, 0, 0); if (0 == dr[0]) P._update(buffer, buffer); } } ofn.hwndOwner = GetForegroundWindow(); ofn.lpstrDefExt = def_ext; ofn.lpstrFile = buffer; ofn.lpstrFilter = flt; ofn.lStructSize = sizeof(ofn); ofn.nMaxFile = sizeof(buffer); ofn.nFilterIndex = start_flt_ext + 2; ofn.lpstrTitle = "Save a File"; string512 path; xr_strcpy(path, (offset&&offset[0]) ? offset : P.m_Path); ofn.lpstrInitialDir = path; ofn.Flags = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT | OFN_NOCHANGEDIR; ofn.FlagsEx = OFN_EX_NOPLACESBAR; /* if ( dwWindowsMajorVersion == 6 ) { ofn.Flags |= OFN_ENABLEHOOK; ofn.lpfnHook = OFNHookProcOldStyle; } */ bool bRes = !!GetSaveFileName(&ofn); if (!bRes) { u32 err = CommDlgExtendedError(); switch (err) { case FNERR_BUFFERTOOSMALL: Log("Too many file selected."); break; } } strlwr(buffer); return bRes;}
开发者ID:Frankie-666,项目名称:xray-16,代码行数:64,
示例11: VERIFYbool EFS_Utils::GetOpenNameInternal(LPCSTR initial, LPSTR buffer, int sz_buf, bool bMulti, LPCSTR offset, int start_flt_ext){ VERIFY(buffer && (sz_buf > 0)); FS_Path& P = *FS.get_path(initial); string1024 flt; MakeFilter(flt, P.m_FilterCaption ? P.m_FilterCaption : "", P.m_DefExt); OPENFILENAME ofn; Memory.mem_fill(&ofn, 0, sizeof(ofn)); if (xr_strlen(buffer)) { string_path dr; if (!(buffer[0] == '//' && buffer[1] == '//')) // if !network { _splitpath(buffer, dr, 0, 0, 0); if (0 == dr[0]) { string_path bb; P._update(bb, buffer); xr_strcpy(buffer, sz_buf, bb); } } } ofn.lStructSize = sizeof(OPENFILENAME); ofn.hwndOwner = GetForegroundWindow(); ofn.lpstrDefExt = P.m_DefExt; ofn.lpstrFile = buffer; ofn.nMaxFile = sz_buf; ofn.lpstrFilter = flt; ofn.nFilterIndex = start_flt_ext + 2; ofn.lpstrTitle = "Open a File"; string512 path; xr_strcpy(path, (offset&&offset[0]) ? offset : P.m_Path); ofn.lpstrInitialDir = path; ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY | OFN_FILEMUSTEXIST | OFN_NOCHANGEDIR | (bMulti ? OFN_ALLOWMULTISELECT | OFN_EXPLORER : 0); ofn.FlagsEx = OFN_EX_NOPLACESBAR; /* unsigned int dwVersion = GetVersion(); unsigned int dwWindowsMajorVersion = (DWORD)(LOBYTE(LOWORD(dwVersion))); if ( dwWindowsMajorVersion == 6 ) { ofn.Flags |= OFN_ENABLEHOOK; ofn.lpfnHook = OFNHookProcOldStyle; } */ bool bRes = !!GetOpenFileName(&ofn); if (!bRes) { u32 err = CommDlgExtendedError(); switch (err) { case FNERR_BUFFERTOOSMALL: Log("Too many files selected."); break; } } if (bRes && bMulti) { Log("buff=", buffer); int cnt = _GetItemCount(buffer, 0x0); if (cnt > 1) { char dir[255 * 255]; char buf[255 * 255]; char fns[255 * 255]; xr_strcpy(dir, buffer); xr_strcpy(fns, dir); xr_strcat(fns, "//"); xr_strcat(fns, _GetItem(buffer, 1, buf, 0x0)); for (int i = 2; i < cnt; i++) { xr_strcat(fns, ","); xr_strcat(fns, dir); xr_strcat(fns, "//"); xr_strcat(fns, _GetItem(buffer, i, buf, 0x0)); } xr_strcpy(buffer, sz_buf, fns); } } strlwr(buffer); return bRes;}
开发者ID:Frankie-666,项目名称:xray-16,代码行数:94,
示例12: WX_HOOK_MODAL_DIALOGint wxColourDialog::ShowModal(){ WX_HOOK_MODAL_DIALOG(); // initialize the struct used by Windows CHOOSECOLOR chooseColorStruct; memset(&chooseColorStruct, 0, sizeof(CHOOSECOLOR)); size_t i; // and transfer data from m_colourData to it COLORREF custColours[16]; for ( i = 0; i < WXSIZEOF(custColours); i++ ) { if ( m_colourData.GetCustomColour(i).IsOk() ) custColours[i] = wxColourToRGB(m_colourData.GetCustomColour(i)); else custColours[i] = RGB(255,255,255); } chooseColorStruct.lStructSize = sizeof(CHOOSECOLOR); if ( m_parent ) chooseColorStruct.hwndOwner = GetHwndOf(m_parent); chooseColorStruct.rgbResult = wxColourToRGB(m_colourData.GetColour()); chooseColorStruct.lpCustColors = custColours; chooseColorStruct.Flags = CC_RGBINIT | CC_ENABLEHOOK; chooseColorStruct.lCustData = (LPARAM)this; chooseColorStruct.lpfnHook = wxColourDialogHookProc; if ( m_colourData.GetChooseFull() ) chooseColorStruct.Flags |= CC_FULLOPEN; // do show the modal dialog if ( !::ChooseColor(&chooseColorStruct) ) { // 0 error means the dialog was simply cancelled, i.e. no real error // occurred const DWORD err = CommDlgExtendedError(); if ( err ) { wxLogError(_("Colour selection dialog failed with error %0lx."), err); } return wxID_CANCEL; } // transfer the values chosen by user back into m_colourData for ( i = 0; i < WXSIZEOF(custColours); i++ ) { wxRGBToColour(m_colourData.m_custColours[i], custColours[i]); } wxRGBToColour(m_colourData.GetColour(), chooseColorStruct.rgbResult); // this doesn't seem to work (contrary to what MSDN implies) on current // Windows versions: CC_FULLOPEN is never set on return if it wasn't // initially set and vice versa //m_colourData.SetChooseFull((chooseColorStruct.Flags & CC_FULLOPEN) != 0); return wxID_OK;}
开发者ID:Asmodean-,项目名称:Ishiiruka,代码行数:63,
示例13: BB_logfileData* winDirScanner::openFileDialog() { char newname[512]; newname[0] = '/0'; if ( openfD ) { delete openfD; openfD = NULL; } //XXX make this non-modal //fprintf(stderr, "fetching WIN32 file dialog/n"); BB_log( BB_LOG_INFO, "opening win32 open file dialog..." ); BB_pushlog(); ShowCursor(true); OPENFILENAME ofn; ZeroMemory(&ofn, sizeof(ofn)); ofn.lpstrFile = newname; ofn.lStructSize = sizeof(ofn); // SEE NOTE BELOW ofn.hwndOwner = NULL; ofn.lpstrFilter = m_types ? m_types : "All Files (*.*)/0*.*/0"; ofn.lpstrFile = newname; ofn.nMaxFile = MAX_PATH; ofn.Flags = OFN_EXPLORER | OFN_ALLOWMULTISELECT | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY; ofn.lpstrDefExt = "txt"; if( GetOpenFileName( &ofn ) && ofn.lpstrFile ) { // fprintf(stderr, "file - %s %s/n", ofn.lpstrFile, ofn.lpstrFileTitle ); // BB_log( BB_LOG_INFO, "file: %s %s", ofn.lpstrFile, ofn.lpstrFileTitle ); openfD = new fileData(); fileData * newFile = openfD; char * next = newname; next += strlen(next) + 1; if( *next ) { char basepath[512]; char fullpath[512]; strncpy( basepath, newname, 512 ); strcat( basepath, "//" ); do { strcpy( fullpath, basepath ); strcat( fullpath, next ); fprintf( stderr, "returned multi file %s/n", fullpath ); newFile->fileName = fullpath; next += strlen(next) + 1; if( *next ) { newFile->next = new fileData(); newFile = newFile->next; } }while ( *next ) ; } else { //no extra files, we copied the full path in already // fprintf ( stderr, "returned single file %s/n", newname ); // BB_log( BB_LOG_INFO, "got single file: %s", newname ); openfD->fileName = newname; } } else { if( CommDlgExtendedError() == 0 ) { BB_log( BB_LOG_INFO, "no file selected..." ); } else { BB_log( BB_LOG_INFO, "openfile error: %d", CommDlgExtendedError() ); } BB_poplog(); return NULL; } ShowCursor(false); BB_poplog(); return openfD;}
开发者ID:alltom,项目名称:taps,代码行数:84,
示例14: SetLastError#if 0 /* will crash with unpatched wine */ SetLastError(0xdeadbeef); res = PrintDlgA(NULL); ok( !res && (CommDlgExtendedError() == CDERR_INITIALIZATION), "returned %ld with 0x%lx and 0x%lx (expected '0' and " / "CDERR_INITIALIZATION)/n", res, GetLastError(), CommDlgExtendedError()); }#endif ZeroMemory(pDlg, sizeof(PRINTDLGA)); pDlg->lStructSize = sizeof(PRINTDLGA) - 1; SetLastError(0xdeadbeef); res = PrintDlgA(pDlg); ok( !res && (CommDlgExtendedError() == CDERR_STRUCTSIZE), "returned %ld with 0x%lx and 0x%lx (expected '0' and " / "CDERR_STRUCTSIZE)/n", res, GetLastError(), CommDlgExtendedError()); ZeroMemory(pDlg, sizeof(PRINTDLGA)); pDlg->lStructSize = sizeof(PRINTDLGA); pDlg->Flags = PD_RETURNDEFAULT; SetLastError(0xdeadbeef); res = PrintDlgA(pDlg); ok( res || (CommDlgExtendedError() == PDERR_NODEFAULTPRN), "returned %ld with 0x%lx and 0x%lx (expected '!= 0' or '0' and " / "PDERR_NODEFAULTPRN)/n", res, GetLastError(), CommDlgExtendedError()); HeapFree(GetProcessHeap(), 0, pDlg);
开发者ID:howard5888,项目名称:wineT,代码行数:29,
示例15: WMCommandProcLRESULT WINAPI WMCommandProc(HWND hWnd, UINT id, HWND hwndCtl, UINT codeNotify) { int nIdx = FindControlIdx(id); // Ignore if the dialog is in the process of being created if (g_done || nIdx < 0) return 0; switch (pFields[nIdx].nType) { case FIELD_BROWSEBUTTON: --nIdx; case FIELD_LINK: case FIELD_BUTTON: case FIELD_CHECKBOX: case FIELD_RADIOBUTTON: if (codeNotify != BN_CLICKED) return 0; break; case FIELD_COMBOBOX: case FIELD_LISTBOX: if (codeNotify != LBN_SELCHANGE) // LBN_SELCHANGE == CBN_SELCHANGE return 0; break; default: return 0; } FieldType *pField = pFields + nIdx; char szBrowsePath[MAX_PATH]; switch (pField->nType) { case FIELD_FILEREQUEST: { OPENFILENAME ofn={0,}; ofn.lStructSize = sizeof(ofn); ofn.hwndOwner = hConfigWindow; ofn.lpstrFilter = pField->pszFilter; ofn.lpstrFile = szBrowsePath; ofn.nMaxFile = sizeof(szBrowsePath); ofn.Flags = pField->nFlags & (OFN_OVERWRITEPROMPT | OFN_HIDEREADONLY | OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST | OFN_CREATEPROMPT | OFN_EXPLORER); GetWindowText(pField->hwnd, szBrowsePath, sizeof(szBrowsePath)); tryagain: GetCurrentDirectory(BUFFER_SIZE, szResult); // save working dir if ((pField->nFlags & FLAG_SAVEAS) ? GetSaveFileName(&ofn) : GetOpenFileName(&ofn)) { mySetWindowText(pField->hwnd, szBrowsePath); SetCurrentDirectory(szResult); // restore working dir // OFN_NOCHANGEDIR doesn't always work (see MSDN) break; } else if (szBrowsePath[0] && CommDlgExtendedError() == FNERR_INVALIDFILENAME) { szBrowsePath[0] = '/0'; goto tryagain; } break; } case FIELD_DIRREQUEST: { BROWSEINFO bi; bi.hwndOwner = hConfigWindow; bi.pidlRoot = NULL; bi.pszDisplayName = szBrowsePath; bi.lpszTitle = pField->pszText;#ifndef BIF_NEWDIALOGSTYLE#define BIF_NEWDIALOGSTYLE 0x0040#endif bi.ulFlags = BIF_STATUSTEXT | BIF_RETURNONLYFSDIRS | BIF_NEWDIALOGSTYLE; bi.lpfn = BrowseCallbackProc; bi.lParam = nIdx; bi.iImage = 0; if (pField->pszRoot) { LPSHELLFOLDER sf; ULONG eaten; LPITEMIDLIST root; int ccRoot = (lstrlen(pField->pszRoot) * 2) + 2; LPWSTR pwszRoot = (LPWSTR) MALLOC(ccRoot); MultiByteToWideChar(CP_ACP, 0, pField->pszRoot, -1, pwszRoot, ccRoot); SHGetDesktopFolder(&sf); sf->ParseDisplayName(hConfigWindow, NULL, pwszRoot, &eaten, &root, NULL); bi.pidlRoot = root; sf->Release(); FREE(pwszRoot); } //CoInitializeEx(NULL, COINIT_APARTMENTTHREADED); LPITEMIDLIST pResult = SHBrowseForFolder(&bi); if (!pResult) break; if (SHGetPathFromIDList(pResult, szBrowsePath)) { mySetWindowText(pField->hwnd, szBrowsePath); } CoTaskMemFree(pResult); break; }//.........这里部分代码省略.........
开发者ID:kichik,项目名称:nsis-1,代码行数:101,
示例16: winprint_print_text_dialogstatic intwinprint_print_text_dialog (struct winprint_data *wd, Tcl_Interp *interp, const struct print_text_options *pto, PRINTDLG *pd, int *cancelled){ int mode, ret; *cancelled = 0; memset (pd, 0, sizeof (PRINTDLG)); pd->lStructSize = sizeof (PRINTDLG); if (! pto->dialog) pd->Flags = PD_RETURNDEFAULT | PD_RETURNDC; else { Tk_Window parent; if (pto->parent == NULL) parent = Tk_MainWindow (interp); else { parent = Tk_NameToWindow (interp, pto->parent, Tk_MainWindow (interp)); if (parent == NULL) return TCL_ERROR; } if (Tk_WindowId (parent) == None) Tk_MakeWindowExist (parent); pd->hwndOwner = Tk_GetHWND (Tk_WindowId (parent)); if (wd->page_setup != NULL) { pd->hDevMode = wd->page_setup->hDevMode; pd->hDevNames = wd->page_setup->hDevNames; } pd->Flags = PD_NOSELECTION | PD_RETURNDC | PD_USEDEVMODECOPIES; pd->nCopies = 1; pd->nFromPage = 1; pd->nToPage = 1; pd->nMinPage = 1; pd->nMaxPage = 0xffff; } mode = Tcl_SetServiceMode (TCL_SERVICE_ALL); ret = PrintDlg (pd); (void) Tcl_SetServiceMode (mode); if (! ret) { DWORD code; code = CommDlgExtendedError (); /* For some errors, the print dialog will already have reported an error. We treat those as though the user pressed cancel. Unfortunately, I do not know just which errors those are. */ if (code == 0 || code == PDERR_NODEFAULTPRN) { *cancelled = 1; return TCL_OK; } else { char buf[20]; sprintf (buf, "0x%lx", (unsigned long) code); Tcl_ResetResult (interp); Tcl_AppendStringsToObj (Tcl_GetObjResult (interp), "Windows common dialog error ", buf, (char *) NULL); return TCL_ERROR; } } return TCL_OK;}
开发者ID:AndresGG,项目名称:sn-8.4,代码行数:82,
示例17: winprint_page_setup_commandstatic intwinprint_page_setup_command (ClientData cd, Tcl_Interp *interp, int argc, char **argv){ struct winprint_data *wd = (struct winprint_data *) cd; Tk_Window parent; int i, mode, ret; PAGESETUPDLG psd; parent = Tk_MainWindow (interp); for (i = 2; i < argc; i += 2) { if (i + 1 >= argc) { Tcl_ResetResult (interp); Tcl_AppendStringsToObj (Tcl_GetObjResult (interp), "value for /"", argv[i], "/" missing", (char *) NULL); return TCL_ERROR; } if (strcmp (argv[i], "-parent") == 0) { parent = Tk_NameToWindow (interp, argv[i + 1], Tk_MainWindow (interp)); if (parent == NULL) return TCL_ERROR; } else { Tcl_ResetResult (interp); Tcl_AppendStringsToObj (Tcl_GetObjResult (interp), "unknown option /"", argv[i], "/"", (char *) NULL); return TCL_ERROR; } } if (wd->page_setup != NULL) psd = *wd->page_setup; else { memset (&psd, 0, sizeof (PAGESETUPDLG)); psd.lStructSize = sizeof (PAGESETUPDLG); psd.Flags = PSD_DEFAULTMINMARGINS; } if (Tk_WindowId (parent) == None) Tk_MakeWindowExist (parent); psd.hwndOwner = Tk_GetHWND (Tk_WindowId (parent)); mode = Tcl_SetServiceMode (TCL_SERVICE_ALL); ret = PageSetupDlg (&psd); (void) Tcl_SetServiceMode (mode); if (! ret) { DWORD code; code = CommDlgExtendedError (); if (code == 0) { /* The user pressed cancel. */ return TCL_OK; } else { char buf[20]; sprintf (buf, "0x%lx", (unsigned long) code); Tcl_ResetResult (interp); Tcl_AppendStringsToObj (Tcl_GetObjResult (interp), "Windows common dialog error ", buf, (char *) NULL); return TCL_ERROR; } } if (wd->page_setup == NULL) wd->page_setup = (PAGESETUPDLG *) ckalloc (sizeof (PAGESETUPDLG)); *wd->page_setup = psd; return TCL_OK;}
开发者ID:AndresGG,项目名称:sn-8.4,代码行数:88,
示例18: __declspecvoid __declspec(dllexport) SelectFileDialog(HWND hwndParent, int string_size, TCHAR *variables, stack_t **stacktop, extra_parameters *extra){ OPENFILENAME ofn={0,}; // XXX WTF int save; TCHAR type[5]; const int len = 1024; // Avoid _chkstk by using allocated arrays. TCHAR* path = (TCHAR*) GlobalAlloc(GPTR, len*sizeof(TCHAR)); TCHAR* filter =(TCHAR*) GlobalAlloc(GPTR, len*sizeof(TCHAR)); TCHAR* currentDirectory = (TCHAR*) GlobalAlloc(GPTR, len*sizeof(TCHAR)); TCHAR* initialDir = (TCHAR*) GlobalAlloc(GPTR, len*sizeof(TCHAR)); DWORD gfa; EXDLL_INIT(); ofn.lStructSize = sizeof(OPENFILENAME); ofn.hwndOwner = hwndParent; ofn.lpstrFilter = filter; ofn.lpstrFile = path; ofn.nMaxFile = len; //ofn.Flags = pField->nFlags & (OFN_OVERWRITEPROMPT | OFN_HIDEREADONLY | OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST | OFN_CREATEPROMPT | OFN_EXPLORER); ofn.Flags = OFN_CREATEPROMPT | OFN_EXPLORER; popstringn(type, len); popstringn(path, len); popstringn(filter, len); save = !lstrcmpi(type, _T("save")); // Check if the path given is a folder. If it is we initialize the // ofn.lpstrInitialDir parameter gfa = GetFileAttributes(path); if ((gfa != INVALID_FILE_ATTRIBUTES) && (gfa & FILE_ATTRIBUTE_DIRECTORY)) { lstrcpy(initialDir, path); ofn.lpstrInitialDir = initialDir; path[0] = _T('/0'); // disable initial file selection as path is actually a directory } if (!filter[0]) { lstrcpy(filter, _T("All Files|*.*")); } { // Convert the filter to the format required by Windows: NULL after each // item followed by a terminating NULL TCHAR *p = filter; while (*p) // XXX take care for 1024 { if (*p == _T('|')) { *p++ = 0; } else { p = CharNext(p); } } p++; *p = 0; } GetCurrentDirectory(sizeof(currentDirectory), currentDirectory); // save working dir if ((save ? GetSaveFileName(&ofn) : GetOpenFileName(&ofn))) { pushstring(path); } else if (CommDlgExtendedError() == FNERR_INVALIDFILENAME) { *path = _T('/0'); if ((save ? GetSaveFileName(&ofn) : GetOpenFileName(&ofn))) { pushstring(path); } else { pushstring(_T("")); } } else { pushstring(_T("")); } // restore working dir // OFN_NOCHANGEDIR doesn't always work (see MSDN) SetCurrentDirectory(currentDirectory); GlobalFree(path); GlobalFree(filter); GlobalFree(currentDirectory); GlobalFree(initialDir);}
开发者ID:151706061,项目名称:nsis-chinese,代码行数:95,
示例19: GUIGetFileNameint GUIGetFileName( gui_window *wnd, open_file_name *ofn ){ OPENFILENAME wofn; bool issave; int rc; unsigned drive;#if defined(HAVE_DRIVES) unsigned old_drive; unsigned drives;#endif LastPath = NULL; if( ofn->initial_dir != NULL && ofn->initial_dir[0] != '/0' && ofn->initial_dir[1] == ':' ) { drive = ofn->initial_dir[0]; memmove( ofn->initial_dir, ofn->initial_dir+2, strlen( ofn->initial_dir+2 ) + 1 ); } else { drive = 0; } memset( &wofn, 0 , sizeof( wofn ) ); if( ofn->flags & OFN_ISSAVE ) { issave = true; } else { issave = false; } wofn.Flags = 0; if( hookFileDlg ) { wofn.Flags |= OFN_ENABLEHOOK; } if( !(ofn->flags & OFN_CHANGEDIR) ) { wofn.Flags |= OFN_NOCHANGEDIR; } if( ofn->flags & OFN_OVERWRITEPROMPT ) { wofn.Flags |= OFN_OVERWRITEPROMPT; } if( ofn->flags & OFN_HIDEREADONLY ) { wofn.Flags |= OFN_HIDEREADONLY; } if( ofn->flags & OFN_FILEMUSTEXIST ) { wofn.Flags |= OFN_FILEMUSTEXIST; } if( ofn->flags & OFN_PATHMUSTEXIST ) { wofn.Flags |= OFN_PATHMUSTEXIST; } if( ofn->flags & OFN_ALLOWMULTISELECT ) { wofn.Flags |= OFN_ALLOWMULTISELECT; } wofn.hwndOwner = GUIGetParentFrameHWND( wnd ); wofn.hInstance = GUIMainHInst; wofn.lStructSize = sizeof( wofn ); wofn.lpstrFilter = ofn->filter_list; wofn.nFilterIndex = ofn->filter_index; wofn.lpstrFile = ofn->file_name; wofn.nMaxFile = ofn->max_file_name; wofn.lpstrFileTitle = ofn->base_file_name; wofn.nMaxFileTitle = ofn->max_base_file_name; wofn.lpstrTitle = ofn->title; wofn.lpstrInitialDir = ofn->initial_dir; wofn.lpfnHook = (LPOFNHOOKPROC)NULL; if( hookFileDlg ) { wofn.lpfnHook = (LPOFNHOOKPROC)MakeOpenFileHookProcInstance( OpenHook, GUIMainHInst ); }#if defined( HAVE_DRIVES ) if( drive ) { _dos_getdrive( &old_drive ); _dos_setdrive( tolower( drive ) - 'a' + 1, &drives ); }#endif if( issave ) { rc = GetSaveFileName( &wofn ); } else { rc = GetOpenFileName( &wofn ); } if( hookFileDlg ) { (void)FreeProcInstance( (FARPROC)wofn.lpfnHook ); } if( LastPath && ( !rc || !( ofn->flags & OFN_WANT_LAST_PATH ) ) ) { GUIMemFree( LastPath ); LastPath = NULL; } ofn->last_path = LastPath;#if defined( HAVE_DRIVES ) if( drive ) { _dos_setdrive( old_drive, &drives ); }#endif if( rc ) { return( OFN_RC_FILE_SELECTED ); } if( !CommDlgExtendedError() ) { return( OFN_RC_NO_FILE_SELECTED ); } return( OFN_RC_FAILED_TO_INITIALIZE );} /* _GUIGetFileName */
开发者ID:pavanvunnava,项目名称:open-watcom-v2,代码行数:100,
示例20: MCA_do_file_dialog//.........这里部分代码省略......... t_file_dialog -> Release(); if (!t_succeeded) t_result = t_hresult; else t_result = 0; } else { OPENFILENAMEA t_open_dialog; memset(&t_open_dialog, 0, sizeof(OPENFILENAMEA)); t_open_dialog . lStructSize = sizeof(OPENFILENAMEA); char *t_initial_file_buffer = new char[MAX_PATH]; if (t_initial_file != NULL) strcpy(t_initial_file_buffer, t_initial_file); else *t_initial_file_buffer = '/0'; t_open_dialog . lpstrFilter = p_filter; t_open_dialog . nFilterIndex = 1; t_open_dialog . lpstrFile = t_initial_file_buffer; t_open_dialog . nMaxFile = MAX_PATH; t_open_dialog . lpstrInitialDir = t_initial_folder; t_open_dialog . lpstrTitle = p_prompt; t_open_dialog . Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY | OFN_NOCHANGEDIR | OFN_LONGNAMES | OFN_PATHMUSTEXIST | OFN_EXPLORER | OFN_ENABLEHOOK | OFN_ENABLESIZING; if (p_options & MCA_OPTION_PLURAL) t_open_dialog . Flags |= OFN_ALLOWMULTISELECT; if (p_options & MCA_OPTION_SAVE_DIALOG) t_open_dialog . Flags |= OFN_OVERWRITEPROMPT; t_open_dialog . lpstrFilter = p_filter; t_open_dialog . lpfnHook = open_dialog_hook; t_open_dialog . hwndOwner = t_window != NULL ? (HWND)t_window -> handle . window : NULL; if (p_options & MCA_OPTION_SAVE_DIALOG) t_succeeded = GetSaveFileNameA((LPOPENFILENAMEA)&t_open_dialog) == TRUE; else { *t_open_dialog . lpstrFile = '/0'; t_succeeded = GetOpenFileNameA((LPOPENFILENAMEA)&t_open_dialog) == TRUE; } if (!t_succeeded) t_result = CommDlgExtendedError(); // MW-2005-07-26: Try again without the specified filename if it was invalid if (t_result == FNERR_INVALIDFILENAME) { *t_open_dialog . lpstrFile = '/0'; if (p_options & MCA_OPTION_SAVE_DIALOG) t_succeeded = GetSaveFileNameA((LPOPENFILENAMEA)&t_open_dialog) == TRUE; else t_succeeded = GetOpenFileNameA((LPOPENFILENAMEA)&t_open_dialog) == TRUE; if (!t_succeeded) t_result = CommDlgExtendedError(); } if (t_result == FNERR_BUFFERTOOSMALL) t_succeeded = true; if (t_succeeded) { build_paths(ep); t_filter_index = t_open_dialog . nFilterIndex; } delete t_initial_file_buffer; } if (t_succeeded) { if (p_options & MCA_OPTION_RETURN_FILTER) { const char *t_type = p_filter; const char *t_types = p_filter; for(int t_index = t_filter_index * 2 - 1; t_index > 1; t_types += 1) if (*t_types == '/0') t_type = t_types + 1, t_index -= 1; MCresult -> copysvalue(t_type); } t_result = 0; } waitonbutton(); if (t_initial_folder != NULL) delete t_initial_folder; if (t_initial_file != NULL) delete t_initial_file; return t_result;}
开发者ID:Bjoernke,项目名称:livecode,代码行数:101,
示例21: uiDlgFileNamebbCHAR* uiDlgFileName(uiWINH hWin, const bbCHAR* pPath, bbUINT opt, uiDlgFileNameFilter* const pFilter){#if (bbOS == bbOS_WIN32) || (bbOS == bbOS_WINCE) bbCHAR* pFileNameBuffer; bbUINT const bufferstart = (opt & uiDLGFILEOPT_MULTISELECT) ? sizeof(uiDlgFileNameBlock)/sizeof(bbCHAR) : 0; OPENFILENAME ofn; bbMemClear(&ofn, sizeof(ofn)); ofn.lStructSize = sizeof(ofn); ofn.hwndOwner = hWin; if (pPath) ofn.nMaxFile = bbStrLen(pPath) + 1; if (ofn.nMaxFile < 512) ofn.nMaxFile = 512; if ((pFileNameBuffer = (bbCHAR*) bbMemAlloc(sizeof(bbCHAR) * ofn.nMaxFile + sizeof(uiDlgFileNameBlock))) == NULL) return NULL; ofn.lpstrFile = pFileNameBuffer + bufferstart; if (pPath) bbStrCpy(ofn.lpstrFile, pPath); else *ofn.lpstrFile = 0; if (pFilter) { ofn.nFilterIndex = pFilter->FilterIndex; ofn.lpstrFilter = pFilter->pFilter; } ofn.Flags = (opt & (uiDLGFILEOPT_MULTISELECT|uiDLGFILEOPT_NODEREFERENCELINKS|uiDLGFILEOPT_OVERWRITEPROMPT)) | OFN_DONTADDTORECENT | OFN_ENABLESIZING | OFN_NOTESTFILECREATE | OFN_HIDEREADONLY | OFN_EXPLORER; BOOL (__stdcall *fnGetFileName)(LPOPENFILENAME) = (opt & uiDLGFILEOPT_SAVE) ? GetSaveFileName : GetOpenFileName; if (fnGetFileName(&ofn) == 0) { DWORD err = CommDlgExtendedError(); if (err == FNERR_BUFFERTOOSMALL) { ofn.nMaxFile = *(WORD*)ofn.lpstrFile; if (bbMemRealloc(sizeof(bbCHAR) * ofn.nMaxFile + sizeof(uiDlgFileNameBlock), (void**)&pFileNameBuffer) != bbEOK) goto uiDlgFileSave_err; ofn.lpstrFile = pFileNameBuffer + bufferstart; if (fnGetFileName(&ofn)) goto uiDlgFileSave_ok; err = CommDlgExtendedError(); } if (err == 0) { bbErrSet(bbEEND); } else { bbErrSet(bbESYS); //xxx add error codes bbLog(bbErr, bbT("uiDlgFileSave: error %X/n"), err); } goto uiDlgFileSave_err; } uiDlgFileSave_ok: if (pFilter) { pFilter->FilterIndex = ofn.nFilterIndex; } if (opt & uiDLGFILEOPT_MULTISELECT) { ((uiDlgFileNameBlock*)pFileNameBuffer)->CurFileOffset = ((uiDlgFileNameBlock*)pFileNameBuffer)->FirstFileOffset = ofn.nFileOffset; if (ofn.nFileOffset > 0) pFileNameBuffer[ofn.nFileOffset + bufferstart - 1] = '/0'; // 0-term path also for single-selection case } return pFileNameBuffer; uiDlgFileSave_err: bbMemFree(pFileNameBuffer); return NULL;#else#endif}
开发者ID:SummerSut,项目名称:ui,代码行数:93,
示例22: do_browsestatic void do_browse(const char *title, const char *entry_to_populate, int filts){#ifdef win32 OPENFILENAME of; int retval; char fname[1024]; fname[0] = '/0'; memset(&of, 0, sizeof(of));#ifdef OPENFILENAME_SIZE_VERSION_400 of.lStructSize = OPENFILENAME_SIZE_VERSION_400;#else of.lStructSize = sizeof(of);#endif of.hwndOwner = NULL; if (filts == (L_FILT | LED_FILT | ALL_CEOS_LEADER_FILT | XML_FILT | RSC_FILT | MOSAIC_FILT)) { of.lpstrFilter = "CEOS Level 1 Files/0*.L;LED-*/0" "RSAT/ERS CEOS L1/0*.L/0" "ALOS Leader Files/0LED-*/0" "TerraSAR-X/Radarsat-2/0*.xml/0" "ALOS mosaics/0*HDR.txt;*HDR/0" "ROI_PAC Files/0*.rsc/0" "All Files/0*/0"; } else if (filts == (L_FILT | LED_FILT | ALL_CEOS_LEADER_FILT | XML_FILT)) { of.lpstrFilter = "CEOS Level 1 Files/0*.L;LED-*/0" "RSAT/ERS CEOS L1/0*.L/0" "ALOS Leader Files/0LED-*/0" "TerraSAR-X/Radarsat-2/0*.xml/0" "All Files/0*/0"; } else if (filts == (L_FILT | LED_FILT | ALL_CEOS_LEADER_FILT | XML_FILT | ANN_FILT )) { of.lpstrFilter = "All Metadata Files/0*.L;LED-*;*.xml;*.ann/0" "CEOS Level 1 Files/0*.L;LED-*/0" "RSAT/ERS CEOS L1/0*.L/0" "ALOS Leader Files/0LED-*/0" "TerraSAR-X/Radarsat-2/0*.xml/0" "UAVSAR Annotation File/0*.ann/0" "All Files/0*/0"; } else if (filts == BIN_FILT) { of.lpstrFilter = "PolSARPro Files/0*.bin/0" "All Files/0*/0"; } else if (filts == ANN_FILT) { of.lpstrFilter = "UAVSAR Annotation File/0*.ann/0" "All Files/0*/0"; } else { of.lpstrFilter = "All Files/0*/0"; } of.lpstrCustomFilter = NULL; of.nFilterIndex = 1; of.lpstrFile = fname; of.nMaxFile = sizeof(fname); of.lpstrFileTitle = NULL; of.lpstrInitialDir = "."; of.lpstrTitle = "Select File"; of.lpstrDefExt = NULL; of.Flags = OFN_HIDEREADONLY | OFN_ALLOWMULTISELECT | OFN_EXPLORER; retval = GetOpenFileName(&of); if (!retval) { if (CommDlgExtendedError()) message_box("File dialog box error"); return; } /* the returned "fname" has the following form: */ /* <directory>/0<first file>/0<second file>/0<third ... */ char * dir = STRDUP(fname); char * p = fname + strlen(dir) + 1; if (*p) { while (*p) { char * dir_and_file = malloc(sizeof(char)*(strlen(dir)+strlen(p)+5)); sprintf(dir_and_file, "%s%c%s", dir, DIR_SEPARATOR, p); put_string_to_entry(entry_to_populate, dir_and_file); p += strlen(p) + 1; free(dir_and_file); } } else { put_string_to_entry(entry_to_populate, dir); } free(dir);#else // #ifdef win32//.........这里部分代码省略.........
开发者ID:etrochim,项目名称:ASF_MapReady,代码行数:101,
示例23: on_browse_input_files_button_clicked//.........这里部分代码省略......... break; case FORMAT_TERRASARX: of.lpstrFilter = "TerraSAR-X Metadata Files (*.xml)/0*.xml/0" "All Files/0*/0"; break; case FORMAT_RADARSAT2: of.lpstrFilter = "Radarsat-2 Metadata Files (*.xml)/0*.xml/0" "All Files/0*/0"; break; case FORMAT_ROIPAC: of.lpstrFilter = "ROI_PAC Metadata Files (*.rsc)/0*.rsc/0" "All Files/0*/0"; break; case FORMAT_ALOS_MOSAIC: of.lpstrFilter = "ALOS mosaic Metadata Files (*HDR.txt, *HDR.txt)/0*HDR.txt;*HDR/0" "All Files/0*/0"; break; case FORMAT_GEOTIFF: of.lpstrFilter = "GeoTIFF Files (*.tif, *.tiff)/0*.tif;*.tiff/0" "All Files/0*/0"; break; case FORMAT_ASF_INTERNAL: of.lpstrFilter = "ASF Internal Files (*.img)/0*.img/0" "All Files/0*/0"; break; } of.lpstrCustomFilter = NULL; of.nFilterIndex = 1; of.lpstrFile = fname; of.nMaxFile = sizeof(fname); of.lpstrFileTitle = NULL; of.lpstrInitialDir = "."; of.lpstrTitle = "Select File"; of.lpstrDefExt = NULL; of.Flags = OFN_HIDEREADONLY | OFN_ALLOWMULTISELECT | OFN_EXPLORER; retval = GetOpenFileName(&of); if (!retval) { if (CommDlgExtendedError()) message_box("File dialog box error"); return; } /* the returned "fname" has the following form: */ /* <directory>/0<first file>/0<second file>/0<third ... */ char * dir = STRDUP(fname); char * p = fname + strlen(dir) + 1; if (*p) { while (*p) { char * dir_and_file = malloc(sizeof(char)*(strlen(dir)+strlen(p)+5)); sprintf(dir_and_file, "%s%c%s", dir, DIR_SEPARATOR, p); add_to_files_list(dir_and_file); p += strlen(p) + 1; free(dir_and_file); } } else { add_to_files_list(dir); } free(dir);#else // #ifdef win32 /* Linux version -- use GtkFileChooser if possible */#ifdef USE_GTK_FILE_CHOOSER if (GTK_IS_WIDGET(browse_widget)) gtk_widget_destroy(browse_widget); create_file_chooser_dialog(sel); gtk_widget_show(browse_widget);#else // #ifdef USE_GTK_FILE_CHOOSER GtkWidget *file_selection_dialog = get_widget_checked("input_file_selection"); gtk_widget_show(file_selection_dialog);#endif // #ifdef USE_GTK_FILE_CHOOSER#endif // #ifdef win32}
开发者ID:etrochim,项目名称:ASF_MapReady,代码行数:101,
示例24: WMCommandProcLRESULT WINAPI WMCommandProc(HWND hWnd, UINT id, HWND hwndCtl, UINT codeNotify) { switch (codeNotify) { case BN_CLICKED: // The user pressed a button case LBN_SELCHANGE: // The user changed the selection in a ListBox control// case CBN_SELCHANGE: // The user changed the selection in a DropList control (same value as LBN_SELCHANGE) { char szBrowsePath[MAX_PATH]; int nIdx = FindControlIdx(id); if (nIdx < 0) break; if (pFields[nIdx].nType == FIELD_BROWSEBUTTON) --nIdx; FieldType *pField = pFields + nIdx; switch (pField->nType) { case FIELD_FILEREQUEST: { OPENFILENAME ofn={0,}; ofn.lStructSize = sizeof(ofn); ofn.hwndOwner = hConfigWindow; ofn.lpstrFilter = pField->pszFilter; ofn.lpstrFile = szBrowsePath; ofn.nMaxFile = sizeof(szBrowsePath); ofn.Flags = pField->nFlags & (OFN_OVERWRITEPROMPT | OFN_HIDEREADONLY | OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST | OFN_CREATEPROMPT | OFN_EXPLORER); GetWindowText(pField->hwnd, szBrowsePath, sizeof(szBrowsePath)); tryagain: if ((pField->nFlags & FLAG_SAVEAS) ? GetSaveFileName(&ofn) : GetOpenFileName(&ofn)) { mySetWindowText(pField->hwnd, szBrowsePath); break; } else if (szBrowsePath[0] && CommDlgExtendedError() == FNERR_INVALIDFILENAME) { szBrowsePath[0] = '/0'; goto tryagain; } break; } case FIELD_DIRREQUEST: { BROWSEINFO bi; bi.hwndOwner = hConfigWindow; bi.pidlRoot = NULL; bi.pszDisplayName = szBrowsePath; bi.lpszTitle = pField->pszText;#ifndef BIF_NEWDIALOGSTYLE#define BIF_NEWDIALOGSTYLE 0x0040#endif bi.ulFlags = BIF_STATUSTEXT | BIF_RETURNONLYFSDIRS | BIF_NEWDIALOGSTYLE; bi.lpfn = BrowseCallbackProc; bi.lParam = nIdx; bi.iImage = 0; if (pField->pszRoot) { LPSHELLFOLDER sf; ULONG eaten; LPITEMIDLIST root; int ccRoot = (lstrlen(pField->pszRoot) * 2) + 2; LPWSTR pwszRoot = (LPWSTR) MALLOC(ccRoot); MultiByteToWideChar(CP_ACP, 0, pField->pszRoot, -1, pwszRoot, ccRoot); SHGetDesktopFolder(&sf); sf->ParseDisplayName(hConfigWindow, NULL, pwszRoot, &eaten, &root, NULL); bi.pidlRoot = root; sf->Release(); FREE(pwszRoot); }// CoInitializeEx(NULL, COINIT_APARTMENTTHREADED); LPITEMIDLIST pResult = SHBrowseForFolder(&bi); if (!pResult) break; if (SHGetPathFromIDList(pResult, szBrowsePath)) { mySetWindowText(pField->hwnd, szBrowsePath); } LPMALLOC pMalloc; if (!SHGetMalloc(&pMalloc)) { pMalloc->Free(pResult); } break; } case FIELD_LINK: case FIELD_BUTTON: // Allow the state to be empty - this might be useful in conjunction // with the NOTIFY flag if (*pField->pszState) ShellExecute(hMainWindow, NULL, pField->pszState, NULL, NULL, SW_SHOWDEFAULT); break; } if (pField->nFlags & LBS_NOTIFY) { // Remember which control was activated then pretend the user clicked Next g_NotifyField = nIdx + 1; // the next button must be enabled or nsis will ignore WM_COMMAND BOOL bWasDisabled = EnableWindow(hNextButton, TRUE); FORWARD_WM_COMMAND(hMainWindow, IDOK, hNextButton, BN_CLICKED, mySendMessage); if (bWasDisabled)//.........这里部分代码省略.........
开发者ID:kichik,项目名称:nsis-1,代码行数:101,
示例25: shellinitprintboolean shellinitprint (void) { /* 9/5/90 dmb: close print resources after initializing stuff 10/21/91 dmb: added margins field to print info; structure is now here to have user-settable margins. 12/31/91 dmb: initialize shellprintinfo.paperrect to standard 72dpi values in case no printer is chosen and shellcopyprintinfo never gets called 1/18/93 dmb: don't call shellcheckprinterror the first time; if PrOpen fails here, we don't want to raise an alert. */ #if MACVERSION && !TARGET_API_MAC_CARBON Handle h; #endif currentprintport = NULL; clearbytes (&shellprintinfo, longsizeof (shellprintinfo)); setrect (&shellprintinfo.margins, 36, 36, 36, 36); setrect (&shellprintinfo.paperrect, 5, 6, 725, 546); /*defaults in case PrOpen fails*/ shellprintinfo.scaleMult = 1; shellprintinfo.scaleDiv = 1; #ifdef MACVERSION # if TARGET_API_MAC_CARBON == 1 //I realized this is only called once during the startup of the app. //Carbon printing really doesn't need any global structures. Better to //allocate them as we use them. // Nope. // We need a global var for calling page setup shellprintinfo.printport = nil; shellprintinfo.printhandle = nil; shellprintinfo.pageformat = nil; shellprintinfo.printsettings = nil; // shellprintinfo.pagerect = {0,0,0,0}; # else if (!newclearhandle (longsizeof (TPrint), &h)) return (false); shellprintinfo.printhandle = (THPrint) h; /*copy into print record*/ PrOpen (); /*initialize the Mac print manager*/ if (PrError () != noErr) goto error; PrintDefault (shellprintinfo.printhandle); /*set default print record*/ PrClose (); /*shouldn't leave print resources open all the time*/ if (!shellcheckprinterror (false)) goto error;# endif #endif #ifdef WIN95VERSION ZeroMemory (&shellprintinfo.pagesetupinfo, sizeof (PAGESETUPDLG)); shellprintinfo.pagesetupinfo.lStructSize = sizeof (PAGESETUPDLG); shellprintinfo.pagesetupinfo.hwndOwner = NULL; shellprintinfo.pagesetupinfo.Flags = PSD_RETURNDEFAULT | PSD_NOWARNING; if (! PageSetupDlg (&shellprintinfo.pagesetupinfo)) { if (CommDlgExtendedError() != 0) goto error; } #endif //#if !TARGET_API_MAC_CARBON shellcopyprintinfo (); /*copies fields from handle into record*/ //#endif return (true); #if !defined(MACVERSION) || !TARGET_API_MAC_CARBON error://.........这里部分代码省略.........
开发者ID:dvincent,项目名称:frontier,代码行数:101,
示例26: return//.........这里部分代码省略......... if( fn_ext[0] != '/0' ) { ext[0] = '*'; strcpy( ext + 1, fn_ext ); filter = WdeFindFileFilterIndex( gf->filter, ext ); } } else { wde_file_name[0] = 0; } if( filter == 0 ) { filter = WdeFindFileFilterIndex( gf->filter, WdeFileFilter ); if( filter < 1 ) { filter = 1; } } // CTL3D no longer requires this#if !defined( __NT__ ) flags |= OFN_ENABLEHOOK;#endif /* initialize the OPENFILENAME struct */ memset( &wdeofn, 0, sizeof( OPENFILENAME ) ); /* fill in non-variant fields of OPENFILENAME struct */ wdeofn.lStructSize = sizeof( OPENFILENAME ); wdeofn.hwndOwner = owner_window; wdeofn.hInstance = app_inst; wdeofn.lpstrFilter = gf->filter; wdeofn.lpstrCustomFilter = NULL; wdeofn.nMaxCustFilter = 0; wdeofn.nFilterIndex = filter; wdeofn.lpstrFile = wde_file_name; wdeofn.nMaxFile = MAXFILENAME; wdeofn.lpstrFileTitle = wdefntitle; wdeofn.nMaxFileTitle = MAXFILENAME; wdeofn.lpstrInitialDir = wde_initial_dir; wdeofn.lpstrTitle = wdefntitle; wdeofn.Flags = flags;#if !defined( __NT__ ) wdeofn.lpfnHook = (LPOFNHOOKPROC)MakeProcInstance( (FARPROC)WdeOpenHookProc, app_inst );#endif#if 0 wdeofn.nFileOffset = 0L; wdeofn.nFileExtension = 0L; wdeofn.lpstrDefExt = NULL; wdeofn.lCustData = NULL; wdeofn.lpfnHook = NULL; wdeofn.lpTemplateName = NULL;#endif if( action == WDEOPENFILE ) { ret = GetOpenFileName( (LPOPENFILENAME)&wdeofn ); } else if( action == WDESAVEFILE ) { ret = GetSaveFileName( (LPOPENFILENAME)&wdeofn ); } else { return( NULL ); }#ifndef __NT__ if( wdeofn.lpfnHook != NULL ) { FreeProcInstance( (FARPROC)wdeofn.lpfnHook ); }#endif gf->fn_offset = wdeofn.nFileOffset; gf->ext_offset = wdeofn.nFileExtension; /* show the dialog box */ if( !ret ) { error = CommDlgExtendedError(); if( error ) { WdeDisplayErrorMsg( WDE_ERRORSELECTINGFILE ); } return( NULL ); } else { memcpy( wde_initial_dir, wde_file_name, wdeofn.nFileOffset ); if( wde_initial_dir[wdeofn.nFileOffset - 1] == '//' && wde_initial_dir[wdeofn.nFileOffset - 2] != ':' ) { wde_initial_dir[wdeofn.nFileOffset - 1] = '/0'; } else { wde_initial_dir[wdeofn.nFileOffset] = '/0'; } _splitpath( wde_file_name, NULL, NULL, NULL, fn_ext + 1 ); if( fn_ext[1] != '/0' ) { fn_ext[0] = '*'; WdeSetFileFilter( fn_ext ); } else { char *out_ext; out_ext = WdeFindFileFilterFromIndex( gf->filter, wdeofn.nFilterIndex ); if( out_ext[2] != '*' ) { strcat( wde_file_name, &out_ext[1] ); } } } UpdateWindow( WdeGetMainWindowHandle() ); return( WdeStrDup( wde_file_name ) );}
开发者ID:Azarien,项目名称:open-watcom-v2,代码行数:101,
示例27: OnMenuPrintvoid OnMenuPrint(WindowInfo *win, bool waitForCompletion){ // we remember some printer settings per process static ScopedMem<DEVMODE> defaultDevMode; static PrintScaleAdv defaultScaleAdv = PrintScaleShrink; static bool defaultAsImage = false; bool printSelection = false; Vec<PRINTPAGERANGE> ranges; PRINTER_INFO_2 printerInfo = { 0 }; if (!HasPermission(Perm_PrinterAccess)) return; DisplayModel *dm = win->dm; assert(dm); if (!dm) return; if (!dm->engine || !dm->engine->AllowsPrinting()) return; if (win->IsChm()) { win->dm->AsChmEngine()->PrintCurrentPage(); return; } if (win->printThread) { int res = MessageBox(win->hwndFrame, _TR("Printing is still in progress. Abort and start over?"), _TR("Printing in progress."), MB_ICONEXCLAMATION | MB_YESNO | (IsUIRightToLeft() ? MB_RTLREADING : 0)); if (res == IDNO) return; } AbortPrinting(win); PRINTDLGEX pd; ZeroMemory(&pd, sizeof(PRINTDLGEX)); pd.lStructSize = sizeof(PRINTDLGEX); pd.hwndOwner = win->hwndFrame; pd.Flags = PD_USEDEVMODECOPIESANDCOLLATE | PD_COLLATE; if (!win->selectionOnPage) pd.Flags |= PD_NOSELECTION; pd.nCopies = 1; /* by default print all pages */ pd.nPageRanges = 1; pd.nMaxPageRanges = MAXPAGERANGES; PRINTPAGERANGE *ppr = AllocArray<PRINTPAGERANGE>(MAXPAGERANGES); pd.lpPageRanges = ppr; ppr->nFromPage = 1; ppr->nToPage = dm->PageCount(); pd.nMinPage = 1; pd.nMaxPage = dm->PageCount(); pd.nStartPage = START_PAGE_GENERAL; Print_Advanced_Data advanced(PrintRangeAll, defaultScaleAdv, defaultAsImage); ScopedMem<DLGTEMPLATE> dlgTemplate; // needed for RTL languages HPROPSHEETPAGE hPsp = CreatePrintAdvancedPropSheet(&advanced, dlgTemplate); pd.lphPropertyPages = &hPsp; pd.nPropertyPages = 1; // restore remembered settings if (defaultDevMode) pd.hDevMode = GlobalMemDup(defaultDevMode.Get(), defaultDevMode.Get()->dmSize + defaultDevMode.Get()->dmDriverExtra); if (PrintDlgEx(&pd) != S_OK) { if (CommDlgExtendedError() != 0) { /* if PrintDlg was cancelled then CommDlgExtendedError is zero, otherwise it returns the error code, which we could look at here if we wanted. for now just warn the user that printing has stopped becasue of an error */ MessageBox(win->hwndFrame, _TR("Couldn't initialize printer"), _TR("Printing problem."), MB_ICONEXCLAMATION | MB_OK | (IsUIRightToLeft() ? MB_RTLREADING : 0)); } goto Exit; } if (pd.dwResultAction == PD_RESULT_PRINT || pd.dwResultAction == PD_RESULT_APPLY) { // remember settings for this process LPDEVMODE devMode = (LPDEVMODE)GlobalLock(pd.hDevMode); if (devMode) { defaultDevMode.Set((LPDEVMODE)memdup(devMode, devMode->dmSize + devMode->dmDriverExtra)); GlobalUnlock(pd.hDevMode); } defaultScaleAdv = advanced.scale; defaultAsImage = advanced.asImage; } if (pd.dwResultAction != PD_RESULT_PRINT) goto Exit; if (pd.Flags & PD_CURRENTPAGE) { PRINTPAGERANGE pr = { dm->CurrentPageNo(), dm->CurrentPageNo() }; ranges.Append(pr); } else if (win->selectionOnPage && (pd.Flags & PD_SELECTION)) { printSelection = true; } else if (!(pd.Flags & PD_PAGENUMS)) { PRINTPAGERANGE pr = { 1, dm->PageCount() }; ranges.Append(pr); } else { assert(pd.nPageRanges > 0); for (DWORD i = 0; i < pd.nPageRanges; i++) ranges.Append(pd.lpPageRanges[i]); }//.........这里部分代码省略.........
开发者ID:iamplaced,项目名称:sumatrapdf,代码行数:101,
注:本文中的CommDlgExtendedError函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ CommLog_Print函数代码示例 C++ ComboBox_SetItemData函数代码示例 |