如何使用 PRINTDLGA 中的 hDevMode
how to use hDevMode from PRINTDLGA
如何将HGLOBAL转为DEVMODE?我这样试过:
PRINTDLG pd;
pd.hDevMode = NULL;
if(PrintDlg(&pd)){
DEVMODE* test=(DEVMODE*)pd.hDevMode;
根据 PRINTDLGA
文档:
hDevMode
Type: HGLOBAL
A handle to a movable global memory object that contains a DEVMODE
structure.
所以,使用GlobalLock()
访问DEVMODE
,例如:
PRINTDLG pd = {};
pd.lStructSize = sizeof(pd);
...
if (PrintDlg(&pd)){
DEVMODE* test = (DEVMODE*) GlobalLock(pd.hDevMode);
// use test as needed...
GlobalUnlock(pd.hDevMode);
GlobalFree(pd.hDevMode);
}
如何将HGLOBAL转为DEVMODE?我这样试过:
PRINTDLG pd;
pd.hDevMode = NULL;
if(PrintDlg(&pd)){
DEVMODE* test=(DEVMODE*)pd.hDevMode;
根据 PRINTDLGA
文档:
hDevMode
Type:
HGLOBAL
A handle to a movable global memory object that contains a
DEVMODE
structure.
所以,使用GlobalLock()
访问DEVMODE
,例如:
PRINTDLG pd = {};
pd.lStructSize = sizeof(pd);
...
if (PrintDlg(&pd)){
DEVMODE* test = (DEVMODE*) GlobalLock(pd.hDevMode);
// use test as needed...
GlobalUnlock(pd.hDevMode);
GlobalFree(pd.hDevMode);
}