Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 226167
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T19:29:05+00:00 2026-05-11T19:29:05+00:00

The VB6 help on GetObject says You can’t use GetObject to obtain a reference

  • 0

The VB6 help on GetObject says “You can’t use GetObject to obtain a reference to a class created with Visual Basic” (the very last sentence!). My VB6 GUI exposes objects as an ActiveX exe, for other components to manipulate. I want the other components to connect to the GUI that’s already running, rather than start a new instance of the exe. I’ve found using GetObject does work, if you use this syntax:

Set myobj = GetObject("", "ProjectName.ClassName")

It worries me that the help says this shouldn’t work, although I have done quite a bit of testing and haven’t found any problems so far. Any COM experts out there who can tell me whether I going to run into problems down the line? And would I be OK with CreateObject anyway?

The ActiveX exe settings are: thread pool with only one thread. The class has MultiUse instancing. It’s possible these settings are enough to prevent CreateObject starting a new instance of the exe anyway. Is that correct?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T19:29:06+00:00Added an answer on May 11, 2026 at 7:29 pm

    The documentation is confusing, but correct. The MSDN page you reference helps to explain why your GetObject call doesn’t throw an error:

    If pathname [the first argument] is a zero-length string
    (“”), GetObject returns a new object
    instance of the specified type. If the
    pathname argument is omitted,
    GetObject returns a currently active
    object of the specified type. If no
    object of the specified type exists,
    an error occurs.

    It’s subtle, but the implication is that

    GetObject "", "ProjectName.ClassName
    

    is actually equivalent to

    CreateObject "ProjectName.ClassName"
    

    That is to say, passing an empty string to the first parameter of GetObject makes it operate exactly like CreateObject, which means it will create a new instance of the class, rather than returning a reference to an already-running instance.

    Going back to the MSDN excerpt, it mentions that omitting the first argument to GetObject altogether will cause GetObject to return a reference to an already-running instance, if one exists. Such a call would look like this:

    GetObject , "ProjectName.ClassName" 'Note nothing at all is passed for the first argument'
    

    However, if you try to do this, you will immediately get a run-time error. This is the use-case that the documentation is referring to when it says that GetObject doesn’t work with classes created with VB6.

    The reason this doesn’t work is due to how GetObject performs its magic. When the first parameter is omitted, it tries to return an existing object instance by consulting the Running Object Table (ROT), a machine-wide lookup table that contains running COM objects. The problem is that objects have to be explicitly registered in the Running Object Table by the process that creates them in order to be accessible to other processes – the VB6 runtime doesn’t register ActiveX EXE classes in the ROT, so GetObject has no way to retrieve a reference to an already-running instance.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 119k
  • Answers 119k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer You don't necessarily have to delete "old" data all the… May 11, 2026 at 11:51 pm
  • Editorial Team
    Editorial Team added an answer Although it looks like it, for(int i = 0; i… May 11, 2026 at 11:51 pm
  • Editorial Team
    Editorial Team added an answer Although this question may have been solved, here's a little… May 11, 2026 at 11:51 pm

Related Questions

The VB6 help on GetObject says You can't use GetObject to obtain a reference
I have some legacy VB6, which I am hosting inside an ActiveX control, which
I've been trying to compare the memory footprint between a VB6 application and .Net
This I think is related to my use of the nlog C++ API (and
I have a stored procedure which is erroring with Timeout expired. The code involved

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.