Hi! Thanks for your reply!
I want my VB.net application to control an instance of the InfoPath (2003) application - but I need to know if the user has closed the InfoPath window. (I'm using the "application" and "xdocument" objects.) There is no "closing" event for the application object. . I have used "If Not IsNothing(CurrentDoc)" (refererring to the Xdocument) in parts of the code to at least provide some insurance.
In my application I set the document window title bar text, and so I tried using the .NET methods for finding the process of the document window, thinking that the Process.Exit event would let notify me if the user closed the window - but for reasons I don't understand, this doesn't occur if I click the "X" close button, but does occur if I use "File > Exit".
Right now I am using the Win32 API to disable the close button and "close" window menu item so the user can't do this, and only allow the application to close the Window. However, if the application crashes, you need to use Task Manager to close the document window. Unless I could "cancel" the user closing the document window, I guess I'd have to do this anyway...but I still wouldn't mind knowing if this is possible.
I'd appreciate any input on this. Thanks! --- Francis
--- Francis