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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. ATL / WTL / STL
  4. exports enum from COM

exports enum from COM

Scheduled Pinned Locked Moved ATL / WTL / STL
c++comhelpquestion
5 Posts 3 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.
  • V Offline
    V Offline
    vijay victory
    wrote on last edited by
    #1

    hi experts, Currently I m doing a COM DLL which exports some functions and enums structures. can anybody help me to exports the enums from COM. my enum definition is like this: typedef enum LANG{ HIN,ENG,MAR,JAP,CAN }LANG; how can i declare this so that i can use it in client side using VB. and I m using VC++ 6.0 and VB 6.0 plz help me. thanx in advance., regards, Victory

    J S 2 Replies Last reply
    0
    • V vijay victory

      hi experts, Currently I m doing a COM DLL which exports some functions and enums structures. can anybody help me to exports the enums from COM. my enum definition is like this: typedef enum LANG{ HIN,ENG,MAR,JAP,CAN }LANG; how can i declare this so that i can use it in client side using VB. and I m using VC++ 6.0 and VB 6.0 plz help me. thanx in advance., regards, Victory

      J Offline
      J Offline
      Jonathan Davies
      wrote on last edited by
      #2

      I did a quick search for enum in my .idl files and found the following where an enum is used as a parameter in an interface if its of any help. This was definitly for VC++ 6.0 COM called from VB.

      typedef [v1_enum] enum CoolingSystem
      {
      System1 = 0x00000001,
      System2 = 0x00000002
      }CoolingSystem;

      [
      uuid(B30CF430-3E47-11D5-8088-0050DAD52C1D),
      helpstring("IFridge Control Interface"),
      ]
      interface IFridgeControl : IUnknown
      {
      [id(0x00000001), helpstring("Select working System")]
      HRESULT SelectSystem([in] CoolingSystem System);

      J V 2 Replies Last reply
      0
      • V vijay victory

        hi experts, Currently I m doing a COM DLL which exports some functions and enums structures. can anybody help me to exports the enums from COM. my enum definition is like this: typedef enum LANG{ HIN,ENG,MAR,JAP,CAN }LANG; how can i declare this so that i can use it in client side using VB. and I m using VC++ 6.0 and VB 6.0 plz help me. thanx in advance., regards, Victory

        S Offline
        S Offline
        Stuart Dootson
        wrote on last edited by
        #3

        Make sure the enum is in the 'library' part of the IDL file: I just built and registered a little COM DLL with this IDL:

        import "oaidl.idl";
        import "ocidl.idl";

        [
        uuid(AB41E782-D178-47AA-950A-91406234E0A5),
        version(1.0),
        helpstring("aa 1.0 Type Library")
        ]
        library aaLib
        {
        importlib("stdole2.tlb");
        typedef enum LANG{ HIN,ENG,MAR,JAP,CAN }LANG;
        };

        Opening it in the Object Browser in Word's VBA IDE showed the enumerated type and the enumerations. HTH!!!

        1 Reply Last reply
        0
        • J Jonathan Davies

          I did a quick search for enum in my .idl files and found the following where an enum is used as a parameter in an interface if its of any help. This was definitly for VC++ 6.0 COM called from VB.

          typedef [v1_enum] enum CoolingSystem
          {
          System1 = 0x00000001,
          System2 = 0x00000002
          }CoolingSystem;

          [
          uuid(B30CF430-3E47-11D5-8088-0050DAD52C1D),
          helpstring("IFridge Control Interface"),
          ]
          interface IFridgeControl : IUnknown
          {
          [id(0x00000001), helpstring("Select working System")]
          HRESULT SelectSystem([in] CoolingSystem System);

          J Offline
          J Offline
          Jonathan Davies
          wrote on last edited by
          #4

          Having found the VB files that used this interface to call C++ implemented COM I see: An object declared usaing the tlb namespace: Dim WithEvents m_objController As CONTROLLERLib.CoController Then in a sub procedure I can type the namespace CONTROLLERLib and on typing the . after it the intelli-sense displayes all the enumerated values from the .idl file. I can then type: CONTROLLERLib.CoolingSystem = CONTROLLERLib.System2 though I don't think this correct and I'm not set up to try actually run antything I also came across the enum (CoolingSystem) used in a VB Sub declaration: Private Sub m_objController_TemperatureChanged(ByVal ErrorCode As Long, ByVal System As CONTROLLERLib.CoolingSystem, ... Maybe it's something to go on.

          1 Reply Last reply
          0
          • J Jonathan Davies

            I did a quick search for enum in my .idl files and found the following where an enum is used as a parameter in an interface if its of any help. This was definitly for VC++ 6.0 COM called from VB.

            typedef [v1_enum] enum CoolingSystem
            {
            System1 = 0x00000001,
            System2 = 0x00000002
            }CoolingSystem;

            [
            uuid(B30CF430-3E47-11D5-8088-0050DAD52C1D),
            helpstring("IFridge Control Interface"),
            ]
            interface IFridgeControl : IUnknown
            {
            [id(0x00000001), helpstring("Select working System")]
            HRESULT SelectSystem([in] CoolingSystem System);

            V Offline
            V Offline
            vijay victory
            wrote on last edited by
            #5

            Thanx budy.. it works.. but i dont want it to add into COM property.. so only above declaration got useful

            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