-
Initialize COM
Hi all;
Sorry to ask this question but Im trying to Initialize COM using CoInitializeEx(NULL, COINIT_MULTITHREADED); for a TAPI program i have started. the only problem is i cant find the .h that will define that function for me... I have searched the MSDN and everywhere else, and the only .h i could find was <Objbase.h> sadly this didnt work...
Thanks for any help.
ps, is there any good tutorials out there for TAPI, as i could only find one.
-
>>> <Objbase.h>
That's right. Make sure you have the most recent version of the COM SDK loaded.
-
Its going to be another late night... :'(
I have VC++ on WinXP surely that comes with the latest COM. Well I have searched the MSDN for the COM SDK but i couldnt find anything. Thanks heaps adrianxw for replying. How do i get the most recent version of the COM SDK? Thanks again.
-
It's in the latest Platform SDK. Sorry I'm in a hurry! Look around here!
http://msdn.microsoft.com/library/de...f_a2c_5iyg.asp
-
Hi guys;
sorry about bringing my old post back, its just that i waited on this while my update for VC++ downloaded hoping that it would allow me to compile a few very basic lines of code. Sadly it did not. :'(
ITTAPI * gpTapi;
int SetupTAPI()
{
// Initialize COM
CoInitializeEx(NULL, COINIT_MULTITHREADED);
//CoInitialize(NULL);
CoCreateInstance(
CLSID_TAPI,
NULL,
CLSCTX_INPROC_SERVER,
IID_ITTAPI,
(LPVOID *)&gpTapi
);
gpTapi->Initialize();
return 0;
}
i get the same error, 'CoInitializeEx' : undeclared identifier and 'COINIT_MULTITHREADED' : undeclared identifier
so i comment out that line and i get these errors.
WndCode.obj : error LNK2001: unresolved external symbol _CLSID_TAPI
WndCode.obj : error LNK2001: unresolved external symbol _IID_ITTAPI
can anyone please help me out. This is very basic code, and without it i cannot go any further. Thanks heaps guys.
-
I encountered the same problems you have described. You should always take a look at the header files (use a search to find the fn that is causing you grief).
The solution is simple and as far as I know, undocumented:
#define _WIN32_DCOM /*required for CoInitializeEx*/
BEFORE
#include <objbase.h> //for COM fns
That will get CoInitializeEx to work.
Happy coding! :D
(maybe I should register on this forum....?)
-
Hey thanks Unregistered for your help, i have no more problems with CoInitializeEx(). What i had to do tho was #define _WIN32_WINNT 0x0500 aswell as the DCOM. Thanks again mate.
Also does anyone else have any ideas with my other problem. Im still getting
WndCode.obj : error LNK2001: unresolved external symbol _CLSID_TAPI
WndCode.obj : error LNK2001: unresolved external symbol _IID_ITTAPI .
I have linked the .lib files, I searched the TAPI header and it said
but im still stumped on this one. Thanks heaps everyone.
-
'Tis only me...
At a guess try #defining these two constants and see whether that's all the old compiler is moaning about.