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. What does "THIS_" mean?

What does "THIS_" mean?

Scheduled Pinned Locked Moved COM
3 Posts 2 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.
  • D Offline
    D Offline
    d3m0n
    wrote on last edited by
    #1

    Hi The COM interfaces in my application derive from IUnknown. But some interface functions are declared using the "THIS_" parameter, some with "THIS" and some with none. For example:

    1. STDMETHOD(DoBlah1) (THIS_ UINT uNum) PURE;
    2. STDMETHOD(DoBlah2) (UINT uNum) PURE;

    1. STDMETHOD(DoBlah3) (THIS_) PURE;
    2. STDMETHOD(DoBlah4) (THIS) PURE;
    3. STDMETHOD(DoBlah5) () PURE;

    I would like to know whether the "THIS_" or "THIS" keywords are necessary, and what would be the difference between these functions. (I couldn't find the definitions of THIS or THIS_ in the VC browser or on the net...:~ )

    Cheers d3m0n

    R 1 Reply Last reply
    0
    • D d3m0n

      Hi The COM interfaces in my application derive from IUnknown. But some interface functions are declared using the "THIS_" parameter, some with "THIS" and some with none. For example:

      1. STDMETHOD(DoBlah1) (THIS_ UINT uNum) PURE;
      2. STDMETHOD(DoBlah2) (UINT uNum) PURE;

      1. STDMETHOD(DoBlah3) (THIS_) PURE;
      2. STDMETHOD(DoBlah4) (THIS) PURE;
      3. STDMETHOD(DoBlah5) () PURE;

      I would like to know whether the "THIS_" or "THIS" keywords are necessary, and what would be the difference between these functions. (I couldn't find the definitions of THIS or THIS_ in the VC browser or on the net...:~ )

      Cheers d3m0n

      R Offline
      R Offline
      Roger Stoltz
      wrote on last edited by
      #2

      THIS_, THIS and PURE are macros defined in basetyps.h and objbase.h. They are used for portability reasons with plain C, thus the code will compile with a C-compiler if written correctly. Have a look at Jeff Glatt's article serie about COM in plain C. You'll find the first article here[^]. You'll find the other parts, 2 to 8, in various chapters below the COM section here[^].


      "It's supposed to be hard, otherwise anybody could do it!" - selfquote
      "High speed never compensates for wrong direction!" - unknown

      D 1 Reply Last reply
      0
      • R Roger Stoltz

        THIS_, THIS and PURE are macros defined in basetyps.h and objbase.h. They are used for portability reasons with plain C, thus the code will compile with a C-compiler if written correctly. Have a look at Jeff Glatt's article serie about COM in plain C. You'll find the first article here[^]. You'll find the other parts, 2 to 8, in various chapters below the COM section here[^].


        "It's supposed to be hard, otherwise anybody could do it!" - selfquote
        "High speed never compensates for wrong direction!" - unknown

        D Offline
        D Offline
        d3m0n
        wrote on last edited by
        #3

        Thank you very much Roger, that is a perfect answer for me. :rose: I'll ensure that all my interfaces contain the THIS_ and THIS macros.

        Cheers d3m0n

        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