Page 1 of 1
How to disable msg about empty USB-drives ? (solved)
Posted: Fri Jul 29, 2016 1:43 pm
by ukoenig
Hello,
on all FWH-samles about drive-informations, there are messages about empty USB-drives.
Is it possible to disable these messages, because selecting 1 of 4 USB-drives,
I get these messages for the 3 unused drives before a dialog opens calliing
aDrives().
aDrives()
It returns an array with all the valid drives ids.
Syntax:
aDrives( [<nType>] ) --> aDrives
This function Returns an array with all the units valid of our system.
Parameters:
<nType> 0 = All drives (default), 1 = Floppy drives only, 2 = Hard drives only
Returns:
<aDrives> The array with the drives ids
Sample:
SAMPLES\TESTDRVS.PRG
regards
Uwe
Re: How to disable messages about empty USB-drives ?
Posted: Fri Jul 29, 2016 2:49 pm
by Enrico Maria Giordano
Please show a compilable and runnable sample of the problem. I think it can be solved.
EMG
Re: How to disable messages about empty USB-drives ?
Posted: Fri Jul 29, 2016 3:18 pm
by ukoenig
Enrico,
just compiled the original sample TESTDRVS.prg
before the dialog opens, I get 4 Messages about empty USB-drives of O, P, Q, R
USB < T > is in use
It happens as soon aDrives() is called :
@ 1, 1 LISTBOX cDrive ITEMS
aDrives() SIZE 100, 100 OF oDlg ;
ON DBLCLICK oDlg:End()
Windows 10 installed
The result of TESTDRVS.prg
regards
Uwe
Re: How to disable messages about empty USB-drives ?
Posted: Fri Jul 29, 2016 3:42 pm
by Enrico Maria Giordano
I could not reproduce the problem. How can I get the messages you are talking about?
EMG
Re: How to disable messages about empty USB-drives ?
Posted: Fri Jul 29, 2016 4:53 pm
by cnavarro
Uwe, this code not is perfect, but .....
Code: Select all
function Main()
local oDlg, cDrive
local aDrives := {} //aDrives()
local i
// Execute as an administrator
// Ejecutar como administrador
for i = Asc( "C" ) to Asc( "Z" )
if GetDriveType( Chr( i ) + ":\" ) > 1 .and. File( Chr( i ) + ":\NUL" )
//? Chr( i ) + ":\"
if Memowrit( Chr( i ) + ":\A1A2A3A4.txt", "Test" )
FErase( Chr( i ) + ":\A1A2A3A4.txt" )
// Unidad disponible
// Drive available
AADD( aDrives, CHR( i ) + ":" )
else
// Dummy condition
// Unidad no disponible
// Protegido contra escritura ?
// Drive not available
// Drive write protected?
endif
endif
Next i
DEFINE DIALOG oDlg FROM 5, 5 TO 20, 60 TITLE "Select a drive"
@ 1, 1 LISTBOX cDrive ITEMS aDrives SIZE 100, 100 OF oDlg ;
ON DBLCLICK oDlg:End()
@ 1, 20 BUTTON "&Ok" OF oDlg ACTION oDlg:End()
ACTIVATE DIALOG oDlg CENTERED
Re: How to disable messages about empty USB-drives ?
Posted: Fri Jul 29, 2016 5:24 pm
by ukoenig
Cristobal,
thank You very much
it seems all USB-ports are checked calling
aDrives()
If the USB is empty, a message is shown < please insert a data-medium >.
Maybe there is somethig like a < autocheck > for USB inside the system-settings ( I don't know )
I'm wondering <A:\> and the <DVD-burner> is empty as well, but NO message.
The message is shown also 4 times, before the MsgAlert is executed.
function Test()
local aDrives := aDrives()
MsgAlert( len(aDrives) )
return( nil )
------------------------
That works ( drive-selection with included USB ) NO messages !!!
AEval( GetLogicalDriveStrings(), { | c | MsgInfo( c ) } )
regards
Uwe
Re: How to disable messages about empty USB-drives ?
Posted: Fri Jul 29, 2016 5:54 pm
by hebert_j_vargas
ukoenig wrote:Cristobal,
thank You very much
it seems all USB-ports are checked calling
aDrives()
If the USB is empty, a message is shown < please insert a data-medium >.
Maybe there is somethig like a < autocheck > for USB inside the system-settings ( I don't know )
I'm wondering <A:\> and the <DVD-burner> is empty as well but NO message.
The message is shown also 4 times, before the MsgAlert is executed.
function Test()
local aDrives := aDrives()
MsgAlert( len(aDrives) )
return( nil )
------------------------
That works ( drive-selection with included USB ) NO messages !!!
AEval( GetLogicalDriveStrings(), { | c | MsgInfo( c ) } )
regards
Uwe
Uwe, this code work's for me
Code: Select all
FUNC Main()
LOCAL nError := SetErrorMode(1)
aDrives := GetALLDrives() // All disks
SetErrorMode( nError)
Xbrowse( aDrives )
RETU
//------------------------------------//
FUNC GetALLDrives( nType )
LOCAL aDrives := {}
LOCAL nBitDrives := GetLogicalDrives(), n, cDrive
FOR n = 1 to 32
IF lAnd( nBitDrives, 2 ^ ( n - 1 ) )
cDrive = Chr( Asc( "A" ) - 1 + n ) + ":\"
IF Empty( nType )
IF n != 1 .and. Empty( nType ) //.and. GetDriveType( cDrive ) == 2
AAdd( aDrives, cDrive )
ENDIF
ELSE
IF n !=1 .and. GetDriveType( cDrive ) = nType
AAdd( aDrives, cDrive )
ENDIF
ENDIF
ENDIF
NEXT
RETU aDrives
Re: How to disable messages about empty USB-drives ?
Posted: Fri Jul 29, 2016 6:15 pm
by ukoenig
Hebert,
thank You very much
that WORKS
NO messages !!
regards
Uwe
Re: How to disable msg about empty USB-drives ? (solved)
Posted: Mon Aug 01, 2016 3:45 pm
by ukoenig
Hello,
I finished the one-click BACKUP-section and noticed the following :
Only connected USB-ports are visible. That is OK
But why a harddisk connected to the USB-port < T > changes the type to < 3 >.
I changed the harddisk against a USB-stick and get < 2 >
It seems the return-value is the connected medium and not the port-value.
regards
Uwe
Re: How to disable msg about empty USB-drives ? (solved)
Posted: Wed Aug 03, 2016 12:27 pm
by hebert_j_vargas
ukoenig wrote:Hello,
I finished the one-click BACKUP-section and noticed the following :
Only connected USB-ports are visible. That is OK
But why a harddisk connected to the USB-port < T > changes the type to < 3 >.
I changed the harddisk against a USB-stick and get < 2 >
It seems the return-value is the connected medium and not the port-value.
regards
Uwe
Uwe, you're right function give you media type, not port value.