Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

EXE Crashes On MDI Window With VB6 OCX 1

Status
Not open for further replies.

Hurricane766

IS-IT--Management
Nov 30, 2004
34
CA
Hi,

I've written an OCX drawing control in VB6 and have added it to my program. The compiled program runs perfectly on my computer (same computer I did the OCX development on). When I run the program on another computer everything is fine until I try to open the MDI window with the OCX on it. This is when I get the MSWindows error box saying it had to close my program and asks if I want to send an error message to Microsoft.

I don't think that the MDI window or the OCX are even executing any code because the window isn't open when the program crashes and adding in message boxes to the open event of the window seems to confirm this.

I've tried installing the VB6 runtime dlls; as well as, un/re - registering the OCX drawing control. Nothing seems to help. Maybe there are some settings in my VB6 project that aren't right?

If you have any ideas or help please respond - it's frustrating!

Thanks
 
Is your OCX referencing any files itself? If so, do those files exist on the target computer.

zemp
 
Yes, the ocx references some bmps. I've made sure to copy these to any computer I try this on.

I have actually forgotten to do this and you're right - the program crashes - but it gives a different error message and the MDI window had actually opened at this point.

Thanks though
 
Well, it sounds like your OCX has some dll dependencies and the dll's aren't on the target machine. I don't know how much work you've done to get a package together, but keep in mind that some of the constituent controls on your usercontrol could be using some kind of dll as well, that isn't on your target machine.

HTH

Bob
 
Hi,
Yes I've thought of that. The only thing is I'm not sure how to tell which dll a GUI control uses? Any idea? Is there a list of dlls a control or project is dependent on? That would be handy...

Thanks
 
From the VB IDE you can go to the Project-references and Project-Components menu to get a list of files your VB project references.

However this does not tell you the files that an OCX may reference. You might need to try something like Dependency Walker (google for it) for that information.

zemp
 
*Resolved*

Hooray,

After more searching on some forums I found out that you can find the object dependecies of a vb control by opening the .vbp file in notepad. The lines that say 'Object' and 'Reference' are the objects that the control is dependent upon. Turns out I had 3 of these missing from the target computer.

Thanks

PS Thanks zemp, it's good to know that there's a spot in the program where I can check this too.
 
Glad you've managed to resolve it this time - but from the sounds of it you got your compiled program onto the target machine simply by copying over the EXE and any other files that you thought it needed. This is prone to problems. You need to look at using an installer program.
 
Ya that's true I was just copying stuff over... we usually use InstallShield but this was just for testing. However I wouldn't have packaged them in because I didn't know which ones I needed.
 
> I didn't know which ones I needed

No, but InstallShield would have done. That's one of the points of using installers.
 
Installshield 6.3? Really? I always have to add that in myself.
 
Hey how bout that. Didn't even know about the dependency manager scan thingy. Sweet deal, thanks strongm :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top