473,327 Members | 2,071 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

Exception when VB.net app (using MFC ocx) closes.

I have a OCX written in MFC/VC6.
In this OCX I #import a Com DLL and use _com_ptr_t::CreateInstance to
get a smart pionter.
The DLL uses #import <msado15.dll> and CreateInstance, and little else
other than some WinSock code.
I use this OCX in a VB6 app, and it's OK.
When I try and use it in in a VB.net application everything works fine
(all functionality in DLLs OK, all functionality in OCX OK). I can
even use my VB7.net app as the executeable for debugging and step
through the OCX and see everything working as expected.
When the VB.net application is closed, everything is disposed, the
window disapears, and an unhandled exception is reported.
The exception occurs in something called "BroadcastWindow".

I have been all over the place looking for documentation on this
"BroadcastWindow" and found little.

If I comment out the #import, CreateInstance, and all smart pionter
calls (from the OCX), the problem disappears. No exception occures.

I thought it maybe a problem with Unintialising COM too early, but
(all) the code suggests not. I have even tried calling
CoFreeUnusedLibraries in the OCX ControlClass destructor to no avail.

I have tried recompiling all the compnents in VC7 (.net) as I thought
it could be problems with versions of MFC/CRT. They all compiled, but
the problem presists.

I am starting to pull my hair out on this one a little. Any help
would be greatly appriciated. Even any further light that can be
thrown on the fundamental cause of the problem could at least help me
start looking for possible solutions/alturnatives.

TIA

Simon Jones
Nov 22 '05 #1
0 656

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Simon | last post by:
I have a OCX written in MFC/VC6. In this OCX I #import a Com DLL and use _com_ptr_t::CreateInstance to get a smart pionter. The DLL uses #import <msado15.dll> and CreateInstance, and little else...
1
by: Mohammed Abdel-Razzak | last post by:
Dear sirs I`ve got the file MSCOMM32.OCX from visual basic 6 and used it in C# I`ve includedit in the references and also used it in the project "using MSCommLib;" I also have written the...
0
by: Hari | last post by:
Hi everyone, I have a C# based COM DLL that uses an old ocx. The ocx is placed within a panel inside a form that the C# COM DLL displays as a dialog. In the InitializeComponent call, I get the...
44
by: craig | last post by:
I am wondering if there are some best practices for determining a strategy for using try/catch blocks within an application. My current thoughts are: 1. The code the initiates any high-level...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.