'how to use hDevMode from PRINTDLGA
how to cast HGLOBAL to DEVMODE? I tried like this:
PRINTDLG pd;
pd.hDevMode = NULL;
if(PrintDlg(&pd)){
DEVMODE* test=(DEVMODE*)pd.hDevMode;
Solution 1:[1]
Per the PRINTDLGA documentation:
hDevModeType:
HGLOBALA handle to a movable global memory object that contains a
DEVMODEstructure.
So, use GlobalLock() to access the DEVMODE, eg:
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);
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Remy Lebeau |
