Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Exception error when IOleInPlaceObject.UIDeactivate() is called?

Hi,
I have an unhandled exception error when I exit my program. I am using Visual C++.NET and current I want to put the AxCWButton object in my windows form. What is weird is when I exit my program, there is a null reference exception when
System.Windows.Forms.IOleInPlaceObject.UIDeactivate() is called. I am unfamilar with the internals so I do not the significance of this method.
 
System.NullReferenceException: Object reference not set to an instance of an object.
   at System.Windows.Forms.IOleInPlaceObject.UIDeactivate()
 
If I remove the AxCWbutton, my program exits fine. The null reference exception only occurs when I add the button to my form. I did not change any code, and used the automatic referencing style visualc++.NET uses when adding any objects
onto a form. Any help would be greatly appreciated. Thanks!
 
I declare the object like so in my forms.h:

private

: AxInterop::CWUIControlsLib::AxCWButton * button1;

0 Kudos
Message 1 of 3
(3,558 Views)

I just tried this and I didnt see the problem you mention. Do you have a sample I could look at?
Thanks

Bilal Durrani
NI
0 Kudos
Message 2 of 3
(3,552 Views)

Hi,

I just fixed the problem. The method I used to close my program was exit(). I changed it and use Close() instead, which fixed the exception error. Although I do not know the reason behind the exception, changing the exit function worked. Thanks anyway!

0 Kudos
Message 3 of 3
(3,547 Views)