Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. COM
  4. basic question about COM

basic question about COM

Scheduled Pinned Locked Moved COM
csharpc++visual-studiocomsysadmin
8 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    liyang yu
    wrote on last edited by
    #1

    I am writing a very simple local COM server (exe), which has a Car class, a CarClassFactory, also a simple idl, everything goes well until the WinMain() file which provides the housing for the coclass and class factory, vC6.00 keeps saying the following:

    Deleting intermediate files and output files for project 'CarCOMExe - Win32 Debug'.
    --------------------Configuration: CarCOMExe - Win32 Debug--------------------
    Creating Type Library...
    Processing F:\COM\CarCOMExe\CarCOMExeTypeInfo.idl
    CarCOMExeTypeInfo.idl
    Processing F:\Microsoft Visual Development\Microsoft Visual Studio\VC98\INCLUDE\oaidl.idl
    oaidl.idl
    Processing F:\Microsoft Visual Development\Microsoft Visual Studio\VC98\INCLUDE\objidl.idl
    objidl.idl
    Processing F:\Microsoft Visual Development\Microsoft Visual Studio\VC98\INCLUDE\unknwn.idl
    unknwn.idl
    Processing F:\Microsoft Visual Development\Microsoft Visual Studio\VC98\INCLUDE\wtypes.idl
    wtypes.idl
    Compiling...
    StdAfx.cpp
    Compiling...
    Car.cpp
    CarClassFactory.cpp
    CarCOMExe.cpp
    f:\com\carcomexe\carclassfactory.h(13) : error C2504: 'IClassFactory' : base class undefined
    f:\com\carcomexe\carclassfactory.h(19) : error C2061: syntax error : identifier 'REFIID'
    f:\com\carcomexe\carclassfactory.h(25) : error C2061: syntax error : identifier 'LPUNKNOWN'
    F:\COM\CarCOMExe\CarCOMExe.cpp(32) : error C2065: 'CoInitialize' : undeclared identifier
    F:\COM\CarCOMExe\CarCOMExe.cpp(36) : error C2065: 'ITypeLib' : undeclared identifier
    F:\COM\CarCOMExe\CarCOMExe.cpp(36) : error C2065: 'pTLib' : undeclared identifier
    F:\COM\CarCOMExe\CarCOMExe.cpp(36) : error C2106: '=' : left operand must be l-value
    F:\COM\CarCOMExe\CarCOMExe.cpp(37) : error C2065: 'LoadTypeLibEx' : undeclared identifier
    F:\COM\CarCOMExe\CarCOMExe.cpp(37) : error C2065: 'REGKIND_REGISTER' : undeclared identifier
    F:\COM\CarCOMExe\CarCOMExe.cpp(38) : error C2227: left of '->Release' must point to class/struct/union
    F:\COM\CarCOMExe\CarCOMExe.cpp(48) : error C2065: 'CoRegisterClassObject' : undeclared identifier
    F:\COM\CarCOMExe\CarCOMExe.cpp(48) : error C2065: 'IClassFactory' : undeclared identifier
    F:\COM\CarCOMExe\CarCOMExe.cpp(48) : error C2059: syntax error : ')'
    F:\COM\CarCOMExe\CarCOMExe.cpp(61) : error C2065: 'CoRevokeClassObject' : undeclared identifier
    F:\COM\CarCOMExe\CarCOMExe.cpp(65) : error C2065: 'CoUninitialize' : undeclared identifier
    locks.cpp
    Generating Code...
    Error executing cl.exe.
    Creating browse info file...

    CoCarEXE.exe - 15 error(s), 0 warning(s)

    A V 2 Replies Last reply
    0
    • L liyang yu

      I am writing a very simple local COM server (exe), which has a Car class, a CarClassFactory, also a simple idl, everything goes well until the WinMain() file which provides the housing for the coclass and class factory, vC6.00 keeps saying the following:

      Deleting intermediate files and output files for project 'CarCOMExe - Win32 Debug'.
      --------------------Configuration: CarCOMExe - Win32 Debug--------------------
      Creating Type Library...
      Processing F:\COM\CarCOMExe\CarCOMExeTypeInfo.idl
      CarCOMExeTypeInfo.idl
      Processing F:\Microsoft Visual Development\Microsoft Visual Studio\VC98\INCLUDE\oaidl.idl
      oaidl.idl
      Processing F:\Microsoft Visual Development\Microsoft Visual Studio\VC98\INCLUDE\objidl.idl
      objidl.idl
      Processing F:\Microsoft Visual Development\Microsoft Visual Studio\VC98\INCLUDE\unknwn.idl
      unknwn.idl
      Processing F:\Microsoft Visual Development\Microsoft Visual Studio\VC98\INCLUDE\wtypes.idl
      wtypes.idl
      Compiling...
      StdAfx.cpp
      Compiling...
      Car.cpp
      CarClassFactory.cpp
      CarCOMExe.cpp
      f:\com\carcomexe\carclassfactory.h(13) : error C2504: 'IClassFactory' : base class undefined
      f:\com\carcomexe\carclassfactory.h(19) : error C2061: syntax error : identifier 'REFIID'
      f:\com\carcomexe\carclassfactory.h(25) : error C2061: syntax error : identifier 'LPUNKNOWN'
      F:\COM\CarCOMExe\CarCOMExe.cpp(32) : error C2065: 'CoInitialize' : undeclared identifier
      F:\COM\CarCOMExe\CarCOMExe.cpp(36) : error C2065: 'ITypeLib' : undeclared identifier
      F:\COM\CarCOMExe\CarCOMExe.cpp(36) : error C2065: 'pTLib' : undeclared identifier
      F:\COM\CarCOMExe\CarCOMExe.cpp(36) : error C2106: '=' : left operand must be l-value
      F:\COM\CarCOMExe\CarCOMExe.cpp(37) : error C2065: 'LoadTypeLibEx' : undeclared identifier
      F:\COM\CarCOMExe\CarCOMExe.cpp(37) : error C2065: 'REGKIND_REGISTER' : undeclared identifier
      F:\COM\CarCOMExe\CarCOMExe.cpp(38) : error C2227: left of '->Release' must point to class/struct/union
      F:\COM\CarCOMExe\CarCOMExe.cpp(48) : error C2065: 'CoRegisterClassObject' : undeclared identifier
      F:\COM\CarCOMExe\CarCOMExe.cpp(48) : error C2065: 'IClassFactory' : undeclared identifier
      F:\COM\CarCOMExe\CarCOMExe.cpp(48) : error C2059: syntax error : ')'
      F:\COM\CarCOMExe\CarCOMExe.cpp(61) : error C2065: 'CoRevokeClassObject' : undeclared identifier
      F:\COM\CarCOMExe\CarCOMExe.cpp(65) : error C2065: 'CoUninitialize' : undeclared identifier
      locks.cpp
      Generating Code...
      Error executing cl.exe.
      Creating browse info file...

      CoCarEXE.exe - 15 error(s), 0 warning(s)

      A Offline
      A Offline
      Anonymous
      wrote on last edited by
      #2

      Have you #included the following file into your program?

      #include <windows.h>

      -John

      L 3 Replies Last reply
      0
      • A Anonymous

        Have you #included the following file into your program?

        #include <windows.h>

        -John

        L Offline
        L Offline
        liyang yu
        wrote on last edited by
        #3

        yes, I did...

        1 Reply Last reply
        0
        • A Anonymous

          Have you #included the following file into your program?

          #include <windows.h>

          -John

          L Offline
          L Offline
          liyang yu
          wrote on last edited by
          #4

          Yes,I did. In fact, I did the following:

          #include "stdafx.h"

          which includes windows.h.

          1 Reply Last reply
          0
          • A Anonymous

            Have you #included the following file into your program?

            #include <windows.h>

            -John

            L Offline
            L Offline
            liyang yu
            wrote on last edited by
            #5

            It took me a day to figure this out: I am using VC 6.00, and my stdafx.h looks like this: #if !defined(AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_) #define AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers #include // TODO: reference additional headers your program requires here //{{AFX_INSERT_LOCATION}} // Microsoft Visual C++ will insert additional declarations immediately before the previous line. #endif // !defined(AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_) you need to get rid of #define WIN32_LEAN_AND_MEAN to make a simple local COM server work!! Thanks!

            L 1 Reply Last reply
            0
            • L liyang yu

              It took me a day to figure this out: I am using VC 6.00, and my stdafx.h looks like this: #if !defined(AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_) #define AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers #include // TODO: reference additional headers your program requires here //{{AFX_INSERT_LOCATION}} // Microsoft Visual C++ will insert additional declarations immediately before the previous line. #endif // !defined(AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_) you need to get rid of #define WIN32_LEAN_AND_MEAN to make a simple local COM server work!! Thanks!

              L Offline
              L Offline
              Lost User
              wrote on last edited by
              #6

              Are u using ATL??? ------------------------- Have a great day ahead! Regards, Sohail Kadiwala (My COM Blog - http://lovecom.blogspot.com)

              L 1 Reply Last reply
              0
              • L Lost User

                Are u using ATL??? ------------------------- Have a great day ahead! Regards, Sohail Kadiwala (My COM Blog - http://lovecom.blogspot.com)

                L Offline
                L Offline
                liyang yu
                wrote on last edited by
                #7

                no, plain COM.

                1 Reply Last reply
                0
                • L liyang yu

                  I am writing a very simple local COM server (exe), which has a Car class, a CarClassFactory, also a simple idl, everything goes well until the WinMain() file which provides the housing for the coclass and class factory, vC6.00 keeps saying the following:

                  Deleting intermediate files and output files for project 'CarCOMExe - Win32 Debug'.
                  --------------------Configuration: CarCOMExe - Win32 Debug--------------------
                  Creating Type Library...
                  Processing F:\COM\CarCOMExe\CarCOMExeTypeInfo.idl
                  CarCOMExeTypeInfo.idl
                  Processing F:\Microsoft Visual Development\Microsoft Visual Studio\VC98\INCLUDE\oaidl.idl
                  oaidl.idl
                  Processing F:\Microsoft Visual Development\Microsoft Visual Studio\VC98\INCLUDE\objidl.idl
                  objidl.idl
                  Processing F:\Microsoft Visual Development\Microsoft Visual Studio\VC98\INCLUDE\unknwn.idl
                  unknwn.idl
                  Processing F:\Microsoft Visual Development\Microsoft Visual Studio\VC98\INCLUDE\wtypes.idl
                  wtypes.idl
                  Compiling...
                  StdAfx.cpp
                  Compiling...
                  Car.cpp
                  CarClassFactory.cpp
                  CarCOMExe.cpp
                  f:\com\carcomexe\carclassfactory.h(13) : error C2504: 'IClassFactory' : base class undefined
                  f:\com\carcomexe\carclassfactory.h(19) : error C2061: syntax error : identifier 'REFIID'
                  f:\com\carcomexe\carclassfactory.h(25) : error C2061: syntax error : identifier 'LPUNKNOWN'
                  F:\COM\CarCOMExe\CarCOMExe.cpp(32) : error C2065: 'CoInitialize' : undeclared identifier
                  F:\COM\CarCOMExe\CarCOMExe.cpp(36) : error C2065: 'ITypeLib' : undeclared identifier
                  F:\COM\CarCOMExe\CarCOMExe.cpp(36) : error C2065: 'pTLib' : undeclared identifier
                  F:\COM\CarCOMExe\CarCOMExe.cpp(36) : error C2106: '=' : left operand must be l-value
                  F:\COM\CarCOMExe\CarCOMExe.cpp(37) : error C2065: 'LoadTypeLibEx' : undeclared identifier
                  F:\COM\CarCOMExe\CarCOMExe.cpp(37) : error C2065: 'REGKIND_REGISTER' : undeclared identifier
                  F:\COM\CarCOMExe\CarCOMExe.cpp(38) : error C2227: left of '->Release' must point to class/struct/union
                  F:\COM\CarCOMExe\CarCOMExe.cpp(48) : error C2065: 'CoRegisterClassObject' : undeclared identifier
                  F:\COM\CarCOMExe\CarCOMExe.cpp(48) : error C2065: 'IClassFactory' : undeclared identifier
                  F:\COM\CarCOMExe\CarCOMExe.cpp(48) : error C2059: syntax error : ')'
                  F:\COM\CarCOMExe\CarCOMExe.cpp(61) : error C2065: 'CoRevokeClassObject' : undeclared identifier
                  F:\COM\CarCOMExe\CarCOMExe.cpp(65) : error C2065: 'CoUninitialize' : undeclared identifier
                  locks.cpp
                  Generating Code...
                  Error executing cl.exe.
                  Creating browse info file...

                  CoCarEXE.exe - 15 error(s), 0 warning(s)

                  V Offline
                  V Offline
                  vikramlinux
                  wrote on last edited by
                  #8

                  As You are using IClassFactory interafce , give it's declartion too include unknwn.h

                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • World
                  • Users
                  • Groups