Solved

Print OCX Control

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

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

This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
In this post we will learn different types of Android Layout and some basics of an Android App.
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.
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

696 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