Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[winapi] jak podlinkowac dynamicznie RawInput

12 views
Skip to first unread message

prof fir

unread,
May 29, 2012, 8:46:32 AM5/29/12
to
RawInput to kawalek winapi (wprowadzony w xp) ktorym mozna
obslugiwac np piec myszy na raz i tez inne inputy

definice siedza pod koniec winuser.h a wywolania siedza
w user32.dll, jako ze nie mam jeszcze doswiadczenia
w linkowaniu dlli i jjestem zmeczony i nie chce mi sie
czytac tutoriali, moze ktos sie nudzi i podalby mi
przyklad z reki jak podlinkowac sie dynamicznie do tego
tak by moc odpalic np taki kod na poczatek:

define WM_INPUT 0x00FF
char mousemessage[256]; // this is the string we draw to the screen for the
first mouse
char mousemessage2[256]; // this is the string we draw to the screen for the
second mouse
char rawinputdevices[256]; // string with number of raw input devices


void InitRawInput() {
RAWINPUTDEVICE Rid[50]; // allocate storage for 50 device (not going
to need this many :) )

UINT nDevices;
PRAWINPUTDEVICELIST pRawInputDeviceList;
if (GetRawInputDeviceList(NULL, &nDevices, sizeof
(RAWINPUTDEVICELIST)) != 0) {
return ;
}
pRawInputDeviceList = (RAWINPUTDEVICELIST *)malloc(sizeof
(RAWINPUTDEVICELIST) * nDevices);
GetRawInputDeviceList(pRawInputDeviceList, &nDevices, sizeof
(RAWINPUTDEVICELIST));
// do the job...
wsprintf(rawinputdevices,"Number of raw input devices: %i\n\n",
nDevices);


// after the job, free the RAWINPUTDEVICELIST
free(pRawInputDeviceList);


Rid[0].usUsagePage = 0x01;
Rid[0].usUsage = 0x02;
Rid[0].dwFlags =0;// RIDEV_NOLEGACY; // adds HID mouse and also
ignores legacy mouse messages
Rid[0].hwndTarget = NULL;

if (RegisterRawInputDevices(Rid, 1, sizeof (Rid [0])) == FALSE) {
wsprintf(mousemessage,"RawInput init failed:\n");
//registration failed.
}
return ;
}


?????

TNX


--
Wysłano z serwisu Usenet w portalu Gazeta.pl -> http://www.gazeta.pl/usenet/

f...@nospam.gazeta.pl

unread,
May 29, 2012, 11:33:37 AM5/29/12
to
ok, znalazlem przyklad,

void testDelelels()
{
HINSTANCE hinstance ;

hinstance = LoadLibrary ( "USER32.DLL" ) ;

if ( hinstance != NULL )
{
FARPROC proc ;

proc = GetProcAddress ( hinstance , "GetRawInputDeviceList" ) ;

if ( proc != (FARPROC)NULL )
{
// (*proc) ( );
}

FreeLibrary ( hinstance ) ;
}


}

nie wywala bledu wiec chyba linkuje,

pozniej zobacze czy te dwie mice zadzialają

fir

unread,
May 30, 2012, 3:27:44 AM5/30/12
to
<f...@NOSPAM.gazeta.pl> napisaďż˝(a):

> ok, znalazlem przyklad,
>
> void testDelelels()
> {
> HINSTANCE hinstance ;
>
> hinstance = LoadLibrary ( "USER32.DLL" ) ;
>
> if ( hinstance != NULL )
> {
> FARPROC proc ;
>
> proc = GetProcAddress ( hinstance , "GetRawInputDeviceList" ) ;
>
> if ( proc != (FARPROC)NULL )
> {
> // (*proc) ( );
> }
>
> FreeLibrary ( hinstance ) ;
> }
>
>
> }
>
> nie wywala bledu wiec chyba linkuje,
>
> pozniej zobacze czy te dwie mice zadzialajďż˝
>


wyglada na to ze dzia�a, jestem zadowolony, chyba nawet
moglbym podlaczyc i 10 myszy

co prawda ciekawostka okazuje sie ze jak wpiac do windy
dwie mousy (bez zadnego kodu w czystym systemie) to obie
dzialaja z tym ze obie targaja za ten sam wskaznik,
o tyle teraz musialbym jakos wylaczyc i rysowac swoje

a to psuje mi koncepcje zrobienia gry (np pilki mysznej)
ktorej grafika skladalaby z jednego pixela ("pi�ka myszna 2.0
released, whole new graphics, now our pixel is green!" ;-))




--
Wys�ano z serwisu Usenet w portalu Gazeta.pl -> http://www.gazeta.pl/usenet/
0 new messages