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. C#
  4. Importing Macros from C header files?

Importing Macros from C header files?

Scheduled Pinned Locked Moved C#
csharpquestionwinformslinux
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.
  • I Offline
    I Offline
    iliyang
    wrote on last edited by
    #1

    I hope this question don't win "The Most Stupid Question Of The Day" prize, but I was just wondering if there is an easy way to import the macros from some C header files (like CommCtrl.h) in C#. Cause they're very handy and the WinForms controls don't provide all of the functionality of the Windows Shell controlls.

    C D 2 Replies Last reply
    0
    • I iliyang

      I hope this question don't win "The Most Stupid Question Of The Day" prize, but I was just wondering if there is an easy way to import the macros from some C header files (like CommCtrl.h) in C#. Cause they're very handy and the WinForms controls don't provide all of the functionality of the Windows Shell controlls.

      C Offline
      C Offline
      Colin Angus Mackay
      wrote on last edited by
      #2

      If you are just doing things like

      #define SOME_VALUE 0x80012022

      then you change it into

      const uint SOME_VALUE = 0x80012022

      However, if the macro expands out to to some code then you cannot do that in C#


      My: Blog | Photos WDevs.com - Open Source Code Hosting, Blogs, FTP, Mail and More

      1 Reply Last reply
      0
      • I iliyang

        I hope this question don't win "The Most Stupid Question Of The Day" prize, but I was just wondering if there is an easy way to import the macros from some C header files (like CommCtrl.h) in C#. Cause they're very handy and the WinForms controls don't provide all of the functionality of the Windows Shell controlls.

        D Offline
        D Offline
        Dave Kreskowiak
        wrote on last edited by
        #3

        C# doesn't support header files and there is no utility to "import" them from other languages. You'll have to recode, by hand, what you want out of the header into C# code and make sure it ends up in an appropriate place in your code. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

        I 1 Reply Last reply
        0
        • D Dave Kreskowiak

          C# doesn't support header files and there is no utility to "import" them from other languages. You'll have to recode, by hand, what you want out of the header into C# code and make sure it ends up in an appropriate place in your code. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

          I Offline
          I Offline
          iliyang
          wrote on last edited by
          #4

          OK, thanks for both replies. The hidden idea in the question was also to find someone that has already done that ;)

          D 1 Reply Last reply
          0
          • I iliyang

            OK, thanks for both replies. The hidden idea in the question was also to find someone that has already done that ;)

            D Offline
            D Offline
            Dave Kreskowiak
            wrote on last edited by
            #5

            The problem with writing a translator for this is it has no clue in what context translated code should be in and, therefore, can't predict where the new code should go. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

            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