Thread: What is COM?

  1. #1
    Registered User
    Join Date
    Mar 2005
    Posts
    69

    What is COM?

    What is COM (Common Object Model) ?

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,661
    Well assuming you really meant Component Object Model (since this is windows)
    http://whatis.techtarget.com/definit...211823,00.html

    May I suggest next time using google
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Registered User
    Join Date
    Mar 2005
    Posts
    69
    Quote Originally Posted by Salem
    Well assuming you really meant Component Object Model (since this is windows)
    http://whatis.techtarget.com/definit...211823,00.html

    May I suggest next time using google

    whops!! you're right,it was Component Object Model

  4. #4
    Registered User
    Join Date
    Mar 2005
    Posts
    69
    Is it true that,in order to write a working non-.NET DirectX application,it is necessary to register a COM object into the registry??

  5. #5
    Registered User
    Join Date
    Jan 2005
    Posts
    847
    Quote Originally Posted by Lionel
    Is it true that,in order to write a working non-.NET DirectX application,it is necessary to register a COM object into the registry??
    No. Directx dose have a COM interface though.

  6. #6
    Registered User
    Join Date
    Mar 2005
    Posts
    69
    Quote Originally Posted by Quantum1024
    No. Directx dose have a COM interface though.

    If i'd want to write a game that
    uses DirectDraw,DirectSound and Direct3D i'm not compelled to
    register GUIDs in the registry,is it right?
    Last edited by Lionel; 05-16-2005 at 07:08 AM.

  7. #7
    Registered User
    Join Date
    Jan 2005
    Posts
    847
    Quote Originally Posted by Lionel
    If i'd want to write a game that
    uses DirectDraw,DirectSound and Direct3D i'm not compelled to
    register GUIDs in the registry,is it right?
    Thats right. You are not trying to expose a COM object for other applications to use you are just calling meathods from the directx interface.

  8. #8
    Captain - Lover of the C
    Join Date
    May 2005
    Posts
    341
    DirectX uses COM and has all the basic features of COM like the IUnknown Interface. It uses Release, QueryInterface, and all that other stuff but you don't have to deal with it if you don't want to. Here is code to create you DDirectDraw Object.

    Code:
    LPDIRECTDRAW7 lpdd7 = NULL;
    
    DirectDrawCreateEx(NULL, (void**)&lpdd7, 
                                     ID_IDirectDraw7, NULL);
    You don't even have to make a call to CoInitialize() or CoCreateInstance().

    Then you can use your new interface like this:

    Code:
    lpdd7->SetCooperativeLevel(hwnd, DDSCL_FULLSCREEN | 
                                                  DDSCL_ALLOWMODEX | 
                                                  DDSCL_EXCLUSIVE | 
                                                  DDSCL_ALLOWREBOOT);
    
    lpdd7->SetDisplayMode(640, 480, 32, 0, 0);
    And Ta Da, you have a fullscreen application with a resolution of 640 by 480 with 32 bits of color.
    Don't quote me on that... ...seriously

  9. #9
    Registered User
    Join Date
    Mar 2005
    Posts
    69
    thx you're so kind!

Popular pages Recent additions subscribe to a feed