@Dav You might want to modify the message so that the code you are pasting for the win.h is set for C++ or something that way it doesn't fail compilation. Since RETURN is capitalized it fails. The code seems to work in 32 but not in 64. WOW. It's amazing! I've been trying to get that to work forever but I just never could figure out how to make it work!
I’d say the difference in 32 and 64 bit Windows has to do with the packing of the data structures. 32-bit windows data is packed in 4-byte structures; 64-bit data is packed in 8-byte structures.
So, for example, let’s say the win type is something like:
TYPE WinData
x AS LONG
y AS LONG
END TYPE
In 32-bit windows, that’ll work just fine. In 64-bit windows, it’d need to be:
TYPE WinData
x AS LONG
padding as LONG ‘4 bytes padding to align to 8-byte structure
y AS LONG
padding2 AS LONG ‘4 more bytes padding to align to 8-byte structure
END TYPE
With both, you’re only passing long values back and forth for x and y, but 64-bit windows has that padding so things align as 8-byte structures instead of 4-byte. (64-bit vs 32-bit)
Now, with that said, here’s the head scratcher part: From my personal experience,
sometimes, it seems that windows will group items together to make those 8 bytes.
TYPE Example
x AS LONG
y AS LONG
z AS LONG
padding AS LONG
END TYPE
x and y
might be packed together, so they don’t need padding, but z would...
Translating 32-bit structures over to 64-bit structures has always been an exercise in trial-and-error and patience for me. If there’s some secret logic behind what gets grouped together, and what gets padding, I haven’t figured it out yet. Generally speaking, my knowledge on the packing rules is just enough that I know they’re the problem, but I’m not positive of the solution, so I just try everything over and over, until something sticks. :P