Solved

Print Screen FCN in Borland C++ Builder

Posted on 1998-06-15
5
501 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.

910 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

21 Experts available now in Live!

Get 1:1 Help Now