|
From: Oleg S. <se...@ma...> - 2002-01-03 02:40:35
|
Rodney Stromlund wrote:
>
> I am trying (w/o success) to use a new W32 API call : SendInput.
>
> Compatibility: NT 4.0(SP3) or later; Win 98 or later; CE Unsupported.
>
> I have NT4.0(SP6). I included the following in my source file (script.c):
>
/****************************************************************************
These API calls are missing from my winuser.h file:
****************************************************************************/
typedef struct tagMOUSEINPUT {
DWORD dx;
DWORD dy;
DWORD mouseData;
DWORD dwFlags;
DWORD time;
DWORD dwExtraInfo;
} MOUSEINPUT, *LPMOUSEINPUT;
typedef struct tagKEYBDINPUT {
WORD wVk;
WORD wScan;
DWORD dwFlags;
DWORD time;
DWORD dwExtraInfo;
} KEYBDINPUT, *LPKEYBDINPUT;
#define VK_P80 /* using vbKeyP instead would also work */
#define KEYEVENTF_KEYUP 2
typedef struct tagINPUT_TYPE {
DWORD type;
union {
MOUSEINPUT mi;
KEYBDINPUT ki;
};
} INPUT, INPUT_TYPE, *LPINPUT_TYPE;
#define INPUT_KEYBOARD 1
#define INPUT_MOUSE 0
LRESULT WINAPI SendInput( DWORD nInputs, LPINPUT_TYPE pInputs, DWORD
cbSize);
/****************************************************************************
****************************************************************************/
>
> I compile like so:
>
> >make
> gcc -c -mwindows -mno-cygwin script.c
> gcc -o script.exe -mwindows -mno-cygwin script.o script.res -luser32
> script.o(.text+0x1ab4):script.c: undefined reference to `SendInput@12'
> script.o(.text+0x1c72):script.c: undefined reference to `SendInput@12'
> script.o(.text+0x1e37):script.c: undefined reference to `SendInput@12'
> script.o(.text+0x1ec9):script.c: undefined reference to `SendInput@12'
> collect2: ld returned 1 exit status
> make: *** [script.exe] Error 1
[ ... ]
> What am I doing wrong? How can I regenerate libraries for the standard W32 API dlls?
> I declared SendInput exactly like the other calls from winuser.h.
SendInput hasn't been included in Mingw distribution yet, at least I
haven't
found it in CVS, so you could use something like that:
create header file for missed declarations, say si.h,
# pexports.exe -h si.h USER32.DLL | grep
"^\\(LIBRARY\\|EXPORTS\\|SendInput\\)" > USER32-ext.Def
or just create def file
# echo "LIBRARY USER32.dll" > user32-ext.def
# echo "EXPORTS" >> user32-ext.def
# echo "SendInput@12" >> user32-ext.def
and then create new import library
# dlltool -k -l libuser32-ext.a -d user32-ext.def
add following switches while linking: -L <path/to/libuser32-ext.a>
-luser32-ext
or you could download w32api package, modify <include/winuser.h> and
<lib/user32.def>
accordingly, recompile, and submit patches.
Oleg Sesov
|