Solved

Print OCX Control

Posted on 1997-08-18
3
246 Views
Last Modified: 2013-11-19
Howdy,
I'm working on an MDI app, in which I use a Graph .OCX control (Lite Graph Control from BitsPerSecond). I want to be able to print a document with a graph and other stuff in it. If I use the .OCX control's printing functionality I only get the graph on the paper, when I try to print.
I want to know how to get the device context of the control,that is, how to solve the problem that occurs when I try a call like:
pDC -> MyOcx.MyFunction(); in the OnDraw function, which seems to be a common way to solve problems like this otherwise.
The result of this is "error:MyOcx is not a member of CDC".
If anyone knows how to deal with my problem, please give it a try.

thanks alot,
Jan Allen
0
Comment
Question by:Jalle
  • 2
3 Comments
 
LVL 8

Accepted Solution

by:
gelbert earned 100 total points
ID: 1304094
You are right that OnDraw in your container application is right place to do it. But you have to get window handle of the control window (check OCX standard interfaces, I just do not remember which one returns it) first and then call API function GetWindowDC().
0
 

Author Comment

by:Jalle
ID: 1304095
I'm missing something major here.
Can you please give an example (with the grid control or something).
0
 
LVL 8

Expert Comment

by:gelbert
ID: 1304096
OnDraw(..)
{
    HWND hWnd;
   // use  IOleWindow::GetWindow( HWND )
    pIOleWindow->GetWindow( &hWnd );
   HDC hDC = ::GetWindowDC( hWnd );
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Suggested Solutions

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

810 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