How to disable msg about empty USB-drives ? (solved)

How to disable msg about empty USB-drives ? (solved)

Postby ukoenig » Fri Jul 29, 2016 1:43 pm

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().

Image

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 :?:
Last edited by ukoenig on Fri Jul 29, 2016 8:15 pm, edited 2 times in total.
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: How to disable messages about empty USB-drives ?

Postby Enrico Maria Giordano » Fri Jul 29, 2016 2:49 pm

Please show a compilable and runnable sample of the problem. I think it can be solved.

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8713
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: How to disable messages about empty USB-drives ?

Postby ukoenig » Fri Jul 29, 2016 3:18 pm

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

Image

regards
Uwe :?:
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: How to disable messages about empty USB-drives ?

Postby Enrico Maria Giordano » Fri Jul 29, 2016 3:42 pm

I could not reproduce the problem. How can I get the messages you are talking about?

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8713
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: How to disable messages about empty USB-drives ?

Postby cnavarro » Fri Jul 29, 2016 4:53 pm

Uwe, this code not is perfect, but .....

Code: Select all  Expand view


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

Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
User avatar
cnavarro
 
Posts: 6541
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: How to disable messages about empty USB-drives ?

Postby ukoenig » Fri Jul 29, 2016 5:24 pm

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 :roll:
Last edited by ukoenig on Fri Jul 29, 2016 8:16 pm, edited 1 time in total.
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: How to disable messages about empty USB-drives ?

Postby hebert_j_vargas » Fri Jul 29, 2016 5:54 pm

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 :roll:


Uwe, this code work's for me
Code: Select all  Expand view
 
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
Last edited by hebert_j_vargas on Fri Jul 29, 2016 6:54 pm, edited 1 time in total.
Compiler version: xHarbour 1.2.3 Intl. (SimpLex) (Build 20141106)
FiveWin Version: FWHX 15.01
BCC 5.8.2
User avatar
hebert_j_vargas
 
Posts: 99
Joined: Thu Aug 02, 2012 3:21 pm

Re: How to disable messages about empty USB-drives ?

Postby ukoenig » Fri Jul 29, 2016 6:15 pm

Hebert,
thank You very much

that WORKS
NO messages !!

regards
Uwe :D
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: How to disable msg about empty USB-drives ? (solved)

Postby ukoenig » Mon Aug 01, 2016 3:45 pm

Hello,

I finished the one-click BACKUP-section and noticed the following :

Image

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 :?:
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: How to disable msg about empty USB-drives ? (solved)

Postby hebert_j_vargas » Wed Aug 03, 2016 12:27 pm

ukoenig wrote:Hello,

I finished the one-click BACKUP-section and noticed the following :

Image

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. :wink:
Compiler version: xHarbour 1.2.3 Intl. (SimpLex) (Build 20141106)
FiveWin Version: FWHX 15.01
BCC 5.8.2
User avatar
hebert_j_vargas
 
Posts: 99
Joined: Thu Aug 02, 2012 3:21 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 99 guests