   rawinput class not working
  working on a rawinput class called Input.when object is created i call thisbool Input::Register(HWND hWnd){// keyboard input setupRid[0].usUsagePage = 1;Rid[0].usUsage = 6;Rid[0].dwFlags = 0;Rid[0].hwndTarget = hWnd;// mouse input setupRid[1].usUsagePage = 1;Rid[1].usUsage = 2;Rid[1].dwFlags = 0;Rid[1].hwndTarget = hWnd;// joystickRid[2].usUsagePage = 1;Rid[2].usUsage = 4;Rid[2].dwFlags = 0;Rid[2].hwndTarget = hWnd;if(RegisterRawInputDevices (Rid, 2, sizeof(RAWINPUTDEVICE)) != TRUE)return 0;elsereturn 1;}and now the wndproc should start recieving WM_INPUT messages.so im calling my handle input function which is in the input classvoid Input::handleInput(LPARAM lParam){if(!this->bufferSizeSet){GetRawInputData((HRAWINPUT)lParam, RID_INPUT, NULL, &this->bufferSize, sizeof(RAWINPUTHEADER));}GetRawInputData((HRAWINPUT)lParam, RID_INPUT, (LPVOID)this->buffer, &this->bufferSize, sizeof(RAWINPUTHEADER));RAWINPUT *raw = (RAWINPUT*) buffer;if (raw->header.dwType == RIM_TYPEMOUSE){// mouse data herethis->motionX = raw->data.mouse.lLastX;this->motionY = raw->data.mouse.lLastY;}if (raw->header.dwType == RIM_TYPEKEYBOARD) {// keyboard data here}if (raw->header.dwType == RIM_TYPEHID) {// input device here}}and sending lParam as a parameter.but im getting an access violation error on the raw->header.dwType call. This all works, as long as it's in wndProc, but cant get it to work when doing it in my input class functions. Am i sending the wrong parameter, or is there another thing im doing wrong?regards Morten   
  After having a quick look and going through MSDN it would make sense to me to use 'RID_HEADER' instead of 'RID_INPUT' for retrieving the header infos (and afterwards making another call with 'RID_INPUT' for the data). Could this be the reason ?   ;  don't think so.tried putting all the code in to wndproc, and running it from there, and it works fine. I think i'm sending the parameter in a wrong way, since it's an access violation error. but not sure how i should send the paramter to my class function for it to work.the error comes up as soon as the program gets to this lineif (raw->header.dwType == RIM_TYPEMOUSE)   ;  working now.apperently don't know how to pass by pointer in this case.works now, thanks for your help anyway