Announcement

Collapse
No announcement yet.

How to use MSDN Macros

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to use MSDN Macros

    Macros are listed in many of the MSDN topics, but I'm unable to find how I might access the MSDN-listed macros in PB. I can't even find the MSDN section that defines macros, much less gives the source code that makes up the macros.

    I managed to find one comment that the MSDN macros are similar to PB macros - at-compile substitutions.

    But I'm unable to find the source code listings for MSDN macros.

    Does anyone have experience with MSDN macros, and is there a way to (easily?) port them into PB?

  • #2
    You don't "access" C macros. They are inline code. You need to translate them to equivalent PB code, e.g.:

    Code:
    #define Static_SetIcon(hwndCtl, hIcon)          ((HICON)(UINT_PTR)SNDMSG((hwndCtl), STM_SETICON, (WPARAM)(HICON)(hIcon), 0L))
    Can be translated as:

    Code:
    MACRO Static_SetIcon(hwndCtl, hIcon) = SendMessage hwndCtl, %STM_SETICON, hIcon, 0
    or as:

    Code:
    SUB Static_SetIcon (BYVAL hwndCtl AS DWORD, BYVAL hIcon AS DWORD)
       SendMessage hwndCtl, %STM_SETICON, hIcon, 0
    END SUB
    But I'm unable to find the source code listings for MSDN macros.
    They are scattered through the Windows SDK C headers.
    Forum: http://www.jose.it-berater.org/smfforum/index.php

    Comment


    • #3
      Jose,

      The "scattering" seems to be the fact of life when it comes to information on Windows programming.

      This tongue-twister comes to mind:
      The good thing about this learning (PB/SDK programming) exercise is that the more I know, the more I know where the things are that I want to know. At the same time, I'm getting better at knowing the difference between what there is to know and what I need to know. You know?

      Thanks for the help!

      Comment


      • #4
        Then the more you know, you discover several ways to do the same thing and there in comes the rub. Which method to choose!

        James

        Comment


        • #5
          FWIW, a lot of those macros you see in "C" language interpretations/implementations of the Windows API are there to take advantage of/comply with the "inline data variable casting" feature/requirement of C.

          PB does not have inline casting (except for maybe the enhanced PEEK and POKE), so there is no need for macros to do that.
          Michael Mattias
          Tal Systems (retired)
          Port Washington WI USA
          [email protected]
          http://www.talsystems.com

          Comment

          Working...
          X