?
Solved

Using GetObejct / CreateObject from VB6 IDE and VB6 EXE on Windows 7?

Posted on 2009-07-15
6
Medium Priority
?
1,132 Views
Last Modified: 2013-11-26
Hi folks,

 

I've come across an odd situation these days and seem to be stuck. I have a VB6 EXE that is running pretty fine on Vista and Windows 7 when compiled and deployed with a setup. Every other way seems to fail.

To spot some issues, I need to troubleshoot and debug the code in the VB6 (SP6) IDE on the target system, that is Windows Seven 32-bit (RC Build 7100). I cannot get to run the application, neither compiled nor in the debugger.

I've managed to install the Visual Studio 6 and SP6 components so far, but when I run the program from the IDE, there are problems I cannot solve on my own. Starting the IDE in XP SP3 compatibility mode and with Administrator privileges works up to some point.

After starting, the program tries to connect to a running Outlook application with a GetObject(, "Outlook.Application") call that works fine on all pre-Vista systems. If Outlook is not running, the error is caught and the application waits for a few seconds before retrying (let's call this "standby mode").

Unfortunately, the GetObject call won't work even with a running Outlook instance. All I get is error 429 (ActiveX can't create object). Create??? - well, must be error message re-usage.

Almost the same happens if I try - more aggressively - with a CreateObject("Outlook.Application") command which gives me the same error but freezes the whole application (and with it, the VB6 IDE) for 30 seconds!

When I run the compiled EXE, I can see it in the Task Manager for about 10 seconds before it disappears. Nothing else happens, there are no event log entries or something helpful. It makes no difference if compatibility settings are used or not, neither if I run the program as Administrator.

I think the application would need elevated rights but I don't know how to achieve this. Same goes for the VB6 IDE that I desperately need (I know I shouldn't use it but that's the way it is)

If anyone has some more experience with maintaining old VB6 apps on a modern OS, I'd be very happy if you told me what I'm doing wrong. Thank you very much!

 

Best regards,

Joe
0
Comment
Question by:MunichJoe2009
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
6 Comments
 
LVL 10

Expert Comment

by:cool12399
ID: 24866525
Hi,

Couple comments:

1. Do you have Outlook installed on your Vista machine/machine where it isn't working?
2. Do you have the references set correctly (i.e., using the same DLL/etc)?

Check those, should help.
0
 

Author Comment

by:MunichJoe2009
ID: 24866925
Okay, I'll try to give you some more info:

Windows 7 32-bit Build 7100 (RC)
Microsoft Office Outlook 2007 (from Microsoft Office 2007 Enterprise)
Visual Basic 6.0 SP6

Outlook is installed and working on the machine. The only thing I cannot do is create a reference to the running Outlook application from out of the VB6 IDE, neither in the immediate window nor in my application, when started out of the VB6 IDE ("debug" mode).
It seems that even though VB6 is run in XP SP3 compatibilitiy mode and started with administrative privileges, something is blocking VB6 from creating this object reference. I wonder if there is any patch or some Windows setting that might solve this issue...

By the way, at least I got to run my EXE in compiled mode and it is now working again in the environment described above. Makes me think that the VB6 Runtime seems to be able of getting object references, but the VB6 IDE is not.
Any more ideas?

Thanks a lot again!

Regards,
Joe
0
 
LVL 10

Accepted Solution

by:
peetm earned 750 total points
ID: 24868441
Are the EXE and the IDE running in the same compatability mode?  Both have been run as administrator?
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:MunichJoe2009
ID: 24870245
Hi all,

I think things have cleared up. I wasn't aware of the shims delivered with Windows 7 (in Vista, VB6 IDE could only be run as Admin, this seems to have changed massively).
If the VB6 IDE is run with no special compatibility settings (and not as Administrator), everything seems to be fine as Windows 7 will then use the built-in shim settings which are obviously okay, also for debugging the code! Same goes for the compiled EXE.
Thanks for your advice though.

Regards,
Joe
0
 

Author Closing Comment

by:MunichJoe2009
ID: 31603700
Thank you, your questions helped me get it righ, even though I had to try this and that... t ;o)
0
 

Author Comment

by:MunichJoe2009
ID: 24970034
Another thing I found out is that getting a reference to a running Office app may fail if the app has not registered itself in the Runnung Object Table (ROT). I stumbled across this article at Microsoft:

http://support.microsoft.com/?scid=kb%3Ben-us%3B238610&x=10&y=11

So, to make sure a GetObject call succeeds, seems to try GetObject first, and if it fails, activate a window other than the Office app main window. The next GetObject should succeed... funny stuff!
0

Featured Post

Want to be a Web Developer? Get Certified Today!

Enroll in the Certified Web Development Professional course package to learn HTML, Javascript, and PHP. Build a solid foundation to work toward your dream job!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
On some Windows 7 (SP1) computers, Windows Update becomes super slow even the computer is reasonably fast.  There's one solution that seemed to have worked well for me (after trying a few other suggested solutions).
This Micro Tutorial will teach you how to the overview of Microsoft Security Essentials. This is a free anti-virus software that guards your PC against viruses, spyware, worms, and other malicious software. This will be demonstrated using Windows…
This Micro Tutorial will give you basic overview of the control panel section on Windows 7. It will depth in Network and Internet, Hardware and Sound, etc. This will be demonstrated using Windows 7 operating system.
Suggested Courses
Course of the Month15 days, left to enroll

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question