AfxGetThread call returning null

S

Sushant

Hi,
An application has Excel embedded in IE (Internet Explorer) as an ActiveX
control. Initially, the dll was build on Visual Studio 6.0. Now we are trying
to port it from VS 6.0 to VS 2005. After making the changes required to build
on VS 2005, the dll built successfully and was successfully getting
registered in windows registry. But, while using this dll and creating new
excel file for the second time, it was giving error in MFC classes. The error
was some assertion failed. When I debugged it, I found that the function
AfxGetThread was failing in docsingl.cpp file.
In the file docsingl.cpp, there is a function named OpenDocumentFile(), in
which there is call for AfxGetThread, which would return pointer to window
thread but was returning null instead. The sequence of step was following:
1. Create a new excel file (It was getting created)
2. Create another new excel file (It was getting failed).

One point to be noted is we are using single excel process and all the
creation of new excel file or opening an existing excel file is attached to
the same process.
Sometimes the same error was coming from winfrm.cpp class in function
onActiveTopLevel.

I compared both the classes from VS 6.0 and VS 2005 and there is change in
the code of them. What could be the reason of failing this call? The
AFxGetThread function should ideally return the thread pointer which it was
not returning.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top