Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21243

VB6 application hangs at shutdown in Windows 7 w/50% CPU, fine in XP

$
0
0
I have an application that hangs during shutdown. I've found that the problem seems to be using certain object types. If I comment out the sections where the objects are used, the application closes normally. For instance, it hangs during shutdown if I run this code:
Code:

strLoggedOnUser = Environ("Username")
Set oRoot = GetObject("LDAP://rootDSE")
strDomain = oRoot.Get("defaultNamingContext")
'debug
Set oRoot = Nothing

note: I use Option Explicit. I dim oRoot as IADs. I have the same issue with ADO Connection, Command, and RecordSet objects, and an IADsOpenDSObject object elsewhere in the code.

I should also mention that this particular executable is started by another executable, which I believe causes it to start up as a child process of svchost.exe and run with -Embedding flag. It does this under XP as well so I'm not sure it's relevant, but I don't want to exclude details that could be important.

I've noticed that when it's hung, it shuts down if I look at it in Process Explorer and click on the Threads tab, like "Oh, shoot, I'm not doing anything and using 50% of the CPU!"

I can maybe include other examples if needed, but the above is the simplest--create object, use object, set object to nothing explicitly and likely unnecessarily--example that replicates the behaviour.

Any chance anyone's seen this before?

Thank you!

Viewing all articles
Browse latest Browse all 21243

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>