Initialize COM

This is a discussion on Initialize COM within the Windows Programming forums, part of the Platform Specific Boards category; Hi all; Sorry to ask this question but Im trying to Initialize COM using CoInitializeEx(NULL, COINIT_MULTITHREADED); for a TAPI program ...

  1. #1
    Registered User The15th's Avatar
    Join Date
    Aug 2001
    Posts
    125

    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.
    arrh, i got nothing good to say.
    http://www.praxis1.vic.edu.au/home/dcola/

  2. #2
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    Posts
    4,831
    >>> <Objbase.h>

    That's right. Make sure you have the most recent version of the COM SDK loaded.
    Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.

  3. #3
    Registered User The15th's Avatar
    Join Date
    Aug 2001
    Posts
    125
    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.

  4. #4
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    Posts
    4,831
    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
    Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.

  5. #5
    Registered User The15th's Avatar
    Join Date
    Aug 2001
    Posts
    125
    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.
    arrh, i got nothing good to say.
    http://www.praxis1.vic.edu.au/home/dcola/

  6. #6
    Unregistered
    Guest
    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!

    (maybe I should register on this forum....?)

  7. #7
    Registered User The15th's Avatar
    Join Date
    Aug 2001
    Posts
    125
    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.
    arrh, i got nothing good to say.
    http://www.praxis1.vic.edu.au/home/dcola/

  8. #8
    Unregistered
    Guest
    'Tis only me...

    At a guess try #defining these two constants and see whether that's all the old compiler is moaning about.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 3
    Last Post: 04-10-2009, 03:20 AM
  2. how to initialize char *
    By vignesh in forum C Programming
    Replies: 3
    Last Post: 03-30-2009, 02:17 AM
  3. How do you use variable to initialize array size?
    By yougene in forum C Programming
    Replies: 11
    Last Post: 09-04-2007, 03:50 PM
  4. initialize constant and initialization list
    By sawer in forum C++ Programming
    Replies: 5
    Last Post: 07-09-2006, 07:30 AM
  5. using constructor to initialize data
    By Unregistered in forum C++ Programming
    Replies: 6
    Last Post: 03-19-2002, 08:55 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21