OberonPlace.com Forums  

Go Back   OberonPlace.com Forums > Developer Forums > VBA > CorelDRAW/Corel DESIGNER VBA

Thread Tools Search this Thread Display Modes
Old 15-04-2003, 08:42
Posts: n/a
Default How can i make a CorelDraw addin under Visual C++

I have found on this page a great example for creating an addin under Visual Basic (CropMarks), it works perfectly, but i want to make something bigger and I don't think that I'm able to make it under Visual Basic, so I work on it to make it under Visual C++. Can you please help me?

Reply With Quote
Old 15-04-2003, 09:05
Alex's Avatar
Alex Alex is offline
Join Date: Nov 2002
Posts: 1,940
Blog Entries: 4
Default Re: How can i make a CorelDraw addin under Visual C++


Personally I wouldn't bother with creating an addin. It has way too many limitations (you can't add it to a toolbar, or anywhere in the menu except for the default location under Tools>Visual Basic>Addins). Instead, create an EXE or DLL in C++ and have a macro (in a separate GMS file) invoke it. By doing this, you can add the macro to a toolbar and still have the full control from C++. Personally I would go with the DLL approach because when you call the DLL from VBA, your code will run in CorelDRAW process' address space which will make it run much faster (due to data marshaling when calling from out-of-process).

But either way it should be pretty straight forward to control CorelDRAW from a C++ program.

I find that VC++ #import approach is the easiest.

Just copy the Coreldrw110.tlb into the same project folder where your application sources are and then add the following directive at the top of your CPP file:

#import "coreldrw110.tlb" no_namespace named_guids
This will generate a lot of helper classes for all CorelDRAW's classes. You then can start working with them like this:

  IDrawApplicationPtr app(CLSID_Application);
  IDrawDocumentPtr doc = app->CreateDocument();
  IDrawShapePtr s = doc->ActiveLayer->CreateEllipse2(2, 2, 1, 0, 90, 90, VARIANT_FALSE);
  s->Fill->UniformColor->RGBAssign(255, 0, 0);
catch(_com_error &e)
  MessageBox(e.ErrorMessage(), "Error", MB_OK | MB_ICONSTOP);
You see that it is quite the same as in VBA.

Last edited by Alex; 30-05-2005 at 09:28.
Reply With Quote
Old 15-04-2003, 09:40
Posts: n/a

Thanks lot, that's what i need...
Reply With Quote

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
run macro at start up Corel 11 ???? -=HKLC=- CorelDRAW/Corel DESIGNER VBA 14 30-10-2004 09:29
Preview from CorelDRAW file and/or worksheet reanan CorelDRAW/Corel DESIGNER VBA 5 15-05-2003 18:29
takes Draw a long time to start a new document! bbolte CorelDRAW/Corel DESIGNER VBA 5 14-05-2003 09:09
Creating macros for CorelDraw 10 in CorelDraw 11 Rick Randall CorelDRAW/Corel DESIGNER VBA 1 14-03-2003 08:00
CorelDRAW 11 and AddIn’s reanan CorelDRAW/Corel DESIGNER VBA 2 03-12-2002 14:21

All times are GMT -5. The time now is 02:40.

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright © 2011, Oberonplace.com