Solved

Print OCX Control

Posted on 1997-08-18
3
237 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
Comment Utility
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
Comment Utility
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
Comment Utility
OnDraw(..)
{
    HWND hWnd;
   // use  IOleWindow::GetWindow( HWND )
    pIOleWindow->GetWindow( &hWnd );
   HDC hDC = ::GetWindowDC( hWnd );
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
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.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

763 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

10 Experts available now in Live!

Get 1:1 Help Now