[ANN] au3 0.1.1 released

H

Heesob Park

2009/12/30 Marvin G=C3=BClker said:
Works great! But I have a question about the 0.chr line: Why do you need
to append 8 extra bytes to achieve a size of 28 bytes? I guess, it has
something to do with C's array treatment?
As you know, the INPUT structure defined like this:

typedef struct tagINPUT {
DWORD type;
union {MOUSEINPUT mi;
KEYBDINPUT ki;
HARDWAREINPUT hi;
};
}INPUT, *PINPUT;

typedef struct tagMOUSEINPUT {
LONG dx;
LONG dy;
DWORD mouseData;
DWORD dwFlags;
DWORD time;
ULONG_PTR dwExtraInfo;
} MOUSEINPUT, *PMOUSEINPUT;

typedef struct tagKEYBDINPUT {
WORD wVk;
WORD wScan;
DWORD dwFlags;
DWORD time;
ULONG_PTR dwExtraInfo;
} KEYBDINPUT, *PKEYBDINPUT;

typedef struct tagHARDWAREINPUT {
DWORD uMsg;
WORD wParamL;
WORD wParamH;
} HARDWAREINPUT, *PHARDWAREINPUT;

The sizeof(MOUSEINPUT) is 24, sizeof(KEYBDINPUT) is 16, and
sizeof(HARDWAREINPUT) is 8.
Therefore, sizeof(INPUT) =3D sizeof(DWORD) + maxsizeof(union) =3D 4 + 24 =
=3D 28.

Regards,

Park Heesob
 
M

Marvin Gülker

Heesob said:
As you know, the INPUT structure defined like this:

typedef struct tagINPUT {
DWORD type;
union {MOUSEINPUT mi;
KEYBDINPUT ki;
HARDWAREINPUT hi;
};
}INPUT, *PINPUT;

typedef struct tagMOUSEINPUT {
LONG dx;
LONG dy;
DWORD mouseData;
DWORD dwFlags;
DWORD time;
ULONG_PTR dwExtraInfo;
} MOUSEINPUT, *PMOUSEINPUT;

typedef struct tagKEYBDINPUT {
WORD wVk;
WORD wScan;
DWORD dwFlags;
DWORD time;
ULONG_PTR dwExtraInfo;
} KEYBDINPUT, *PKEYBDINPUT;

typedef struct tagHARDWAREINPUT {
DWORD uMsg;
WORD wParamL;
WORD wParamH;
} HARDWAREINPUT, *PHARDWAREINPUT;

The sizeof(MOUSEINPUT) is 24, sizeof(KEYBDINPUT) is 16, and
sizeof(HARDWAREINPUT) is 8.
Therefore, sizeof(INPUT) = sizeof(DWORD) + maxsizeof(union) = 4 + 24 =
28.

Regards,

Park Heesob

Thank you again, now I've got the point. One last question: The size of
the MOUSEINPUT struct is 8 + 8 + 4 + 4 + 4 = 28 I see, so am I right in
thinking that the pointer isn't important for this computation?
Otherwise, since it's an unsigned long, it should have a size of 8 also,
what makes the struct a size of 36 bytes? Or is this ignored because of
passing in nil later?

You see, I'm not really good in working with C structs. :)

Marvin
 
M

Marvin Gülker

Marvin said:
Thank you again, now I've got the point. One last question: The size of
the MOUSEINPUT struct is 8 + 8 + 4 + 4 + 4 = 28 I see, so am I right in
thinking that the pointer isn't important for this computation?
Otherwise, since it's an unsigned long, it should have a size of 8 also,
what makes the struct a size of 36 bytes? Or is this ignored because of
passing in nil later?

You see, I'm not really good in working with C structs. :)

Marvin

Forget it. I didn't read it well enough.

Thanks!

Marvin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,161
Messages
2,570,892
Members
47,431
Latest member
ElyseG3173

Latest Threads

Top