I am working on the OPC(OLE process Control)Client program,with the asynchronous CALLBACK methods to get data from PLC using the KepServer.But I encountered the issue:
CComObject<COPCDataCallback>* pCOPCDataCallback; // Pointer to Callback Object
// Create Instance of Callback Object using an ATL template
CComObject<COPCDataCallback>::CreateInstance(&pCOPCDataCallback);
and then it stopped at here:
_pAtlModule->Lock();
this is in the atlcom.h
any ideas of how to solve this issue?
When you are using ATL classes like CComObject
, it is assumed that you have an ATL project, with "ATL module" class defined in it, such as CAtlExeModuleT
based for EXE application.
With no module class/instance defined, there is no initialization of global internal _pAtlModule
variable and hence the problem. You need to add the module class.
One of the ways to add ATL support is using IDE, typically if your existing project is MFC-based:
Another way is to add CAppModule
instance, if your project is using WTL:
Then third way is to create a new clean ATL project of matching type (EXE or DLL) using Visual Studio wizard, and to check the code around CAtlDllModuleT
or CAtlExeModuleT
classes, then to duplicate that in your existing project.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With