-
DAO
Hello,
First scenarion :
I'm using AfxDaoInit() from win32 C console application it works fine.
Second scenario:
I created a win32 C dll, that has a method below
Code:
DLLEXPORT void Init()
{
AfxDaoInit();
}
I have managed C# .exe that using Interop.Services to call Init function.
I can see that it reach the Init function, but it fails on AfxDaoInit().
Is there any problem running AfxDaoInit() from non-GUI thread?
I'll appreciate your help.
Thanks
-
>> Is there any problem running AfxDaoInit() from non-GUI thread?
I'm not sure, but AfxDaoInit is for applications that are properly linked with the MFC libraries, so perhaps they aren't being loaded? On a side note, it looks like AfxDaoInit is deprecated, so you should probably use a more up-to-date API.
-
I'm not familiar with DAO and very little with MFC. Can you please explain how can check if MFC libraries are loaded?
The strange thing is that the same code run perfect from win32 console application.
-
IIRC you need to call
Code:
AFX_MANAGE_STATE(AfxGetStaticModuleState());
iwithin any exported function in a DLL that uses MFC.