本文整理汇总了C++中KFileDialog::GetOpenFileName方法的典型用法代码示例。如果您正苦于以下问题:C++ KFileDialog::GetOpenFileName方法的具体用法?C++ KFileDialog::GetOpenFileName怎么用?C++ KFileDialog::GetOpenFileName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KFileDialog
的用法示例。
在下文中一共展示了KFileDialog::GetOpenFileName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QueryOpenEMFFile
HENHMETAFILE QueryOpenEMFFile(TCHAR szFileName[])
{
KFileDialog fd;
if ( fd.GetOpenFileName(NULL, _T("emf|spl"), _T("Enhanced Metafiles|Win NT/2000 EMF Spool Files")) )
{
if ( szFileName )
_tcscpy(szFileName, fd.m_TitleName);
return GetEnhMetaFile(fd.m_TitleName);
}
else
return NULL;
}
示例2: Demo_WritePort
void Demo_WritePort(void)
{
KFileDialog fd;
if ( fd.GetOpenFileName(NULL, "prn", "Raw printer data") )
{
HANDLE hPort = CreateFile("lpt1:", GENERIC_WRITE, FILE_SHARE_READ,
NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if ( hPort!=INVALID_HANDLE_VALUE )
{
SendFile(hPort, fd.m_TitleName, false);
CloseHandle(hPort);
}
}
}
示例3: Demo_WritePrinter
void Demo_WritePrinter(void)
{
PRINTDLG pd;
memset(&pd, 0, sizeof(PRINTDLG));
pd.lStructSize = sizeof(PRINTDLG);
if ( PrintDlg(&pd)==IDOK )
{
HANDLE hPrinter;
DEVMODE * pDevMode = (DEVMODE *) GlobalLock(pd.hDevMode);
PRINTER_DEFAULTS prn;
prn.pDatatype = "NT EMF 1.008";
prn.pDevMode = pDevMode;
prn.DesiredAccess = PRINTER_ACCESS_USE;
if ( OpenPrinter((char *) pDevMode->dmDeviceName, & hPrinter, & prn) )
{
KFileDialog fd;
if ( fd.GetOpenFileName(NULL, "spl", "Windows 2000 EMF Spool file") )
{
DOC_INFO_1 docinfo;
docinfo.pDocName = "Testing WritePrinter";
docinfo.pOutputFile = NULL;
docinfo.pDatatype = "NT EMF 1.008";
StartDocPrinter(hPrinter, 1, (BYTE *) & docinfo);
StartPagePrinter(hPrinter);
SendFile(hPrinter, fd.m_TitleName, true);
EndPagePrinter(hPrinter);
EndDocPrinter(hPrinter);
}
ClosePrinter(hPrinter);
}
if ( pd.hDevMode ) GlobalFree(pd.hDevMode);
if ( pd.hDevNames ) GlobalFree(pd.hDevNames);
}
}