by **Helgef** » 11 Apr 2017, 11:19

I only found one mouse, I have two connected, and this is what I got,

`\\?\HID#VID_045E&PID_00CB#7&311ffe2c&0&0000#{378de44c-56ef-11d1-bc8c-00a0c91405dd}`

, not very exciting.

Code: Select all

```
Msgbox, % GetMiceList()
GetMiceList(){
static cbSize:=A_PtrSize*2
static RIDI_DEVICENAME:=0x20000007
DllCall("GetRawInputDeviceList", "UptrP", 0, "UintP", puiNumDevices, "Uint", cbSize)
VarSetCapacity(pRawInputDeviceList,puiNumDevices*cbSize,0)
r:=DllCall("GetRawInputDeviceList", "Uptr", &pRawInputDeviceList, "UintP", puiNumDevices, "Uint", cbSize)
Loop, % puiNumDevices {
hDevice:=NumGet(&pRawInputDeviceList,cbSize*(A_Index-1),"Uptr")
dwType:=NumGet(&pRawInputDeviceList, cbSize*(A_Index),"Uint")
if (dwType) ; RIM_TYPEMOUSE=0
continue
uiCommand:=RIDI_DEVICENAME
DllCall("GetRawInputDeviceInfo", "Uptr", hDevice, "Uint", uiCommand, "PtrP", 0, "UintP", pcbSize)
VarSetCapacity(pData,pcbSize*(A_IsUnicode?2:1),0)
DllCall("GetRawInputDeviceInfo", "Uptr", hDevice, "Uint", uiCommand, "Ptr", &pData, "UintP", pcbSize)
str.=StrGet(&pData) "`n"
}
return str
}
/*
---------------------------
20170411174902.ahk
---------------------------
\\?\HID#VID_045E&PID_00CB#7&311ffe2c&0&0000#{378de44c-56ef-11d1-bc8c-00a0c91405dd}
---------------------------
OK
---------------------------
*/
```

Edit: This code has errors it seems.

Edit3:

It should be more like this,

~~but this crashes~~
Code: Select all

```
Msgbox, % GetMiceList()
GetMiceList(){
static cbSize:=A_PtrSize*2
static RIDI_DEVICENAME:=0x20000007
DllCall("GetRawInputDeviceList", "Uptr", 0, "UintP", puiNumDevices, "Uint", cbSize)
VarSetCapacity(pRawInputDeviceList,puiNumDevices*cbSize,0)
r:=DllCall("GetRawInputDeviceList", "Uptr", &pRawInputDeviceList, "UintP", puiNumDevices, "Uint", cbSize)
Loop, % puiNumDevices {
hDevice:=NumGet(&pRawInputDeviceList+0,cbSize*(A_Index-1),"Uptr")
dwType:=NumGet(&pRawInputDeviceList+0, cbSize*(A_Index-1)+A_PtrSize,"Uint")
if (dwType) ; RIM_TYPEMOUSE=0
continue
uiCommand:=RIDI_DEVICENAME
DllCall("GetRawInputDeviceInfo", "Uptr", hDevice, "Uint", uiCommand, "Ptr", 0, "UintP", pcbSize)
if !pcbSize
continue
VarSetCapacity(pData,pcbSize*(A_IsUnicode?2:1)+2,0)
DllCall("GetRawInputDeviceInfo", "Uptr", hDevice, "Uint", uiCommand, "Ptr", &pData, "UintP", pcbSize)
str.=StrGet(&pData) "`n`n"
}
return str
}
```

This seems better, but it gives me four results, as I said, I have only two mice. Sorry for derailing.

I only found one mouse, I have two connected, and this is what I got, [c]\\?\HID#VID_045E&PID_00CB#7&311ffe2c&0&0000#{378de44c-56ef-11d1-bc8c-00a0c91405dd}[/c], not very exciting. :thumbdown:

[code]

Msgbox, % GetMiceList()

GetMiceList(){

static cbSize:=A_PtrSize*2

static RIDI_DEVICENAME:=0x20000007

DllCall("GetRawInputDeviceList", "UptrP", 0, "UintP", puiNumDevices, "Uint", cbSize)

VarSetCapacity(pRawInputDeviceList,puiNumDevices*cbSize,0)

r:=DllCall("GetRawInputDeviceList", "Uptr", &pRawInputDeviceList, "UintP", puiNumDevices, "Uint", cbSize)

Loop, % puiNumDevices {

hDevice:=NumGet(&pRawInputDeviceList,cbSize*(A_Index-1),"Uptr")

dwType:=NumGet(&pRawInputDeviceList, cbSize*(A_Index),"Uint")

if (dwType) ; RIM_TYPEMOUSE=0

continue

uiCommand:=RIDI_DEVICENAME

DllCall("GetRawInputDeviceInfo", "Uptr", hDevice, "Uint", uiCommand, "PtrP", 0, "UintP", pcbSize)

VarSetCapacity(pData,pcbSize*(A_IsUnicode?2:1),0)

DllCall("GetRawInputDeviceInfo", "Uptr", hDevice, "Uint", uiCommand, "Ptr", &pData, "UintP", pcbSize)

str.=StrGet(&pData) "`n"

}

return str

}

/*

---------------------------

20170411174902.ahk

---------------------------

\\?\HID#VID_045E&PID_00CB#7&311ffe2c&0&0000#{378de44c-56ef-11d1-bc8c-00a0c91405dd}

---------------------------

OK

---------------------------

*/

[/code]

Edit: This code has errors it seems.

Edit3:

It should be more like this,[strike]but this crashes[/strike] :eh:

[code]

Msgbox, % GetMiceList()

GetMiceList(){

static cbSize:=A_PtrSize*2

static RIDI_DEVICENAME:=0x20000007

DllCall("GetRawInputDeviceList", "Uptr", 0, "UintP", puiNumDevices, "Uint", cbSize)

VarSetCapacity(pRawInputDeviceList,puiNumDevices*cbSize,0)

r:=DllCall("GetRawInputDeviceList", "Uptr", &pRawInputDeviceList, "UintP", puiNumDevices, "Uint", cbSize)

Loop, % puiNumDevices {

hDevice:=NumGet(&pRawInputDeviceList+0,cbSize*(A_Index-1),"Uptr")

dwType:=NumGet(&pRawInputDeviceList+0, cbSize*(A_Index-1)+A_PtrSize,"Uint")

if (dwType) ; RIM_TYPEMOUSE=0

continue

uiCommand:=RIDI_DEVICENAME

DllCall("GetRawInputDeviceInfo", "Uptr", hDevice, "Uint", uiCommand, "Ptr", 0, "UintP", pcbSize)

if !pcbSize

continue

VarSetCapacity(pData,pcbSize*(A_IsUnicode?2:1)+2,0)

DllCall("GetRawInputDeviceInfo", "Uptr", hDevice, "Uint", uiCommand, "Ptr", &pData, "UintP", pcbSize)

str.=StrGet(&pData) "`n`n"

}

return str

}

[/code]

This seems better, but it gives me four results, as I said, I have only two mice. Sorry for derailing. :offtopic: