473,320 Members | 1,829 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,320 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
Jul 21 '05 #1
0 2073

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

Similar topics

3
by: GATMAN | last post by:
Dim f As New frmWeb f.ShowDialog(Me) f.Dispose() Annytime i call a diffrent form from my main form using showdialog, i get an exception eror thrown when i close the form, but when i use f.show i...
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: Mike Grishaber | last post by:
I am using .NET Remoting to connect my incoming HTTP Requests to my business logic. I am using a custom IHttpAsyncHandler to receive the incoming HTTPRequests and then I forward 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...
2
by: Bill Struve | last post by:
Need: Auto-logon to a terminal server, start a program, and, when the user is quits the program, auto-logoff. Problem: When msrdp.ocx is added to the Toolbox, attempting to draw the control on...
9
by: Ron | last post by:
my application is throwing an exception error when closing if I run a procedure in the app. I can't even trap the error with try/catch ex As Exception. Is there a way to completely shut down the...
0
by: Yoshitha | last post by:
Hai All, i am getting one Exception with ImageScan.ocx in vb.net control.What is this Exception iam not understand .The Exception is "Excpetion of type InvalidActivexStateException was thrown"...
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...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
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)...
0
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: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

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.