I have written a COM object using the
visual c++ wizard (DLL with automation).
The COM object has the standard DllRegisterServer, DllGetClassObject,
QueryInterface, etc ... I have also
implemented a class factory within the
COM object. My actual object is a CCmdTarget based class which has a handful of methods (including QueryInterface, AddRef, etc..) exposed.
now the problem. I am able to register the COM object, I can create a class factory object and then create my CCmdTarget based object. within the CCmdTarget object one of the methods allows me to create and display a modeless dialog. the method to create the dialog is accessed when a toolbar button on the main application window is pressed. I am able to create and display the dialog correct. within the application main window I also have a routine that uses the CCmdUI to control the state of the toolbar button ,keeping it in the pressed state as long as the modeless dialog box is displayed. I check the state of the dialog box by calling a method within my CCmdTarget class that that uses IsWindowVisible() to check if the dialog is visible. for some reason when I call this method my pointer and HWND
handle are invalid for the dialog box I created earlier and I get a memory error, what is going on ????