Directly run compiled VB6 exe - Automation Error 2147417848 & Access violation reading location 0x01289B5C

0

I got the really common Automation Error when I ran a VB6 application for the second time. However, the code worked fine under VB6 debugging mode. After I compiled the code and run some function for the second time, I would encounter the Automation Error 2147417848 - The object invoked has disconnected from its clients.

Then I debugged the application thru Visual Studio and got the following exception error:

Unhandled exception at 0x76B33E8D (oleaut32.dll) in vb6_2_12_2015.exe: 0xC0000005: Access violation reading location 0x01289B5C.

Is it because of something wrong with my dll registration?

excel
vb6
automation
asked on Stack Overflow Feb 12, 2015 by Bw.Zhou • edited Feb 17, 2019 by Cœur

1 Answer

0

The message means your program is accessing memory (ie a variable or object) that has been freed or never existed (usually because creation failed and the programmer didn't check). A memory address under 64K indicates a failed allocation.

To start with, compile your program without optimisations and with debugging info. When you crash do a stack trace which will list functions and parameters.

You can also start in a debugger.

windbg or ntsd (ntsd is a console program and maybe installed). Both are also from Debugging Tools For Windows.

Download and install Debugging Tools for Windows

http://msdn.microsoft.com/en-us/windows/hardware/hh852363

Install the Windows SDK but just choose the debugging tools.

Create a folder called Symbols in C:\

Start Windbg. File menu - Symbol File Path and enter

srv*C:\symbols*http://msdl.microsoft.com/download/symbols

then

windbg -o -g -G c:\windows\system32\cmd.exe /k batfile.bat

You can press F12 to stop it and kb will show the call stack (g continues the program). If there's errors it will also stop and show them.

Type lm to list loaded modules, x *!* to list the symbols and bp symbolname to set a breakpoint

da displays the ascii data found at that address
dda displaysthe value of the pointer  
kv 10 displays last 10 stack frames
lm list modules
x *!* list all functions in all modules
p Step
!sysinfo machineid

If programming in VB6 then this environmental variable link=/pdb:none stores the symbols in the dll rather than seperate files. Make sure you compile the program with No Optimisations and tick the box for Create Symbolic Debug Info. Both on the Compile tab in the Project's Properties.

Also CoClassSyms (microsoft.com/msj/0399/hood/hood0399.aspx) can make symbols from type libraries.

.

answered on Stack Overflow Feb 12, 2015 by user4532213

User contributions licensed under CC BY-SA 3.0