Raw input functions on windows wouldnt compile

Nov 11, 2009 at 12:56pm
Ok I'm new to programming in c++ and i need help on working with raw functions in windows

for this function: http://msdn.microsoft.com/en-us/library/ms645600(VS.85).aspx

i cannot get it to compile without seeing see declaration of blah blah blah. I clicked and i looked, and its not helpful at all. nor is the MS website.

Can you help me? an example would be great eg for a mouse or something. THANKSSSS
Nov 11, 2009 at 7:42pm
#pragma once

#include "stdafx.h"

void register_device ()
{

USHORT usUsagePage = 0;
USHORT usUsage = 0;
DWORD dwFlags = RIDEV_INPUTSINK;
HWND hwndTarget;


typedef struct tagRAWINPUTDEVICE { //Defines information for the raw input device
USHORT usUsagePage; /*Top level collection Usage page for the raw input device*/
USHORT usUsage; /*Top level collection Usage for the raw input device*/
DWORD dwFlags; /*Mode flag that specifies how to interpret the information provided by usUsagePage and usUsage*/

HWND hwndTarget; //Handle to the target window

} RAWINPUTDEVICE, *PRAWINPUTDEVICE, *LPRAWINPUTDEVICE;

BOOL RegisterRawInputDevices ( //Registers the devices that supply the raw input data
PCRAWINPUTDEVICE pRawInputDevices, /*Pointer to an array of RAWINPUTDEVICE structure that represent the devices that supply the raw input*/

UINT uiNumDevices, /*Number of RAWINPUTDEVICE structures pointed to by pRawInputDevices*/
UINT cbSize ); //Size, in bytes, of a RAWINPUTDEVICE structure

if (RegisterRawInputDevices <= 0)
{
cout << GetLastError (); //Print out error if occurred
}

UINT GetRawInputDeviceList ( //Enumerates the raw input devices attached to the system

PRAWINPUTDEVICELIST pRawInputDeviceList,

/*Pointer tp buffer that holds an array of RAWINPUTDEVICELIST structures for the devices attached to the system*/

PUINT puiNumDevices, //Pointer to a variable
UINT cbSize ); /*Size of a RAWINPUTDEVICELIST structure*/


UINT GetRawInputDeviceInfo ( /*Gets information about the raw input device*/
HANDLE hDevice, //Handle to the raw input device
UINT uiCommand, //Specifies what data will be returned in pData
LPVOID pData, /*Pointer to a buffer that contains the information specified by uiCommand*/
PUINT pcbSize ); /*Pointer to a variable that contains the size, in bytes, of the data in pData*/


UINT GetRegisteredRawInputDevices ( /*Gets information about the raw input devices for the current application*/

PRAWINPUTDEVICE pRawInputDevices, /*Pointer tp an array pf RAWINPUTDEVICE structures for the application*/

PUINT puiNumDevices, /*Number of RAWINPUTDEVICE structure in *pRawInputDevices*/

UINT cbSize ); //Size, in bytes, of a RAWINPUTDEVICE structure
}

Ok this the layout format that i have written so far by looking at the msdn website. Can you guys help me out by pointing out the problems of how to fix it. Thanks so much
Nov 11, 2009 at 9:43pm
I understand now, those that i wrote are the format of how to input values. Am i correct.

Thanks
Topic archived. No new replies allowed.