CPrintDialog dlg(FALSE);
// Retrieve the current printer defaults from the Windows .ini file
// as necessary, or uses the last printer configuration set by the
// user in Print Setup.
CWinApp* app = AfxGetApp();
if (!app->GetPrinterDeviceDefaults(&dlg.m_pd))
{
// Fails to create a printer device context for printing because
// no printer is being installed. Bring up dialog box to alert the
// users that they need to install a printer. This step is optional.
if (app->DoPrintDialog(&dlg) != IDOK)
return FALSE;
}
这段代码,获取系统缺省打印机,大多时候都很快,但是有时候耗时很久(10秒-50秒+不等),不知道什么原因啊???
// Retrieve the current printer defaults from the Windows .ini file
// as necessary, or uses the last printer configuration set by the
// user in Print Setup.
CWinApp* app = AfxGetApp();
if (!app->GetPrinterDeviceDefaults(&dlg.m_pd))
{
// Fails to create a printer device context for printing because
// no printer is being installed. Bring up dialog box to alert the
// users that they need to install a printer. This step is optional.
if (app->DoPrintDialog(&dlg) != IDOK)
return FALSE;
}
这段代码,获取系统缺省打印机,大多时候都很快,但是有时候耗时很久(10秒-50秒+不等),不知道什么原因啊???
解决方案 »
- 粘贴notes文本内容到RicheditCtrl中,内容前面会自动增加字体名称
- 菜单消息
- 如何设置窗体(如按钮等等)上面字体及大小
- 请问在ActiveX里面创建线程在理论上有什么缺陷吗,可以被提倡吗
- 实在找不到资料学习OLEDB模板访问数据,恳请告之!!!!!!!
- 属性页问题,疑惑中.......
- 请问有谁用过vc下的dos命令没?如何将def文件换成库文件?多谢!
- 怎样获得另一个应用程序中的信息?
- 那位老兄晓得.nlc的文件用什么打开工具打开,,兄弟下了本书,扩展名是nlc
- 基于对话框或(CFormView)的应用程序,怎样从电脑中加入一张bmp图片,并且在图像控件中显示?
- SetTimer的问题
- 通过winio读取CPU温度的问题 希望指点
{
PRINTDLG pd;
pd.lStructSize=(DWORD)sizeof(PRINTDLG);
BOOL bRet=GetPrinterDeviceDefaults(&pd);
if(bRet)
{
// protect memory handle with ::GlobalLock and ::GlobalUnlock
DEVMODE FAR *pDevMode=(DEVMODE FAR *)::GlobalLock(m_hDevMode);
// set orientation to landscape
pDevMode->dmOrientation=DMORIENT_LANDSCAPE;
::GlobalUnlock(m_hDevMode);
}
}