Announcement

Collapse
No announcement yet.

Maklng

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

  • Maklng

    I have seen MAKLNG used in some coding on here, for instance, SendMessage hWnd&, %BM_SETSTYLE, %BS_PUSHBUTTON, MAKLNG(%TRUE, 0). What is MAKLNG and what is it used for.

    Thanks for any help.

  • #2
    MKLNG has been replaced by MAK(LONG, ... in recent compilers. See MAK in PBHelp.

    Copy of previous help topic.

    Click image for larger version

Name:	MAKLNG.PNG
Views:	96
Size:	16.6 KB
ID:	786937
    Rgds, Dave

    Comment


    • #3
      MAKLNG takes two 16 bit values and uses them as upper 16 and lower 16 in the returned 32 bit LONG.

      A Windows message format has two 32 bit parameters after the MSG parameter. They are named WPARAM and LPARAM. To send two values (each 65K max) after WPARAM is used, requires combining into the 32 bit LPARAM.

      ((in the example you gave (%BM_SETSTYLE) the LPARAM is a 32bit TRUE (any bit a 1) or a 32 bit FALSE (all bits 0); the MAKLNG is not needed))

      MAKLNG is old syntax. Current syntax is MAK(LONG, lo16var, hi16var)

      Doing the opposite, splitting a variable into half size variables, are HI() and LO().

      Cheers,


      Dale

      Comment


      • #4
        Thanks guys that clears it up a little.

        Comment


        • #5
          Originally posted by Dale Yarker View Post
          ((in the example you gave (%BM_SETSTYLE) the LPARAM is a 32bit TRUE (any bit a 1) or a 32 bit FALSE (all bits 0)
          Not exactly.
          The Low Word of LPARAM needs to be either True of False..Whether or not any of the upper 16 bits are set does not affect the redraw.

          MAKLNG(%TRUE, 0) and MAKLNG(0,%TRUE) have opposite results in this case

          Comment


          • #6
            Whether or not any of the upper 16 bits are set does not affect the redraw.
            Correct. So using MAKLNG is a useless distinction [add], but correct.

            (( add "... in this case .."))

            Cheers,
            Dale

            Comment


            • #7
              How to avoid the confusion.
              Code:
              ' ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
              
               FUNCTION PBmain as LONG
              
                  LOCAL lvar as LONG
                  LOCAL uvar as DWORD
              
                  ! mov ax, 65535
                  ! rol eax, 16
                  ! mov ax, 65535
              
                  ! mov lvar, eax
                  ! mov uvar, eax
              
                  StdOut format$(lvar)+" LONG"
                  StdOut format$(uvar)+" DWORD
              
                  waitkey$
              
               End FUNCTION
              
              ' ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
              hutch at movsd dot com
              The MASM Forum

              www.masm32.com

              Comment


              • #8
                Most of you already knows this but as an update, especially for our younger PB fellows - in 16-bit Windows, wparam meant 16-bit unsigned (>=0) Word Parameter and lparam was a 32-bit signed (<=>0) Long Parameter. In 32-bit windows, wparam changed to a 32-bit unsigned DWORD, so the reason lparam often is two 16-bit hi/lo variables has an old history behind it. To remember which one comes first of wparam and lparam, I long ago started thinking of lparam as "Last Param". And while we are not there (yet?) in PB world - in 64-bit Windows, wparam is a 64-bit unsigned, while lparam is a 64-bit signed variable.

                Comment

                Working...
                X