Discussion:
Initialize array of INPUTs?
(too old to reply)
Vincent Fatica
2009-08-07 13:44:42 UTC
Permalink
I do this to initialize a pair of INPUT structs used in a WH_MOUSE_LL HOOKPROC.
These initializations are never changed.

Global:
INPUT LeftClick[2] = { {INPUT_MOUSE, {0}}, {INPUT_MOUSE, {0}} };

Outside the HOOKPROC:
LeftClick[0].mi.dwFlags = MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_LEFTDOWN;
LeftClick[1].mi.dwFlags = MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_LEFTUP;

Can this be done inside the HOOKPROC with a single static declaration? If so,
how? Thanks.
--
- Vince
Vincent Fatica
2009-08-07 14:14:58 UTC
Permalink
On 7 Aug 2009 09:44:42 -0400, Vincent Fatica <***@blackholespam.net> wrote:

|I do this to initialize a pair of INPUT structs used in a WH_MOUSE_LL HOOKPROC.
|These initializations are never changed.
|
|Global:
|INPUT LeftClick[2] = { {INPUT_MOUSE, {0}}, {INPUT_MOUSE, {0}} };
|
|Outside the HOOKPROC:
|LeftClick[0].mi.dwFlags = MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_LEFTDOWN;
|LeftClick[1].mi.dwFlags = MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_LEFTUP;
|
|Can this be done inside the HOOKPROC with a single static declaration? If so,
|how? Thanks.

Apparently, the obvious works! I didn't think it would be that straightforward.

static INPUT LeftClick[2] =
{
{INPUT_MOUSE, {0, 0, 0, MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_LEFTDOWN, 0, 0}},
{INPUT_MOUSE, {0, 0, 0, MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_LEFTUP, 0, 0}}
};
--
- Vince
Loading...