Solved

Print Screen FCN in Borland C++ Builder

Posted on 1998-06-15
5
497 Views
Last Modified: 2012-08-14
My users requested a screen print function in the Application that I created for them.  How can
I implement this??
0
Comment
Question by:cwilliso
  • 3
  • 2
5 Comments
 
LVL 23

Accepted Solution

by:
chensu earned 100 total points
ID: 1165972
If you want to print your own window:

1. Use PrintDlg function to display a Print dialog box and get the DC of the selected printer.
2. Send the WM_PRINT or WM_PRINTCLIENT messages with the printer DC to your window.


If you want to print the full screen:

Check out the Win32 SDK sample "Wincap32: Window Screen Capture". The Wincap32 sample captures portions of the screen, specific windows, or the entire screen and saves it to a file or prints it. The sample uses DIB functions to do most of the capturing, printing, and saving.

0
 

Author Comment

by:cwilliso
ID: 1165973
any sample code??  It could be any application -- It would all be the same code to
print out the application's client area.  I don't have much time, unfortunately.
Can't find a Property or Method to get the DC of the printer.  How to send a WM_PRINT
message to the main application window?
0
 
LVL 23

Expert Comment

by:chensu
ID: 1165974
>Can't find a Property or Method to get the DC of the printer.

Look into the Win32 SDK sample "Printer: Printing". The Printer sample shows how to print using both the CreateDC and the PrinterDlg methods for acquiring a printer HDC.

>How to send a WM_PRINT message to the main application window?

It is just like a normal message. Use PostMessage or SendMessage with the window handle, HDC and the flags.
0
 

Author Comment

by:cwilliso
ID: 1165975
The actual answer is:

this->Print();
0
 
LVL 23

Expert Comment

by:chensu
ID: 1165976
I am not familiar with Borland C++ Builder. But I am sure this->Print() actually sends the WM_PRINT message. MFC also has a member function CWnd::Print, which wraps the WM_PRINT message.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now