这篇教程C++ GetOpenFileNameA函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中GetOpenFileNameA函数的典型用法代码示例。如果您正苦于以下问题:C++ GetOpenFileNameA函数的具体用法?C++ GetOpenFileNameA怎么用?C++ GetOpenFileNameA使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了GetOpenFileNameA函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: GetOpenFileNameA_fix/* MAKE_EXPORT GetOpenFileNameA_fix=GetOpenFileNameA */BOOL WINAPI GetOpenFileNameA_fix(LPOPENFILENAMEA lpofn){ BOOL ret = GetOpenFileNameA(lpofn); if (!ret && CommDlgExtendedError() == CDERR_STRUCTSIZE && lpofn && lpofn->lStructSize == sizeof(OPENFILENAME)) { lpofn->lStructSize = OPENFILENAME_SIZE_VERSION_400A; ret = GetOpenFileNameA(lpofn); lpofn->lStructSize = sizeof(OPENFILENAME); } return ret;}
开发者ID:metaxor,项目名称:KernelEx,代码行数:13,
示例2: GetDlgItemTextAvoid ProjectConfigDialog::onSelectScriptFile(void){ char buff[MAX_PATH + 1] = {0}; char projdir[MAX_PATH + 1] = {0}; GetDlgItemTextA(m_hwndDialog, IDC_EDIT_PROJECT_DIR, projdir, MAX_PATH); OPENFILENAMEA ofn = {0}; ofn.lStructSize = sizeof(ofn); ofn.hwndOwner = m_hwndDialog; ofn.lpstrFilter = "Lua Script File (*.lua)/0*.lua/0"; ofn.lpstrTitle = "Select Script File"; if (DirectoryExists(projdir)) { ofn.lpstrInitialDir = projdir; } ofn.Flags = OFN_DONTADDTORECENT | OFN_ENABLESIZING | OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST; ofn.lpstrFile = buff; ofn.nMaxFile = MAX_PATH; if (GetOpenFileNameA(&ofn)) { m_project.setScriptFile(buff); updateScriptFile(); }}
开发者ID:AlexYanJianhua,项目名称:quick-cocos2d-x,代码行数:25,
示例3: WinMainint WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR lpCmdLine, int nShowCmd){ char szPathName[MAX_PATH]; OPENFILENAMEA ofn; ZeroMemory(&ofn, sizeof(ofn)); ofn.lStructSize = sizeof(ofn); ofn.lpstrFile = szPathName; ofn.lpstrFile[0] = '/0'; ofn.nMaxFile = MAX_PATH; ofn.lpstrFilter = "Win32 executable files/0*.exe/0/0"; ofn.nFilterIndex = 1; ofn.lpstrTitle = "Choose a file to protect"; ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST; int key_pressed = MessageBoxA(NULL, "CProtector - protector for executables/nWould you like to choose a file to protect?", "CProtector", MB_OKCANCEL | MB_ICONQUESTION); if (key_pressed == IDCANCEL) { ExitProcess(0); } if(!GetOpenFileNameA(&ofn)) ExitProcess(0); if(!ProtectFile(ofn.lpstrFile)) { MessageBoxA(NULL, "Error occured : file is busy or error unknown","CProtector", MB_ICONERROR); } else { MessageBoxA(NULL, "Protection installed","CProtector", MB_ICONINFORMATION); } ExitProcess(0);}
开发者ID:andrey429,项目名称:cprotector,代码行数:31,
示例4: OpenFileDialogBOOL OpenFileDialog(HWND hwndDlg, OPENFILENAMEA*ofn, char*exe) { //pointer zum exenamen char* exename = NULL; //buffer vom pfad static char szFile[260] = ""; //static damit noch nach dem aufruf lesbar bleibt //buffer vom filter char szFilter[260] = ""; //backslash suchen exename = strrchr(exe, '//') + 1; //kein backslash dann normal ret als exenamen verwenden if ((int)exename == 1) exename = exe; //filterstring aufbauen mir_snprintf(szFilter, SIZEOF(szFilter), "%s|%s|%s|*.*|", exename, exename, Translate("All Files")); //umbruch in 0 wandeln unsigned int sizeFilter = strlen(szFilter); for (unsigned int i = 0; i < sizeFilter; i++) if (szFilter[i] == '|') szFilter[i] = 0; //openfiledia vorbereiten memset(ofn, 0, sizeof(OPENFILENAMEA)); ofn->lStructSize = sizeof(OPENFILENAMEA); ofn->hwndOwner = hwndDlg; ofn->lpstrFile = szFile; ofn->nMaxFile = SIZEOF(szFile); ofn->lpstrFilter = szFilter; ofn->nFilterIndex = 1; ofn->lpstrFileTitle = exe; ofn->nMaxFileTitle = 0; ofn->lpstrInitialDir = NULL; ofn->Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST; return GetOpenFileNameA(ofn);}
开发者ID:martok,项目名称:miranda-ng,代码行数:32,
示例5: sizeofchar* Platform::OpenFileDialog(){ const int32 FileNameSize = MAX_PATH; char* FileName = (char*)malloc(FileNameSize); OPENFILENAME DialogParams = {}; DialogParams.lStructSize = sizeof(OPENFILENAME); DialogParams.hwndOwner = GetActiveWindow(); DialogParams.lpstrFilter = "JPEG/0*.jpg;*.jpeg/0PNG/0*.png/0"; DialogParams.nFilterIndex = 2; DialogParams.lpstrFile = FileName; DialogParams.lpstrFile[0] = '/0'; DialogParams.nMaxFile = FileNameSize; DialogParams.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST; BOOL Result = GetOpenFileNameA(&DialogParams); // TODO: Unicode support? if (Result) { return FileName; } else { free(FileName); return 0; }}
开发者ID:Clever-Boy,项目名称:Papaya,代码行数:27,
示例6: ShowOpenFileDialogbool ShowOpenFileDialog(char* FileName, int FileNameLength, char* filter)// Open a dialog for selecting a file and returns true if succeeded with the name of the file in the preallocated buffer <FileName>{ OPENFILENAMEA ofn ; ZeroMemory(&ofn, sizeof(ofn)); ofn.lStructSize = sizeof(ofn); ofn.hwndOwner = GetActiveWindow(); ofn.lpstrDefExt = 0; FileName[0] = '/0'; ofn.lpstrFile = FileName; ofn.nMaxFile = FileNameLength; ofn.lpstrFilter = filter; ofn.nFilterIndex = 1; char strAux[MAX_PATH]; GetCurrentDirectoryA(MAX_PATH, strAux); ofn.lpstrInitialDir = strAux; ofn.lpstrTitle = LPSTR("Open File"); ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST | OFN_ENABLESIZING; GetOpenFileNameA(&ofn); if (strlen(ofn.lpstrFile) == 0) return false; return true;} // ShowOpenFileDialog
开发者ID:alhunor,项目名称:projects,代码行数:26,
示例7: memsetvoid CTextureAtlasCreatorContext::Load(){ CHAR8 strOpenName[512] = ""; OPENFILENAMEA FileName; memset(&FileName, 0, sizeof(OPENFILENAMEA)); FileName.lStructSize = sizeof(OPENFILENAMEA); FileName.hwndOwner = reinterpret_cast<HWND>(Ascension::Renderer().GetWindowHandle()); FileName.hInstance = reinterpret_cast<HINSTANCE>(GetModuleHandle(NULL)); FileName.lpstrFilter = NULL; FileName.lpstrCustomFilter = NULL; FileName.nMaxCustFilter = NULL; FileName.lpstrFilter = "Ascension Atlas Files/0*.ascatl;*.ascatledt*/0/0"; FileName.nFilterIndex = 2; FileName.lpstrFile = strOpenName; FileName.nMaxFile = 512; FileName.lpstrFileTitle = NULL; FileName.lpstrTitle = "Open Atlas"; FileName.Flags = OFN_EXPLORER; if(TRUE == GetOpenFileNameA(&FileName)) { LoadAtlas(strOpenName); }}
开发者ID:Matt392,项目名称:Ascension,代码行数:25,
示例8: OnCompressOrDecompress// TODO: fix alternate cohesion crapvoid OnCompressOrDecompress(HWND sheet, bool compress){ int size, ret; char path[_MAX_PATH]; if (!GetOpenFileNameA(sheet, path, sizeof(path))) return; size = fsize(path); std::vector<unsigned char> buffer(size); AutoFile fIn(path, "rb"); fread(&buffer[0], sizeof(char), size, fIn.get()); // contiguous fIn.close(); path[0] = '/0'; // don't pre-fill path if (!GetSaveFileNameA(sheet, path, sizeof(path))) return; AutoFile fOut(path, "wb"); if (compress) ret = deflate_file(&buffer[0], size, fOut.get()); else ret = inflate_file(&buffer[0], size, fOut.get()); fOut.close(); if (ret >= 0) MessageBox(sheet, "Operation completed successfully.", "Raw Compression/Decompression", MB_OK); else MessageBox(sheet, "Operation failed.", "Raw Compression/Decompression", MB_ICONWARNING);}
开发者ID:DoctorWillCU,项目名称:aokts,代码行数:36,
|