OberonPlace.com Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 12-05-2009, 00:36
dartmerc
Guest
 
Posts: n/a
Default Executing and accessing CorelDraw12 through C# application

Hey guys, I've finally found my way back here after a long break (and oddly I've had to reregister) - took me a while to remember the web address, but I'm glad I did.


I'm attempting to write a program that, among other things, opens CorelDraw12, opens some files then resaves/exports them in a different format.
My issue is, how do I launch CorelDraw12 AND gain access to it through my C# code?

So far I've added reference to the 'Corel - CorelDRAW 12.0 Library' COM component and have attempted the following code:

Code:
CorelDRAW.ApplicationClass Draw = new CorelDRAW.ApplicationClass();
OR

Code:
CorelDRAW.Application Draw = new CorelDRAW.Application();
OR

Code:
CorelDRAW.Application Draw = new CorelDRAW.ApplicationClass();
All of these lines execute and CorelDraw launches, but whenever I attempt to do anything with Draw (eg: MessageBox.Show(Draw.Name.ToString()) I receive the following error:

Unable to cast COM object of type 'CorelDRAW.ApplicationClass' to interface type 'CorelDRAW.IDrawApplication'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{398C0002-8D24-11D2-89E7-0000861EBBD6}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).

Can anyone offer me any assistance?
Thanks a lot for your time!
Reply With Quote
  #2  
Old 13-05-2009, 17:22
dartmerc
Guest
 
Posts: n/a
Default

I have also attempted
Code:
CorelDRAW.Application Draw = new CorelDRAW.ApplicationClass();
as suggested in this thread, and receive the same error.
I'm guessing this could be a more general problem, but I haven't had any luck with google - if anyone can give me a tip what to search for that would also be helpful.
Reply With Quote
  #3  
Old 14-05-2009, 18:14
dartmerc
Guest
 
Posts: n/a
Smile

Hey again guys, I posted over at the CorelDraw forums and managed to get a solution that I thought I would share.

The test code I used was:
Code:
            CorelDRAW.Application Draw = new CorelDRAW.Application();
            Draw.Visible = true;
            Draw.CreateDocument();
            Draw.ActiveLayer.CreateEllipse(0, 0, 10, 10, 90, 90, false);
In order to make it run correctly, I had to use REGTLIB (C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\regtlibv12.exe in XP) to register the CorelDraw type library (C:\Program Files\Corel\Corel Graphics 12\Programs\CorelDraw.tlb).
After this, the code ran successfuly.

Hopefully this solution helps others in the future.
I'm no good with wikis, but if someone could post this in the dev wiki I think it would be a useful addition.
Reply With Quote
Reply


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
draw12... Accessing windows explorer xombie CorelDRAW/Corel DESIGNER VBA 2 06-07-2006 12:48
Has anybody has this message ever? A problem occurred accessing memory. mecanomaniaco Corel Photo-Paint VBA 0 18-05-2006 11:06
Accessing .Cost & .Comments in Object Data ghamor CorelDRAW/Corel DESIGNER VBA 2 06-03-2006 10:50
How can I put Windows Calculator to CorelDraw12 toolbar Vlada General 2 14-02-2006 12:06
Need help accessing objects in a group ama CorelDRAW/Corel DESIGNER VBA 5 20-02-2004 11:28


All times are GMT -5. The time now is 00:19.


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