Drive List

Drive List

Postby sanilpmc » Sat Sep 06, 2008 10:09 am

Dear all,

I need to know is there any way to display all drives with drive image in a system where the app runs. Like the below image

Image


Combobox is used to displaying the drivers in app.

Thanks you
sanilpmc
 
Posts: 36
Joined: Tue Jun 17, 2008 7:09 am

Postby James Bott » Sat Sep 06, 2008 5:24 pm

Try the function aDrives().

regards,
James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Postby sanilpmc » Mon Sep 08, 2008 6:09 am

James Bott wrote:Try the function aDrives().

regards,
James


Thank you James Bott.

aDrives() returns all vaild drives LETTERS in system. I need to show DRIVE LETTER along with its IMAGE.

I need to know the method or an Object which is able to show both Drive Letter and Drive Image

Please see the Screen shot which is posted earlier. The screen shot has been taken from my application which is developed with mg.

Thank you
Sanil
sanilpmc
 
Posts: 36
Joined: Tue Jun 17, 2008 7:09 am

Postby James Bott » Mon Sep 08, 2008 1:33 pm

Sanil,

See FWH\samples\ownerdra.prg.

It contains this:

REDEFINE COMBOBOX oCbx1 VAR cItem2 ;
ID 120 OF oDlg ;
ITEMS { "Drive A:", "Drive C:", "Ram Drive", "Net Drive" } ;
BITMAPS { "..\bitmaps\fdrive.bmp",;
"..\bitmaps\hdrive.bmp",;
"..\bitmaps\ramdrive.bmp",;
"..\bitmaps\netdrive.bmp" }

Regards,
James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Postby FranciscoA » Mon Sep 08, 2008 11:03 pm

sanilpmc wrote:
James Bott wrote:Try the function aDrives().

regards,
James


Thank you James Bott.

aDrives() returns all vaild drives LETTERS in system. I need to show DRIVE LETTER along with its IMAGE.

I need to know the method or an Object which is able to show both Drive Letter and Drive Image

Please see the Screen shot which is posted earlier. The screen shot has been taken from my application which is developed with MINI GUI.

Thank you
Sanil


Sanil:
It's this what your are looking for?

//----------------------------------//
function copiar()
local oDestino, Destino, lOK:=.f.
local oDlg, oCbx1
local cItems:=aDrives(), cDrive
local cBmps:={}, n


for n:=1 to len(cItems)
aadd(cBmps,"hDrive")
next

cDrive:=cItems[1]
Destino:= space(16)

DEFINE DIALOG oDlg RESOURCE "BACKUP"
REDEFINE COMBOBOX oCbx1 VAR cDrive ;
ID 103 OF oDlg ;
ITEMS cItems ;
BITMAPS cBmps
REDEFINE GET oDestino VAR Destino ID 104 of oDlg PICTURE "@!"
REDEFINE TSAYT ID 101 OF oDlg COLOR nClrTxt
REDEFINE TSAYT ID 102 OF oDlg COLOR nClrTxt
REDEFINE BUTTON ID 312 OF oDLG ACTION if( !empty(Destino),(lOK:=.T., oDlg:End()), (lOK:=.f.,MsgStop("Directorio destino vacío","Alto")) )
REDEFINE BUTTON ID 313 OF oDLG ACTION (lOK:=.F., oDlg:End())
ACTIVATE DIALOG oDlg CENTERED

IF lOK

Destino:=cDrive+""+alltrim(Destino)

if lIsDir(destino)
If !SiNo(CRLF+CRLF+"Directorio "+destino+" ya existe. ¿Lo sobre-escribe?","Esta Seguro?")
return nil
endif
else
lmkDir(Destino)
endif

dbCloseall()
CopyFiles( { cPathDef+"\WMDATA.DBF",;
cPathDef+"\proceso.dbf",;
cPathDef+"\wcont32.ini" },;
{ DESTINO+"\WMDATA.DBF",;
destino+"\proceso.dbf",;
destino+"\wcont32.ini" } )

MisAreas()

ENDIF
return nil
User avatar
FranciscoA
 
Posts: 2158
Joined: Fri Jul 18, 2008 1:24 am
Location: Chinandega, Nicaragua, C.A.

Postby sanilpmc » Tue Sep 09, 2008 8:07 am

Sanil:
It's this what your are looking for?

//----------------------------------//
function copiar()


Dear Friends,

Thank you FranciscoA and James Bott

Please see the Screen shot below

Image

In this Screen shot you can find Hard Drive, CD Rom Drive and Network Drive with corresponding Drive Image. This may vary from systems to systems where the application running. For eg: PC1 may have CD Drive, PC2 may not have CD drive.

I understand that aDrives() will return the available drive with the associated drive letters in the PC, but it will not give information on what drive it is ? ie whether it is a CD drive or Network drive or Hard drive etc.

I would like to know whether any other similar function is available or not which returns an array containing the drive letters as well as drive type along with it ie CD drive, hard drive, network drive etc.

Can i have any sample program regarding this?.


Regards
Sanil
sanilpmc
 
Posts: 36
Joined: Tue Jun 17, 2008 7:09 am

Postby James Bott » Tue Sep 09, 2008 2:06 pm

Sanil,

Here is an old message that may give you what you want.

Regards,
James

From: "Marco Turco" <m.turco@softwarexp.co.uk>
Subject: Re: aDrives()
Date: Monday, October 04, 2004 5:25 AM

Hi,
this function return an array with the drive type.

Code: Select all  Expand view
function totaldrive
    mnu1:=array(0,3)

    for i=65 to 90
        DriveType := GetDrvT32(Chr(i) + ":\")
        a1:=.f.
        do case
        case DriveType = 1
            aa:="Not installed"
        case DriveType = 2
            aa:="Floppy disk"
        case DriveType = 3
            aa:="Hard Disk"
        case DriveType = 4
            aa:="Network drive"
            .
        case DriveType = 5
            aa:="CD-ROM"
        case DriveType = 6
            aa:="RAM-Drive"
         otherwise
            aa:="Not-identified"
        endcase
        aadd(mnu1,{"Drive "+chr(i),aa})
    next
return mnu1


DLL32 Function GetDrvT32( cPathName as LPSTR ) AS LONG PASCAL ;
                          FROM "GetDriveTypeA" LIB "Kernel32"



--
Marco Turco
SOFTWARE XP LLP, London
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Postby sanilpmc » Tue Sep 16, 2008 6:35 am

James Bott wrote:Sanil,

Here is an old message that may give you what you want.

Regards,
James


Thank you James Bott,

Yes, exactly what I required.
Thanks a lot
sanilpmc
 
Posts: 36
Joined: Tue Jun 17, 2008 7:09 am


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 81 guests