I have a problem with CWnd::CreateControl method while loading custom ActiveX control from the MFC application.
I have list of Custom ActiveX controls which are implemented Create method inturn calling CWnd::CreateControl method.
I am having Dialog window, in the OnInitDialog, I have started timer thread using Settimer(). In the OnTimer event, I am loading all the controls by calling respective control's Create method. After opening and closing the dialog window more than 10 times, OnTimer is not able to load the contols.
I checked the return value which is false and the GetLastError which is 0x0 (Operation successful). I was debugging completely and checked all the possiblities of errors before this event. I couldn't find the root cause what made not load开发者_如何学编程ing the controls.
You may want to refer the below question similar occurence of the problem Exception while opening file
The similarity being it was working fine but after sometime it would throw exception and when we check the error message it would be no error occured. The issue wont be directly at the line that causes exception. It would be lurking elsewhere in the application.
In my case when i changed the way i was accessing the method and it started working.
精彩评论