Failed to initialize COM library error
-
Hi all, I have made a exe using VS-2008. I am trying to run that exe on another pc which not having VS-2008 inatalled on it (having OS - win xp with sp3), in my exe i have initialised COM using this code.
hres = CoInitializeEx(0, COINIT_MULTITHREADED);
if (FAILED(hres))
{
AfxMessageBox(_T("Failed to initialize COM library") );
return; // Program has failed.
}But every time i run my exe on this machine it gives "Failed to initialize COM library". Do i need to install anything extra on this machine... Or what other problem there might be? Can anybody help me in this... Thanks in advance
To accomplish great things, we must not only act, but also dream; not only plan, but also believe.
-
Hi all, I have made a exe using VS-2008. I am trying to run that exe on another pc which not having VS-2008 inatalled on it (having OS - win xp with sp3), in my exe i have initialised COM using this code.
hres = CoInitializeEx(0, COINIT_MULTITHREADED);
if (FAILED(hres))
{
AfxMessageBox(_T("Failed to initialize COM library") );
return; // Program has failed.
}But every time i run my exe on this machine it gives "Failed to initialize COM library". Do i need to install anything extra on this machine... Or what other problem there might be? Can anybody help me in this... Thanks in advance
To accomplish great things, we must not only act, but also dream; not only plan, but also believe.
You should check better the function return value (make your program reporting it). See the documentation for details [^]. :)
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles] -
Hi all, I have made a exe using VS-2008. I am trying to run that exe on another pc which not having VS-2008 inatalled on it (having OS - win xp with sp3), in my exe i have initialised COM using this code.
hres = CoInitializeEx(0, COINIT_MULTITHREADED);
if (FAILED(hres))
{
AfxMessageBox(_T("Failed to initialize COM library") );
return; // Program has failed.
}But every time i run my exe on this machine it gives "Failed to initialize COM library". Do i need to install anything extra on this machine... Or what other problem there might be? Can anybody help me in this... Thanks in advance
To accomplish great things, we must not only act, but also dream; not only plan, but also believe.
HI, For the function CoInitializeEx(), dont check for the returned code. Because if the COM has been initialized on the calling thread, the return code will be failed i.e S_FALSE. Just call the CoInitializeEx() and proceed to next.
-
HI, For the function CoInitializeEx(), dont check for the returned code. Because if the COM has been initialized on the calling thread, the return code will be failed i.e S_FALSE. Just call the CoInitializeEx() and proceed to next.
DurgaDevi_hr wrote:
For the function CoInitializeEx(), dont check for the returned code. Because if the COM has been initialized on the calling thread, the return code will be failed i.e S_FALSE.
Your point is wrong. In fact,
CoInitializeEx()
may returnS_FALSE
the way you depicted. HoweverFAILED(S_FALSE)
evaluates tofalse
. :)If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles] -
Hi all, I have made a exe using VS-2008. I am trying to run that exe on another pc which not having VS-2008 inatalled on it (having OS - win xp with sp3), in my exe i have initialised COM using this code.
hres = CoInitializeEx(0, COINIT_MULTITHREADED);
if (FAILED(hres))
{
AfxMessageBox(_T("Failed to initialize COM library") );
return; // Program has failed.
}But every time i run my exe on this machine it gives "Failed to initialize COM library". Do i need to install anything extra on this machine... Or what other problem there might be? Can anybody help me in this... Thanks in advance
To accomplish great things, we must not only act, but also dream; not only plan, but also believe.