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 30-06-2006, 15:56
jabky
Guest
 
Posts: n/a
Default Run macro from VB.Net 2005

I am trying to run a macro from VB.net 2005 and I am getting the following error:
Retrieving the COM class factory for component with CLSID {4A110034-2109-4B5D-BC63-17AE8914E384} failed due to the following error: 80040154.
I have stripped out everything from the code except the following:

Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim myGMS As CorelDRAW.GMSManager
myGMS = New CorelDRAW.GMSManager
End Sub
End Class

If I comment out the myGMS = New CorelDRAW.GMSManager line, it does not throw the error.

Anyone know what may be causing this?
Reply With Quote
  #2  
Old 30-06-2006, 17:45
shelbym's Avatar
shelbym shelbym is offline
Senior Member
 
Join Date: Nov 2002
Location: Cheyenne, WY
Posts: 1,782
Blog Entries: 11
Send a message via ICQ to shelbym Send a message via AIM to shelbym Send a message via MSN to shelbym Send a message via Yahoo to shelbym
Default .Net

Take a look at this post by Alex, I think it might be your problem.

http://forum.oberonplace.com/showpos...59&postcount=2

Hope it helps,

Shelby
Reply With Quote
  #3  
Old 04-07-2006, 07:40
jabky
Guest
 
Posts: n/a
Default

Thanks Shelby for the reply. I saw the post Alex's earlier and hoped that it would help. However, I am not even getting far enough to pass parameters. VB.Net 2005 will not let me set up the GMSManager object. I tried it in VB6, and it worked fine. I think there is a disconnect between 2005 and CorelDraw. I was hoping that there is a fix. I think I will send a note to Corel tech support. Have any other ideas? They will be greatly appreciated. Again, thanks for the reply.
Reply With Quote
  #4  
Old 04-07-2006, 12:33
wOxxOm's Avatar
wOxxOm wOxxOm is offline
Senior Member
 
Join Date: Mar 2005
Posts: 836
Default

that link should resolve all your troubles which derive from the fact that there is no OLE registration for GMSManager in Windows, so the GMSManager object can be retrieved only by accessing CorelDraw Application object's property GMSManager as stated in that thread.

80040154 = Class not registered, standard OLE error
{4A110034-2109-4B5D-BC63-17AE8914E384} = virtual CLSID of GMSManager object which is not registered in CLSID database in Windows registry and should not of course

As far as I can clearly see there is no error in CorelDRAW though I didn't test it. Give an updated example of your code using technique by Alex, so we can help further

Or tell me - do you want to access GMSManager object without first initializing CorelDRAW Application object? if so then there is probably some quirk using CoCreateInstance WinAPI but I doubt that it can be done without manual fake registereing of GMSManager in CLSID....anyway why bother?
Reply With Quote
  #5  
Old 04-07-2006, 21:37
Alex's Avatar
Alex Alex is offline
Administrator
 
Join Date: Nov 2002
Posts: 1,940
Blog Entries: 4
Default

Well, there are only a few classes that can be instantiated directly using New keyword or CreateObject method. Application class is one of those. The others are Color, ShapeRange, various import/export structs (e.g. StructSaveAsOptions), etc. All the rest of the classes are not creatable directly. The only way to get to them is through one of the creatable classes, namely the Application class.

It is not just a matter of registering a class under HKEY_CLASSES_ROOT\CLSID section of Windows Registry. This only tells OS what application is reponsible for creating an instance of that class. In addition, the application must provide a class factory - a special creator class for each creatable class of its object model. These class factories are registered with Windows at application startup and used to actually let an application create an instance of a class. Adding a registry entry for non-creatable class will not make CorelDRAW expose one more class factory for, say, GMSManager.

Just so you understand the whole thing a little better. Long story short, get hold of an instance of Application class and then get to any subobject you need.
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
Cannot use Curveworks macros in a user witten macro??? jon46089 CurveWorks 2 02-03-2006 14:18
Help with Replace Macro Pumpkin_Masher Macros/Add-ons 1 21-09-2005 14:41
Adding a Reference on a pwd protected macro Rick Randall CorelDRAW/Corel DESIGNER VBA 9 27-10-2004 09:27
New macro to clip curves w.r.t. a border Gerard Hermans Macros/Add-ons 0 09-06-2003 07:50
Speeding up a macro Rick Randall CorelDRAW/Corel DESIGNER VBA 2 12-12-2002 10:51


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


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