?
Solved

Print OCX Control

Posted on 1997-08-18
3
Medium Priority
?
258 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
[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
  • 2
3 Comments
 
LVL 8

Accepted Solution

by:
gelbert earned 300 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
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…
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.
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Suggested Courses

800 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