您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ GetSaveFileName函数代码示例

51自学网 2021-06-01 21:14:29
  C++
这篇教程C++ GetSaveFileName函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中GetSaveFileName函数的典型用法代码示例。如果您正苦于以下问题:C++ GetSaveFileName函数的具体用法?C++ GetSaveFileName怎么用?C++ GetSaveFileName使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了GetSaveFileName函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: WndProc

LRESULT CALLBACK WndProc(HWND hWnd, UINT Message, WPARAM wParam, LPARAM lParam){	PAINTSTRUCT ps;	HDC hdc;  HPEN hPen;  HBRUSH hBrush;	BOOL success;  static BOOL enteringText = FALSE;	static TCHAR text[256];	static DWORD textLength = 0;	static OPENFILENAME OpenFileName;	static TCHAR FilePath[256];  static PRINTDLG printDialog;  ZeroMemory(&printDialog, sizeof(printDialog));  printDialog.lStructSize = sizeof(printDialog);  printDialog.hwndOwner = hWnd;  printDialog.Flags = PD_RETURNDC;  static CHOOSECOLOR chooseColorStructure;  static COLORREF acrCustClr[16];  ZeroMemory(&chooseColorStructure, sizeof(chooseColorStructure));  chooseColorStructure.lStructSize = sizeof(chooseColorStructure);  chooseColorStructure.hwndOwner = hWnd;  chooseColorStructure.lpCustColors = (LPDWORD) acrCustClr;  chooseColorStructure.rgbResult = 0;  chooseColorStructure.Flags = CC_FULLOPEN | CC_RGBINIT;  static DWORD lastX, lastY;	switch (Message)	{	case WM_CREATE:		viewController = new ViewController();		viewController->SetScrollSettings(hWnd, CW_USEDEFAULT, CW_USEDEFAULT);		mainCreator = new Creator();		OpenFileName.lStructSize = sizeof(OPENFILENAME);		OpenFileName.hwndOwner = hWnd;		OpenFileName.lpstrFile = FilePath;		OpenFileName.nMaxFile = sizeof(FilePath);		break;	case WM_COMMAND:		switch (LOWORD(wParam))		{		case ID_OPEN:			FilePath[0] = '/0';			success = GetOpenFileName(&OpenFileName);			if (success)			{				viewController->OpenMetaFile(OpenFileName.lpstrFile);			}			InvalidateRect(hWnd, NULL, TRUE);			break;		case ID_SAVEAS:			FilePath[0] = '/0';			success = GetSaveFileName(&OpenFileName);			if (success)			{				viewController->SaveMetaFile(OpenFileName.lpstrFile);			}			break;		case ID_NEW:			delete viewController;			viewController = new ViewController();			InvalidateRect(hWnd, NULL, TRUE);			break;    case ID_FILE_EXIT:      DestroyWindow(hWnd);      break;    case ID_PEN_COLOR:      success = ChooseColor(&chooseColorStructure);      if (success)      {        hPen = CreatePen(PS_SOLID, 1, chooseColorStructure.rgbResult);        viewController->setPen(hPen);      }      break;    case ID_BRUSH_COLOR:      success = ChooseColor(&chooseColorStructure);      if (success)      {        hBrush = CreateSolidBrush(chooseColorStructure.rgbResult);        viewController->setBrush(hBrush);      }      break;    case ID_PRINT:      {        PrintDlg(&printDialog);        HDC printerhDC = printDialog.hDC;        DOCINFO di = { sizeof (DOCINFO), _T("Printing...")};        StartDoc(printerhDC, &di);        StartPage(printerhDC);        viewController->Print(printerhDC);        EndPage(printerhDC);        EndDoc(printerhDC);        DeleteDC(printerhDC);//.........这里部分代码省略.........
开发者ID:ChCyrill,项目名称:BSUIR_labs,代码行数:101,


示例2: WDL_ChooseFileForSave

bool WDL_ChooseFileForSave(HWND parent,                                       const char *text,                                       const char *initialdir,                                       const char *initialfile,                                       const char *extlist,                                      const char *defext,                                      bool preservecwd,                                      char *fn,                                       int fnsize,                                      const char *dlgid,                                      void *dlgProc,#ifdef _WIN32                                      HINSTANCE hInstance#else                                      struct SWELL_DialogResourceIndex *reshead#endif                                      ){  char cwd[2048];  GetCurrentDirectory(sizeof(cwd),cwd);#ifdef _WIN32  char temp[4096];  memset(temp,0,sizeof(temp));  if (initialfile) lstrcpyn_safe(temp,initialfile,sizeof(temp));  WDL_fixfnforopenfn(temp);#ifdef WDL_FILEBROWSE_WIN7VISTAMODE  {    Win7FileDialog fd(text, 1);    if(fd.inited())    {      fd.addOptions(FOS_DONTADDTORECENT);      //vista+ file open dialog      char olddir[2048];      GetCurrentDirectory(sizeof(olddir),olddir);      fd.setFilterList(extlist);      if (defext)       {        fd.setDefaultExtension(defext);        int i = 0;        const char *p = extlist;        while(*p)        {          if(*p) p+=strlen(p)+1;          if(!*p) break;          if(stristr(p, defext))           {            fd.setFileTypeIndex(i+1);            break;          }          i++;          p+=strlen(p)+1;        }      }      fd.setFolder(initialdir?initialdir:olddir, 0);      if(initialfile)       {        //check for folder name        if (WDL_remove_filepart(temp))        {          //folder found          fd.setFolder(temp, 0);          fd.setFilename(temp + strlen(temp) + 1);        }        else          fd.setFilename(*temp ? temp : initialfile);      }      fd.setTemplate(hInstance, dlgid, (LPOFNHOOKPROC)dlgProc);            if(fd.show(parent))      {        //ifilesavedialog saves the last folder automatically        fd.getResult(fn, fnsize);                if (preservecwd) SetCurrentDirectory(olddir);        return true;      }            if (preservecwd) SetCurrentDirectory(olddir);      return NULL;    }  }#endif  OPENFILENAME l={sizeof(l),parent, hInstance, extlist, NULL,0, 0, temp, sizeof(temp)-1, NULL, 0, initialdir&&initialdir[0] ? initialdir : cwd, text,                   OFN_HIDEREADONLY|OFN_EXPLORER|OFN_OVERWRITEPROMPT,0,0,defext, 0, (LPOFNHOOKPROC)dlgProc, dlgid};  if (hInstance&&dlgProc&&dlgid) l.Flags |= OFN_ENABLEHOOK|OFN_ENABLETEMPLATE|OFN_ENABLESIZING;  if (preservecwd) l.Flags |= OFN_NOCHANGEDIR;  if (!GetSaveFileName(&l)||!temp[0])   {    if (preservecwd) SetCurrentDirectory(cwd);    return false;  }  if (preservecwd) SetCurrentDirectory(cwd);//.........这里部分代码省略.........
开发者ID:Nowhk,项目名称:wdl-ol,代码行数:101,


示例3: run

        virtual void run()        {            QString result;            QString workDir;            QString initSel;            QFileInfo fi (mStartWith);            if (fi.isDir())                workDir = mStartWith;            else            {                workDir = fi.absolutePath();                initSel = fi.fileName();            }            workDir = QDir::toNativeSeparators (workDir);            if (!workDir.endsWith ("//"))                workDir += "//";            QString title = mCaption.isNull() ? tr ("Select a file") : mCaption;            QWidget *topParent = windowManager().realParentWindow(mParent ? mParent : windowManager().mainWindowShown());            QString winFilters = winFilter (mFilters);            AssertCompile (sizeof (TCHAR) == sizeof (QChar));            TCHAR buf [1024];            if (initSel.length() > 0 && initSel.length() < sizeof (buf))                memcpy (buf, initSel.isNull() ? 0 : initSel.utf16(),                        (initSel.length() + 1) * sizeof (TCHAR));            else                buf [0] = 0;            OPENFILENAME ofn;            memset (&ofn, 0, sizeof (OPENFILENAME));            ofn.lStructSize = sizeof (OPENFILENAME);            ofn.hwndOwner = topParent ? topParent->winId() : 0;            ofn.lpstrFilter = (TCHAR *)(winFilters.isNull() ? 0 : winFilters.utf16());            ofn.lpstrFile = buf;            ofn.nMaxFile = sizeof (buf) - 1;            ofn.lpstrInitialDir = (TCHAR *)(workDir.isNull() ? 0 : workDir.utf16());            ofn.lpstrTitle = (TCHAR *)(title.isNull() ? 0 : title.utf16());            ofn.Flags = (OFN_NOCHANGEDIR | OFN_HIDEREADONLY |                         OFN_EXPLORER | OFN_ENABLEHOOK |                         OFN_NOTESTFILECREATE | (m_fConfirmOverwrite ? OFN_OVERWRITEPROMPT : 0));            ofn.lpfnHook = OFNHookProc;            if (GetSaveFileName (&ofn))            {                result = QString::fromUtf16 ((ushort *) ofn.lpstrFile);            }            // qt_win_eatMouseMove();            MSG msg = {0, 0, 0, 0, 0, 0, 0};            while (PeekMessage (&msg, 0, WM_MOUSEMOVE, WM_MOUSEMOVE, PM_REMOVE));            if (msg.message == WM_MOUSEMOVE)                PostMessage (msg.hwnd, msg.message, 0, msg.lParam);            result = result.isEmpty() ? result : QFileInfo (result).absoluteFilePath();            QApplication::postEvent (mTarget, new GetOpenFileNameEvent (result));        }
开发者ID:svn2github,项目名称:virtualbox,代码行数:62,


示例4: _T

BOOL CTTSApp::CallSaveFileDialog( __in LPTSTR szFileName, LPCTSTR szFilter )  ///////////////////////////////////////////////////////////////////// Display the save dialog box to save the wav file{    OPENFILENAME    ofn;    BOOL            bRetVal     = TRUE;    LONG            lRetVal;    HKEY            hkResult;    TCHAR           szPath[256]       = _T("");    DWORD           size = 256;    // Open the last directory used by this app (stored in registry)    lRetVal = RegCreateKeyEx( HKEY_CLASSES_ROOT, _T("PathTTSDataFiles"), 0, NULL, 0,                        KEY_ALL_ACCESS, NULL, &hkResult, NULL );    if( lRetVal == ERROR_SUCCESS )    {        RegQueryValueEx( hkResult, _T("TTSFiles"), NULL, NULL, (PBYTE)szPath, &size );            RegCloseKey( hkResult );    }    size_t ofnsize = (BYTE*)&ofn.lpTemplateName + sizeof(ofn.lpTemplateName) - (BYTE*)&ofn;    ZeroMemory( &ofn, ofnsize);    ofn.lStructSize       = (DWORD)ofnsize;    ofn.hwndOwner         = m_hWnd;        ofn.lpstrFilter       = szFilter;    ofn.lpstrCustomFilter = NULL;        ofn.nFilterIndex      = 1;        ofn.lpstrInitialDir   = szPath;    ofn.lpstrFile         = szFileName;      ofn.nMaxFile          = 256;    ofn.lpstrTitle        = NULL;    ofn.lpstrFileTitle    = NULL;        ofn.lpstrDefExt       = _T("wav");    ofn.Flags             = OFN_OVERWRITEPROMPT;    // Pop the dialog    bRetVal = GetSaveFileName( &ofn );    // Write the directory path you're in to the registry    TCHAR   pathstr[256] = _T("");    _tcscpy_s( pathstr, _countof(pathstr), szFileName );    if ( ofn.Flags & OFN_EXTENSIONDIFFERENT )    {        _tcscat_s( pathstr, _countof(pathstr), _T(".wav") );    }    int i=0;     while( pathstr[i] != NULL )    {        i++;    }    while( i > 0 && pathstr[i] != '//' )    {        i--;    }    pathstr[i] = NULL;    // Now write the string to the registry    lRetVal = RegCreateKeyEx( HKEY_CLASSES_ROOT, _T("PathTTSDataFiles"), 0, NULL, 0,                        KEY_ALL_ACCESS, NULL, &hkResult, NULL );    if( lRetVal == ERROR_SUCCESS )    {        RegSetValueEx( hkResult, _T("TTSFiles"), NULL, REG_EXPAND_SZ, (PBYTE)pathstr, (DWORD)_tcslen(pathstr)+1 );            RegCloseKey( hkResult );    }    return bRetVal;}
开发者ID:Essjay1,项目名称:Windows-classic-samples,代码行数:75,


示例5: Main_OnCommand

//.........这里部分代码省略.........			TCHAR leth[256],str4[256],str5[256];			wsprintf(str4,"status %s length",str3);						mciSendString(str4,leth,sizeof(leth)/sizeof(char),NULL);			int tminute,tsecond;			int totalsecond = atoi(leth)/1000;			tminute = totalsecond/60;			tsecond = totalsecond-tminute*60;			wsprintf(str5,"%02d:%02d",tminute,tsecond);			SetDlgItemText(hwnd,IDC_TIME,str5);			SendDlgItemMessage(hwnd,IDC_SLIDER2,TBM_SETRANGEMAX,false,(LPARAM)(totalsecond-1));			SendDlgItemMessage(hwnd,IDC_SLIDER2,TBM_SETRANGEMIN,false,(LPARAM)0);		}		case IDC_BUTTON9:		{			int loc;			HWND Combo1 = GetDlgItem(hwnd,IDC_LIST1);			int cixu = ListBox_GetCurSel(Combo1);			if(cixu==-1){				MessageBox(NULL,TEXT("无歌曲可保存"),TEXT("       重试"),MB_OK|MB_ICONEXCLAMATION);break;}			OPENFILENAME ofn;			char szFile[MAX_PATH];			ZeroMemory(&ofn,sizeof(ofn));			ofn.lStructSize = sizeof(ofn);			ofn.lpstrFile = szFile;			ofn.lpstrFile[0] = TEXT('/0');			ofn.nMaxFile = sizeof(szFile);			ofn.lpstrFilter = TEXT("mp3/0*.mp3/0AVI/0*.avi/0text/0*.txt/0");			ofn.nFilterIndex = 3;			ofn.lpstrFileTitle = NULL;			ofn.nMaxFileTitle = 0;			ofn.lpstrInitialDir = NULL;			ofn.hwndOwner = hwnd;			ofn.Flags = OFN_EXPLORER|OFN_PATHMUSTEXIST|OFN_FILEMUSTEXIST|OFN_ALLOWMULTISELECT;			if(GetSaveFileName(&ofn))			{												FILE *fp;				TCHAR EDI[256],str[256],str1[256];				wsprintf(str1,"%s.txt",szFile);				int count = ListBox_GetCount(Combo1);				fp = fopen(str1,"w");				for(loc=0;loc<count;loc++)				{					ListBox_GetText(Combo1,loc,EDI);					wsprintf(str,"%s/n",EDI);													fputs(str,fp);								}				fclose(fp);			}					}		break;		case IDC_GETLIST:		{			OPENFILENAME ofn;			char szFile[MAX_PATH];			ZeroMemory(&ofn,sizeof(ofn));			ofn.lStructSize = sizeof(ofn);			ofn.lpstrFile = szFile;			ofn.lpstrFile[0] = TEXT('/0');			ofn.nMaxFile = sizeof(szFile);			ofn.lpstrFilter = TEXT("mp3/0*.mp3/0AVI/0*.avi/0text/0*.txt/0");			ofn.nFilterIndex = 3;			ofn.lpstrFileTitle = NULL;			ofn.nMaxFileTitle = 0;
开发者ID:SummerInSun,项目名称:Music-Player,代码行数:67,


示例6: dlg

//.........这里部分代码省略.........   {      filterBuffer += wildDescriptions[i];      filterBuffer += wxT("|");      filterBuffer += wxT("*.*");      filterBuffer += wxT("|");   }      // Replace | with /0   for (i = 0; i < filterBuffer.Len(); i++ )   {      if ( filterBuffer.GetChar(i) == wxT('|') )      {         filterBuffer[i] = wxT('/0');      }   }      of.lpstrFilter  = (LPTSTR)filterBuffer.c_str();   of.nFilterIndex = m_filterIndex + 1;      ParseFilter(of.nFilterIndex);      //=== Setting defaultFileName >>=========================================      wxStrncpy( fileNameBuffer, (const wxChar *)m_fileName, wxMAXPATH-1 );   fileNameBuffer[ wxMAXPATH-1 ] = wxT('/0');      of.lpstrFile = fileNameBuffer;  // holds returned filename   of.nMaxFile  = wxMAXPATH;      // we must set the default extension because otherwise Windows would check   // for the existing of a wrong file with wxOVERWRITE_PROMPT (i.e. if the   // user types "foo" and the default extension is ".bar" we should force it   // to check for "foo.bar" existence and not "foo")   wxString defextBuffer; // we need it to be alive until GetSaveFileName()!   if (m_dialogStyle & wxSAVE && m_dialogStyle & wxOVERWRITE_PROMPT)   {      const wxChar* extension = filterBuffer;      int maxFilter = (int)(of.nFilterIndex*2L) - 1;            for( int i = 0; i < maxFilter; i++ )           // get extension         extension = extension + wxStrlen( extension ) + 1;            // use dummy name a to avoid assert in AppendExtension      defextBuffer = AppendExtension(wxT("a"), extension);      if (defextBuffer.StartsWith(wxT("a.")))      {         defextBuffer.Mid(2);         of.lpstrDefExt = defextBuffer.c_str();      }   }      // store off before the standard windows dialog can possibly change it    const wxString cwdOrig = wxGetCwd();       //== Execute FileDialog >>=================================================      bool success = (m_dialogStyle & wxSAVE ? GetSaveFileName(&of)                   : GetOpenFileName(&of)) != 0;   #ifdef __WXWINCE__   DWORD errCode = GetLastError();#else   DWORD errCode = CommDlgExtendedError();      // GetOpenFileName will always change the current working directory on    // (according to MSDN) "Windows NT 4.0/2000/XP" because the flag 
开发者ID:ruthmagnus,项目名称:audacity,代码行数:67,


示例7: switch

//.........这里部分代码省略.........            break;        case IDM_EDITCUT:            /* Copy */            SendMessage(WM_COMMAND, IDM_EDITCOPY, 0);            /* Delete selection */            SendMessage(WM_COMMAND, IDM_EDITDELETESELECTION, 0);            break;        case IDM_EDITPASTE:            OpenClipboard();            if (GetClipboardData(CF_BITMAP) != NULL)            {                InsertSelectionFromHBITMAP((HBITMAP) GetClipboardData(CF_BITMAP), m_hWnd);            }            CloseClipboard();            break;        case IDM_EDITDELETESELECTION:        {            /* remove selection window and already painted content using undo */            imageModel.Undo();            break;        }        case IDM_EDITSELECTALL:        {            HWND hToolbar = FindWindowEx(toolBoxContainer.m_hWnd, NULL, TOOLBARCLASSNAME, NULL);            SendMessage(hToolbar, TB_CHECKBUTTON, ID_RECTSEL, MAKELPARAM(TRUE, 0));            toolBoxContainer.SendMessage(WM_COMMAND, ID_RECTSEL);            //TODO: do this properly            startPaintingL(imageModel.GetDC(), 0, 0, paletteModel.GetFgColor(), paletteModel.GetBgColor());            whilePaintingL(imageModel.GetDC(), imageModel.GetWidth(), imageModel.GetHeight(), paletteModel.GetFgColor(), paletteModel.GetBgColor());            endPaintingL(imageModel.GetDC(), imageModel.GetWidth(), imageModel.GetHeight(), paletteModel.GetFgColor(), paletteModel.GetBgColor());            break;        }        case IDM_EDITCOPYTO:            if (GetSaveFileName(&ofn) != 0)                SaveDIBToFile(selectionModel.GetBitmap(), ofn.lpstrFile, imageModel.GetDC(), NULL, NULL, fileHPPM, fileVPPM);            break;        case IDM_EDITPASTEFROM:            if (GetOpenFileName(&ofn) != 0)            {                HBITMAP bmNew = NULL;                LoadDIBFromFile(&bmNew, ofn.lpstrFile, &fileTime, &fileSize, &fileHPPM, &fileVPPM);                if (bmNew != NULL)                {                    InsertSelectionFromHBITMAP(bmNew, m_hWnd);                    DeleteObject(bmNew);                }            }            break;        case IDM_COLORSEDITPALETTE:            if (ChooseColor(&choosecolor))                paletteModel.SetFgColor(choosecolor.rgbResult);            break;        case IDM_COLORSMODERNPALETTE:            paletteModel.SelectPalette(1);            break;        case IDM_COLORSOLDPALETTE:            paletteModel.SelectPalette(2);            break;        case IDM_IMAGEINVERTCOLORS:        {            imageModel.InvertColors();            break;        }        case IDM_IMAGEDELETEIMAGE:            imageModel.CopyPrevious();            Rect(imageModel.GetDC(), 0, 0, imageModel.GetWidth(), imageModel.GetHeight(), paletteModel.GetBgColor(), paletteModel.GetBgColor(), 0, TRUE);
开发者ID:GYGit,项目名称:reactos,代码行数:67,


示例8: utf8str_to_utf16str

//.........这里部分代码省略.........		{			wcsncpy( mFilesW,L"untitled.undershirt", FILENAME_BUFFER_SIZE);		}		mOFN.lpstrDefExt = L"undershirt";		mOFN.lpstrFilter =			L"Undershirts (*.undershirt)/0*.undershirt/0" /			L"/0";		break;	case FFSAVE_UNDERPANTS:		if(filename.empty())		{			wcsncpy( mFilesW,L"untitled.underpants", FILENAME_BUFFER_SIZE);		}		mOFN.lpstrDefExt = L"underpants";		mOFN.lpstrFilter =			L"Underpants (*.underpants)/0*.underpants/0" /			L"/0";		break;	case FFSAVE_SKIRT:		if(filename.empty())		{			wcsncpy( mFilesW,L"untitled.skirt", FILENAME_BUFFER_SIZE);		}		mOFN.lpstrDefExt = L"skirt";		mOFN.lpstrFilter =			L"Skirts (*.skirt)/0*.skirt/0" /			L"/0";		break;	case FFSAVE_LANDMARK:		if(filename.empty())		{			wcsncpy( mFilesW,L"untitled.landmark", FILENAME_BUFFER_SIZE);		}		mOFN.lpstrDefExt = L"landmark";		mOFN.lpstrFilter =			L"Landmarks (*.landmark)/0*.landmark/0" /			L"/0";		break;	case FFSAVE_AO:		if(filename.empty())		{			wcsncpy( mFilesW,L"untitled.ao", FILENAME_BUFFER_SIZE);		}		mOFN.lpstrDefExt = L"ao";		mOFN.lpstrFilter =			L"Animation overrides (*.ao)/0*.ao/0" /			L"/0";		break;	case FFSAVE_INVGZ:		if(filename.empty())		{			wcsncpy( mFilesW,L"untitled.inv", FILENAME_BUFFER_SIZE);		}		mOFN.lpstrDefExt = L".inv";		mOFN.lpstrFilter =			L"InvCache (*.inv)/0*.inv/0" /			L"/0";		break;	case FFSAVE_BLACKLIST:		if(filename.empty())		{			wcsncpy( mFilesW,L"untitled.blacklist", FILENAME_BUFFER_SIZE);		}		mOFN.lpstrDefExt = L".blacklist";		mOFN.lpstrFilter =			L"Asset Blacklists (*.blacklist)/0*.blacklist/0" /			L"/0";		break;	case FFSAVE_PHYSICS:		if(filename.empty())		{			wcsncpy( mFilesW,L"untitled.phy", FILENAME_BUFFER_SIZE);		}		mOFN.lpstrDefExt = L"phy";		mOFN.lpstrFilter =			L"Landmarks (*.phy)/0*.phy/0" /			L"/0";		break;	// </edit>	default:		return FALSE;	} 	mOFN.nMaxFile = SINGLE_FILENAME_BUFFER_SIZE;	mOFN.Flags = OFN_OVERWRITEPROMPT | OFN_NOCHANGEDIR | OFN_PATHMUSTEXIST;	reset();	{		// NOTA BENE: hitting the file dialog triggers a window focus event, destroying the selection manager!!		success = GetSaveFileName(&mOFN);		if (success)		{			std::string filename = utf16str_to_utf8str(llutf16string(mFilesW));			mFiles.push_back(filename);		}	}	return success;}
开发者ID:NickyPerian,项目名称:SingularityViewer,代码行数:101,


示例9: menu

void menu(CBTYPE cbType, void* arg1){    PLUG_CB_MENUENTRY* info = (PLUG_CB_MENUENTRY*)arg1;    if(info->hEntry == 1)    {        // get patch information        size_t buffersize;        size_t numPatches;        std::unique_ptr<DBGPATCHINFO> patchList(nullptr);        if(!(patchList = EnumPatches(buffersize, numPatches)))            return;        // browse        OPENFILENAME browse;        memset(&browse, 0, sizeof(browse));        browse.lStructSize = sizeof(browse);        browse.hwndOwner = hwndDlg;        browse.hInstance = hModule;        wchar_t filter[512];        memset(filter, 0, sizeof(filter));        memset(templatename, 0, sizeof(templatename));        memset(exportedname, 0, sizeof(exportedname));        LoadString(hModule, IDS_FILTER, filter, 512);        for(size_t i = 0; i < _countof(filter); i++)        {            if(filter[i] == '|')                filter[i] = '/0';        }        browse.lpstrFilter = filter;        browse.nFilterIndex = 1;        browse.lpstrFile = templatename;        browse.lpstrFileTitle = nullptr;        browse.nMaxFile = 512;        browse.Flags = OFN_FILEMUSTEXIST;        if(GetOpenFileName(&browse) == 0)            return;        std::wstring templateContent = LoadFile(templatename);        std::wstring filterString = getTemplateFilter(templateContent);        browse.lpstrFile = exportedname;        browse.lpstrFilter = filterString.c_str();        browse.Flags = OFN_OVERWRITEPROMPT;        if(GetSaveFileName(&browse) == 0)            return;        // export patches        ExportPatch(templateContent, patchList.get(), numPatches);    }    else if(info->hEntry == 2)    {        // get patch information        size_t buffersize;        size_t numPatches;        std::unique_ptr<DBGPATCHINFO> patchList(nullptr);        if(!(patchList = EnumPatches(buffersize, numPatches)))            return;        // check last template        if(wcslen(templatename) == 0)        {            MessageBox(hwndDlg, LoadWideString(IDS_NOLASTTEMPLATE).c_str(), LoadWideString(IDS_PLUGNAME).c_str(), MB_ICONERROR);            return;        }        std::wstring templateContent = LoadFile(templatename);        // browse        OPENFILENAME browse;        memset(&browse, 0, sizeof(browse));        browse.lStructSize = sizeof(browse);        browse.hwndOwner = hwndDlg;        browse.hInstance = hModule;        wchar_t filter[512];        memset(filter, 0, sizeof(filter));        memset(exportedname, 0, sizeof(exportedname));        LoadString(hModule, IDS_FILTER, filter, 512);        for(size_t i = 0; i < _countof(filter); i++)        {            if(filter[i] == '|')                filter[i] = '/0';        }        std::wstring filterString = getTemplateFilter(templateContent);        browse.lpstrFile = exportedname;        browse.lpstrFilter = filterString.c_str();        browse.nFilterIndex = 1;        browse.lpstrFileTitle = nullptr;        browse.nMaxFile = 512;        browse.lpstrFile = exportedname;        browse.Flags = OFN_OVERWRITEPROMPT;        if(GetSaveFileName(&browse) == 0)            return;        // export patches        ExportPatch(templateContent, patchList.get(), numPatches);    }    else if(info->hEntry == 3)    {        std::wstring text = LoadWideString(IDS_ABOUT);        std::wstring compiledate;        std::string compiledateASCII(__DATE__);        utf8::utf8to16(compiledateASCII.begin(), compiledateASCII.end(), std::back_inserter(compiledate));        ReplaceWString(text, L"$compiledate", compiledate);        MessageBox(hwndDlg, text.c_str(), LoadWideString(IDS_PLUGNAME).c_str(), MB_OK);    }    else    {        __debugbreak();//.........这里部分代码省略.........
开发者ID:blaquee,项目名称:x64dbgpatchexporter,代码行数:101,


示例10: WMCommandProc

LRESULT 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);      // Ignore if the dialog is in the process of being created      if (g_done || 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);//.........这里部分代码省略.........
开发者ID:kichik,项目名称:nsis-1,代码行数:101,


示例11: DraughtItemExport

万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。