ActiveX and Windows C++
-
Hello, I am working on a project and I am stuck at one place. I have 2 applications. 1-> ActiveX Control (Developed in MFC) 2-> A Windows C++ application.(No MFC...purely Windows) How can I use the functions defined in ActiveX into this C++ application. I tried adding the ActiveX header file in my C++ application but then I get an error of CWnd, CString etc classes of MFC not found. Please let me know if you or any of your friends know the solution. Please email me at dubeyashok@yahoo.com Thanks in Advance. Ashok Dubey Ashok
-
Hello, I am working on a project and I am stuck at one place. I have 2 applications. 1-> ActiveX Control (Developed in MFC) 2-> A Windows C++ application.(No MFC...purely Windows) How can I use the functions defined in ActiveX into this C++ application. I tried adding the ActiveX header file in my C++ application but then I get an error of CWnd, CString etc classes of MFC not found. Please let me know if you or any of your friends know the solution. Please email me at dubeyashok@yahoo.com Thanks in Advance. Ashok Dubey Ashok
Ashok, I'm no expert yet on mfc, but from what I've seen, mfc is nothing more than a bunch of wrapper code around the win32 functions. So, I don't think there is any reason why you cannot do this. I would suggest creating a dummy mcf application with ActiveX support. Take a look at the stdafx header file. Also, there your Windows app must call AfxEnableControlContainer(); You'll see all of this in your dummy application. You should get pretty far with this approach. chg C. Gilley Will program for food... Whoever said children were cheaper by the dozen... lied.
-
Hello, I am working on a project and I am stuck at one place. I have 2 applications. 1-> ActiveX Control (Developed in MFC) 2-> A Windows C++ application.(No MFC...purely Windows) How can I use the functions defined in ActiveX into this C++ application. I tried adding the ActiveX header file in my C++ application but then I get an error of CWnd, CString etc classes of MFC not found. Please let me know if you or any of your friends know the solution. Please email me at dubeyashok@yahoo.com Thanks in Advance. Ashok Dubey Ashok
Hi. You can access its methods as you would access any other COM object's methods. Use CoCreateInstance to create the object (based on its CLSID)and that will give you a pointer to the object's IDispatch interface. Ex: IDispatch* pDisp; CoCreateInstance(clsid, NULL, CLSCTX_INPROC_SERVER, iid, &pDisp); clsid is the Class ID for the ActiveX object and iid is the Interface ID for the IDispatch interface of the object. After that you can use pDisp->GetIDsOfNames() to get dispatch ids based on method names, and with that dispatch id you can use pDisp->Invoke() to call the method. Remember to call pDisp->Release() to decrement the reference counter for that interface so the object can be destroyed.