Using COM component invalid pointer error
-
Hi All, I have created COM component(dll) and created one client to use it, Please finnd the code of client:-
HRESULT hr = CoInitialize(0); //CoCreateInstance( SCRIPTOBJLib::IScriptObjPtr sobj; //sobj->QueryInterface(IId_,void* &vp); //HRESULT hRes = CComObject<CScriptObj>::CreateInstance(&sobj); //CreateInstance(NULL,IID_IUnknown,(void*)&vp); //HRESULT hres = sobj.CreateInstance ( __uuidof(SCRIPTOBJLib::IScriptObj) ); //HRESULT hres = sobj.CreateInstance("ScriptObj 1.0 Type Library"); //at this point i am getting the error sobj->SetLanguage((unsigned short *)"VBScript"); CoUninitialize();
Please give me some solutions coz i tried every possible way.
Thanks A Ton Ash_VCPP walking over water is just knowing where the stones are.....
-
Hi All, I have created COM component(dll) and created one client to use it, Please finnd the code of client:-
HRESULT hr = CoInitialize(0); //CoCreateInstance( SCRIPTOBJLib::IScriptObjPtr sobj; //sobj->QueryInterface(IId_,void* &vp); //HRESULT hRes = CComObject<CScriptObj>::CreateInstance(&sobj); //CreateInstance(NULL,IID_IUnknown,(void*)&vp); //HRESULT hres = sobj.CreateInstance ( __uuidof(SCRIPTOBJLib::IScriptObj) ); //HRESULT hres = sobj.CreateInstance("ScriptObj 1.0 Type Library"); //at this point i am getting the error sobj->SetLanguage((unsigned short *)"VBScript"); CoUninitialize();
Please give me some solutions coz i tried every possible way.
Thanks A Ton Ash_VCPP walking over water is just knowing where the stones are.....
-
your code isnt readable. :wtf: What are the error codes? Google them
Press F1 for help or google it. Greetings from Germany
Hi KarstenK, I am getting value of hresult= -2147221164 Please find the code below: HRESULT hr = CoInitialize(0); //CoCreateInstance( SCRIPTOBJLib::IScriptObjPtr sobj; //sobj->QueryInterface(IId_,void* &vp); //HRESULT hRes = CComObject<CScriptObj>::CreateInstance(&sobj); //CreateInstance(NULL,IID_IUnknown,(void*)&vp); HRESULT hres = sobj.CreateInstance ( __uuidof(SCRIPTOBJLib::IScriptObj) ); //HRESULT hres = sobj.CreateInstance("ScriptObj 1.0 Type Library"); sobj->SetLanguage((unsigned short *)"VBScript"); CoUninitialize();
Thanks A Ton Ash_VCPP walking over water is just knowing where the stones are.....
-
Hi KarstenK, I am getting value of hresult= -2147221164 Please find the code below: HRESULT hr = CoInitialize(0); //CoCreateInstance( SCRIPTOBJLib::IScriptObjPtr sobj; //sobj->QueryInterface(IId_,void* &vp); //HRESULT hRes = CComObject<CScriptObj>::CreateInstance(&sobj); //CreateInstance(NULL,IID_IUnknown,(void*)&vp); HRESULT hres = sobj.CreateInstance ( __uuidof(SCRIPTOBJLib::IScriptObj) ); //HRESULT hres = sobj.CreateInstance("ScriptObj 1.0 Type Library"); sobj->SetLanguage((unsigned short *)"VBScript"); CoUninitialize();
Thanks A Ton Ash_VCPP walking over water is just knowing where the stones are.....
I think that the issue is that you are using getting the ID of the interface: __uuidof(SCRIPTOBJLib::IScriptObj) You need the ID of the coclass in the CreateInstance call. It is probably __uuidof(SCRIPTOBJLib::ScriptObj) depending on how the object has been implemented.
-
I think that the issue is that you are using getting the ID of the interface: __uuidof(SCRIPTOBJLib::IScriptObj) You need the ID of the coclass in the CreateInstance call. It is probably __uuidof(SCRIPTOBJLib::ScriptObj) depending on how the object has been implemented.
-
Hi KarstenK, I am getting value of hresult= -2147221164 Please find the code below: HRESULT hr = CoInitialize(0); //CoCreateInstance( SCRIPTOBJLib::IScriptObjPtr sobj; //sobj->QueryInterface(IId_,void* &vp); //HRESULT hRes = CComObject<CScriptObj>::CreateInstance(&sobj); //CreateInstance(NULL,IID_IUnknown,(void*)&vp); HRESULT hres = sobj.CreateInstance ( __uuidof(SCRIPTOBJLib::IScriptObj) ); //HRESULT hres = sobj.CreateInstance("ScriptObj 1.0 Type Library"); sobj->SetLanguage((unsigned short *)"VBScript"); CoUninitialize();
Thanks A Ton Ash_VCPP walking over water is just knowing where the stones are.....
Please use for HRESULT hexadecimal values (Just do it! if you want to run COM) if you google that (-2147221164 => hex 80040154) you find things like "class not registered". This means that SCRIPTOBJLib::IScriptObj isnt registered properly. ->regsvr32
Press F1 for help or google it. Greetings from Germany
-
Please use for HRESULT hexadecimal values (Just do it! if you want to run COM) if you google that (-2147221164 => hex 80040154) you find things like "class not registered". This means that SCRIPTOBJLib::IScriptObj isnt registered properly. ->regsvr32
Press F1 for help or google it. Greetings from Germany