Where I have to call CoUnInitialize function if I have COM interfaces in (MFC) application main class?
-
I couldn't call CoUnInitialize function in ExitInstance or in class destructor(there will be crash), since I have COM interfaces (member variables)in application main class,(They are smart pointers),so a calling to COM interfaces release function will make the problem.
-
I couldn't call CoUnInitialize function in ExitInstance or in class destructor(there will be crash), since I have COM interfaces (member variables)in application main class,(They are smart pointers),so a calling to COM interfaces release function will make the problem.
Hi, If you are using Document/View Architecture, you can put your smart pointers as member variavles in the Document class. At that time you can call CoUnitialize() either in the Main App Destructor or in App ExitInsnance :). ShadiK Shadi Al-Kahwaji
-
I couldn't call CoUnInitialize function in ExitInstance or in class destructor(there will be crash), since I have COM interfaces (member variables)in application main class,(They are smart pointers),so a calling to COM interfaces release function will make the problem.
You don't have to. You call AfxOleInit() in your app's InitInstance() and that's it. MFC handles uninitializing COM when you app closes. --Mike-- http://home.inreach.com/mdunn/ "The Earth is doomed." -- Rupert Giles :love: your :bob: with :vegemite: and :beer:
-
You don't have to. You call AfxOleInit() in your app's InitInstance() and that's it. MFC handles uninitializing COM when you app closes. --Mike-- http://home.inreach.com/mdunn/ "The Earth is doomed." -- Rupert Giles :love: your :bob: with :vegemite: and :beer:
It doesn't solve my problem. The same crash will happen when the application releases smart pointers members.:)
-
It doesn't solve my problem. The same crash will happen when the application releases smart pointers members.:)
Then call their Release() methods in your ExitInstance(). --Mike-- http://home.inreach.com/mdunn/ "The Earth is doomed." -- Rupert Giles :love: your :bob: with :vegemite: and :beer: