![]() |
|
#1
|
|||
|
|||
|
Hi,
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? andrej |
|
#2
|
||||
|
||||
|
Andrej,
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: Code:
#import "coreldrw110.tlb" no_namespace named_guids Code:
try
{
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);
}
Last edited by Alex; 30-05-2005 at 09:28. |
|
#3
|
|||
|
|||
|
Thanks lot, that's what i need...
|
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
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 |