Click here to Skip to main content
11,934,389 members (62,982 online)
Rate this:
Please Sign up or sign in to vote.
See more: C++ MFC COM ActiveX

I want to draw an ActiveX (mschrt20.ocx) inside the OnDraw method in my custom ActiveX made in (C++/VS2010).

Someone have a clue on that?
Posted 8-Apr-13 7:36am
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

You need a member and method(s) that point to the mschrt20.ocx functions within the mschrt20.ocx module within your module's code. Also you will need to include mschrt20.h in your header file for you module. Then in your OnDraw() use the methods and member, that is in your header file of your OCX file.
Pedro Lacerda 9-Apr-13 7:02am
Alright, Thanks! I've done that, but the problem is i still getting problem in attach the CDC* from the mschrt20.ocx to my OnDraw(), i'm really lost in MFC/ActiveX programming, but maybe i just need a piece of code on that to get the things moving again.
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

Presuming you have a:

CDC* m_pchrtMyChart;
in your code then all you should have to do is:

m_pchrtMyChart = mschrt20obj.m_pchrtObj
or something to that extent. Often there is a HANDLE involved in order to transfer information about the object. It is a lot like using Bitmaps.
Rate this: bad
Please Sign up or sign in to vote.

Solution 3

Thank you for your time The_Inventor!

I've got the problem solved by adding the chart in a IDD_DIALOG
and attaching it to the ActiveX. But the ActiveX must be enabled for control container,
and the dialog must have a bunch of flags setted.

More Info


This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web04 | 2.8.151126.1 | Last Updated 11 Apr 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100