I found the problem ➔ Realtek USB 3.0 Card Reader ⮧
Device Manager\Universal Serial Bus controllers\Realtek USB 3.0 Card Reader ➔ Uninstall device (Check ✔: Delete the driver software for this device); Reboot.
I found the problem ➔ Realtek USB 3.0 Card Reader ⮧
Your fine example works for me in Win 10 but not in Win 7.
Thank you very much for the feedback. I highly appreciate it,
I'm not sure. I googled and this seems useful.
Code: Select all
---------------------------
---------------------------
SetTime(ctrl+t).exe
---------------------------
drive letter F: is Removable Media
---------------------------
OK
---------------------------
Code: Select all
131: Eject(A_ScriptDir)
007: IOCTL_STORAGE_GET_DEVICE_NUMBER := 0x2D1080
008: OPEN_EXISTING := 3
008: hVol := 0
008: sPHDRV := ""
008: qStr := ""
008: qEnum := ""
008: nDID := 0
008: nVT := 1
009: AMT := "[Removable Media][External hard disk media]"
009: dObj := {}
010: hVol := DllCall("CreateFile", "Str","\\.\" . (DRV:=SubStr(DRV,1,1) . ":"), "UInt",0,"UInt",0, "Ptr",0,"UInt",OPEN_EXISTING, "UInt",0, "Ptr",0, "Ptr")
012: if (hVol = -1 )
017: VarSetcapacity(STORAGE_DEVICE_NUMBER,12,0)
018: DllCall("DeviceIoControl", "Ptr",hVol, "UInt",IOCTL_STORAGE_GET_DEVICE_NUMBER,"Int",0, "Int",0, "Ptr",&STORAGE_DEVICE_NUMBER, "Int",12, "PtrP",0, "Ptr",0)
020: DllCall( "CloseHandle", "Ptr",hVol )
021: sPHDRV := "\\\\.\\PHYSICALDRIVE" . NumGet(STORAGE_DEVICE_NUMBER,4,"UInt")
022: qStr := "Select * from Win32_DiskDrive where DeviceID='$$$'"
023: qEnum := ComObjGet("winmgmts:").ExecQuery(StrReplace(qStr,"$$$",sPHDRV))._NewEnum() (0.05)
024: qEnum[dObj] (0.13)
025: if ( DontEject )
030: if ! ( DontCheck || InStr(AMT, "[" . dObj.MediaType . "]", True) )
036: if ! ( DllCall("GetModuleHandle", "Str","SetupAPI.dll", "Ptr") )
038: DllCall("LoadLibrary", "Str","SetupAPI.dll", "Ptr")
039: }
040: DllCall("SetupAPI\CM_Locate_DevNode", "PtrP",nDID, "Str",dObj.PNPDeviceID, "Int",0)
041: DllCall("SetupAPI\CM_Get_Parent", "PtrP",nDID, "UInt",nDID, "Int",0)
042: VarSetCapacity(VAR,520,0)
043: DllCall("SetupAPI\CM_Request_Device_Eject","UInt",nDID, "PtrP",nVT,"Str",VAR, "Int",260, "Int",0) (0.09)
045: ErrorLevel := ( nVT=0 ? 0 : ["PNP_VetoTypeUnknown
The specified operation was reje" . "cted for an unknown reason.","PNP_VetoLegacyDevice
The device does not support " . "the specified PnP ope
061: Return,dObj
Return to “Scripts and Functions (v1)”
Users browsing this forum: Google [Bot] and 158 guests