Results 1 to 3 of 3

Thread: CreateObject, New, ActiveX exe involved

  1. #1

    Thread Starter
    Member
    Join Date
    Apr 2005
    Posts
    39

    CreateObject, New, ActiveX exe involved

    Hello,
    I have a ActiveX exe project and a standard project. My standard project reference ActiveX exe project.
    To make it simple, I have one class module in the ActiveX exe project and I need to create an instance of the class in a new thread in the Standard project. These are how I've been tring:
    In the standard exe:
    Dim objMyClass As ProjectName.MyClass
    Set objMyClass = CreateObject(ProjectName.MyClass);

    I get the object successfully ONLY IF I have class_initialize in MyClass as Public or I have THIS LINE at the beginning of my MyClass module
    Class MyClass As MyClass

    I find it more intersting, when I put these lines in my standard exe, it also works:
    Dim objMyClass As ProjectName.MyClass
    Set objMyClass = New MyClass;

    I'm not sure how vb6 make a class publicly creatable and I don't know why what I tried works. I just guess and that works for me. I'd like to know WHY if anyone can help me really appreciate it. I've checked MSDN but no luck until now. Thanks all.

  2. #2

    Thread Starter
    Member
    Join Date
    Apr 2005
    Posts
    39

    Re: CreateObject, New, ActiveX exe involved

    well, I don't know. Just recomile the 2 projects a couple of times, now both way works. Just can't say anything. Anyone have the same exp?

  3. #3
    Frenzied Member yrwyddfa's Avatar
    Join Date
    Aug 2001
    Location
    England
    Posts
    1,253

    Re: CreateObject, New, ActiveX exe involved

    Sounds suspiciously like a registry problem with all those GUID's that VB automatically produces for you.

    Make sure that you try to keep binary compatibility on as much as you can (and put up with the warnings on interface changes)

    A better solution is to use IDL for the COM interfaces (which can, in the future, be directly imported into .Net applications)
    "As far as the laws of mathematics refer to reality, they are not certain; and as far as they are certain, they do not refer to reality." - Albert Einstein

    It's turtles! And it's all the way down

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width