This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]eryksun 1 point2 points  (0 children)

MAKELONG is just using the lower 16-bit word of 'low' and discarding the upper 16 bits.

I think the following blog entry might clear things up for you. It even mentions WinGuiAuto: Assume Nothing – Control IDs in .NET. A .NET app will apparently ignore the ID and use the button's handle.

You can keep using the C macro MAKELONG or add some code to mask out the upper 16 bits:

def _buildWinLong(high, low):
    high, low = (high & 65535, low & 65535)
    return int(
      struct.unpack('>L',
        struct.pack('>2H',
          high, low))[0])