General discussion

Locked

Printing with C++ and Win32 API

By valager ·
My program prints texts with graphics and so on. I need to change some printing attributes manually by program before print. This attributes is paper size, orientation, margins and so on.

So, I'll describe what I am using for that and what I am thinking about all it.

So, what I am doing to print.

1 way:

I am initializing PRINTDLG structure with some attribures

PRINTDLG pd;

.
. initialization
.

and then I am calling PrintDlg(&pd); It gives me print context in pd.hDC and I can print. To change some attributes in this way I need to initialize hDevMode member of PRINTDLG structure. It's declared as HANDLE hDevMode. It's a global handle to DEVMODE structure consists of print attributes. But I can't do it. If I'll find answer, how to initialize this member, I will partially solve my problem.

That way can give me ability to change paper size and orientation. But I also want to change margins.....

2 way

I am initializing PAGESETUPDLG structure

PAGESETUPDLG ps;
.
. initializati

This conversation is currently closed to new comments.

5 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

Printing with C++ and Win32 API

by Wayne M. In reply to Printing with C++ and Win ...

I was able to do some similar things with MSWord using the system EnumPrinters() call.

If you get a PRINTER_INFO_2 structure, it has a pointer to a DEVMODE structure which you can modify. I *think* you should be able to use this, but I haven'tdone it using straight Windows APIs, just the Word APIs.

I hope this helps.
Wayne

Collapse -

Printing with C++ and Win32 API

by valager In reply to Printing with C++ and Win ...

The question was auto-closed by TechRepublic

Collapse -

Printing with C++ and Win32 API

by TechAdmin In reply to Printing with C++ and Win ...

If you solve that question, you should close it.

Collapse -

Printing with C++ and Win32 API

by valager In reply to Printing with C++ and Win ...

The question was auto-closed by TechRepublic

Collapse -

Printing with C++ and Win32 API

by valager In reply to Printing with C++ and Win ...

This question was auto closed due to inactivity

Back to Web Development Forum
5 total posts (Page 1 of 1)  

Related Discussions

Related Forums