BOOL Create(LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd,
UINT nID, CFile* pPersist = NULL, BOOL bStorage = FALSE,
BSTR bstrLicKey = NULL)
{
return CreateControl(GetClsid(), lpszWindowName, dwStyle, rect, pParentWnd, nID,
pPersist, bStorage, bstrLicKey);
}
its in an mfc application i want to use it in an console based win 32 application can u tell me how???
All that MFC is irrelevant. Which ActiveX control are you trying to use? All you need is the CLSID and CoCreateInstance(). The control will function appropriately even if not placed inside an OLE container. Of course, it won't be visible, but calling its methods should work OK.
If the control requires a license, then the process of creating it is a bit different, but usage-wise is exactly the same.
One more time: COM is not a simple topic. If you are going to use COM frequently, do the right thing: Learn it appropriately. If you are expert in C++ (the language), pick up Don Box's book. It is the single most amazing book on COM that I have ever read, but you need to know C++ or you'll be lost.
Sir the above code is from sdk that i will use in my project and want to use active x function of that sdk,sir the CLSID is given above,now can u guide me what steps i have to take and after which line of code i should write that.
So create a new, very simple console project, then use RequestLickKey() to obtain the key (run it in a PC with a license for the component), then save that key, say, to a text file.
Now go back to your original console project and use that key in the call to CreateInstanceLic(). After this, use the ActiveX object as you see fit.
Google up "c++ cocreateinstance example" (no quotation marks). The second result has a small section called Object Basics. It shows how to use CoCreateInstance().
You definitely need to stop being so needy and learn to get around in the Internet.