当前位置: 首页>>代码示例>>C++>>正文


C++ CommDlgExtendedError函数代码示例

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


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

示例1: MCA_color

// MW-2005-05-15: Updated for new answer command restructuring
bool 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,代码来源:w32ans.cpp

示例2: wcscpy_s

std::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,代码来源:PlayerFileDialogServiceWin.cpp

示例3: ZeroMemory

void 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,代码来源:PECheckSumCalcDlg.cpp

示例4: DumpProcess

bool 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,代码来源:gisnap.cpp

示例5: chooseprinter

static 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,代码来源:printer.c

示例6: psd

void 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,代码来源:cpagesetupdialog-class_1.cpp

示例7: ExportFile

VOID 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,代码来源:export.c

示例8: CallFileRequester

void 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,代码来源:WinGUI.cpp

示例9: fd

void 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,代码来源:MixereView.cpp

示例10: strstr

bool 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,代码来源:FileSystem.cpp

示例11: VERIFY

bool 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,代码来源:FileSystem.cpp

示例12: WX_HOOK_MODAL_DIALOG

int 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,代码来源:colordlg.cpp

示例13: BB_log

fileData* 
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,代码来源:audicle_utils.cpp

示例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,代码来源:printdlg.c

示例15: WMCommandProc

LRESULT 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,代码来源:InstallerOptions.cpp


注:本文中的CommDlgExtendedError函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。