Solved

Print OCX Control

Posted on 1997-08-18
3
249 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
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.
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

756 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