How to get HDC object of Printer

  • Thread starter Thread starter °Ë´óɽÈË
  • Start date Start date
°

°Ë´óɽÈË

Since I need to call Windows API GetDeviceCaps() in C#, I must get HDC
object of printer. And I don't like to receive the PrintPage Event because I
don't
want to print the page, just to get some properties. How can I get it? Thank
you!

Jerry
 
Jerry,

In order to get the DC of the printer, you will have to call the
CreateDC function through the P/Invoke layer. You can pass the display name
of the printer to the lpszDevice parameter.

Hope this helps.
 
Hi, can you tell me how to pass the parameter lpzsDriver?

Nicholas Paldino said:
Jerry,

In order to get the DC of the printer, you will have to call the
CreateDC function through the P/Invoke layer. You can pass the display name
of the printer to the lpszDevice parameter.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

°Ë´óɽÈË said:
Since I need to call Windows API GetDeviceCaps() in C#, I must get HDC
object of printer. And I don't like to receive the PrintPage Event
because
I
don't
want to print the page, just to get some properties. How can I get it? Thank
you!

Jerry
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top