Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Initialize DEVMODE struct

Status
Not open for further replies.

sgk17

Technical User
Nov 8, 2002
68
US
Hi, I don't know anything about Windows programming but I need to show a print dialog and get the users selections. I'm using the PrintDlg function that takes a PRINTDLG struct as a parameter. When the PrintDlg function returns it will populate the PRINTDLG struct according to the user's choices. A field in the PRINTDLG struct is:
HANDLE hDevMode
It is defined as: Identifies a movable global memory object that contains a DEVMODE structure.
What I want to do is get the values from that field and plug them into a local DEVMODE variable.
Ex.
myDevMode.dmCopies = PRINTDLG.hDevMode.dmCopies;
Obviously the syntax isn't correct - that's what I need help with. Thanks.
 
Ok so here's what I have so far. I found some sample code:

PRINTDLG pd;
DEVMODE dm;
.
.
dm = (DEVMODE)GlobalLock(pd.hDevMode);
That's the code that was shown. Only when I try it I get the following error: error C2440: 'type cast' : cannot convert from 'void *' to 'struct _devicemodeA'
No constructor could take the source type, or constructor overload resolution was ambiguous

How can I cast it then?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top