FUNCTION MAIN()
LOCAL oLoc := CREATEOBJECT( "wbemScripting.SwbemLocator" )
LOCAL oSrv := oLoc:ConnectServer()
LOCAL oJbs := oSrv:ExecQuery( "SELECT * FROM Win32_DiskDrive" )
LOCAL oJob
FOR EACH oJob IN oJbs
// IF SUBSTR( oJob:PnPDeviceID, 1, 7 ) = "USBSTOR" Then
? oJob:PnPDeviceID
// ENDIF
NEXT
INKEY( 0 )
RETURN NIL
#include "FiveWin.ch"
#define DRIVE_REMOVABLE 2
function Main()
local nBitDrives := GetLogicalDrives(), n, cDrive
for n = 1 to 32
if lAnd( nBitDrives, 2 ^ ( n - 1 ) )
cDrive = Chr( Asc( "A" ) - 1 + n ) + ":\"
if n != 1 .and. GetDriveType( cDrive ) == DRIVE_REMOVABLE
MsgInfo( "USB pendrive: " + CRLF + cDrive )
endif
endif
next
return nil
#pragma BEGINDUMP
#include <hbapi.h>
#include <windows.h>
HB_FUNC( GETLOGICALDRIVES )
{
hb_retnl( GetLogicalDrives() );
}
HB_FUNC( GETDRIVETYPE )
{
hb_retnl( GetDriveType( hb_parc( 1 ) ) );
}
#pragma ENDDUMP
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: nageswaragunupudi and 56 guests