?
Solved

Print Screen FCN in Borland C++ Builder

Posted on 1998-06-15
5
Medium Priority
?
512 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 23

Accepted Solution

by:
chensu earned 200 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
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.
Suggested Courses

765 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