Solved

ChDrive and Network Drives

Posted on 1998-05-08
5
526 Views
Last Modified: 2013-11-15
How can you change to a network drive?

The Chdrive function only works for mapped drives (e.g. single letter names a: c: etc)

How can I achieve this for a drive beginning \\machineName\sys for example?
0
Comment
Question by:microdrainage
5 Comments
 
LVL 3

Expert Comment

by:fguerreiro_inix
ID: 1444045
As you said the Chdrive only works with drive letters.
The only way two ways is using api or mapping drives(one for each machine name.)

Sorry if ican help you more
0
 

Author Comment

by:microdrainage
ID: 1444046
Does anybody know an API call to do this?

My overall aim is to find the amount of free drive space.
Unfortunately the DiskSpaceFree() function (from VB5STKIT.DLL) can only check the current drive and therefore the need for ChDrive or an equivalent.

Can anybody help?

0
 

Expert Comment

by:TheGun
ID: 1444047
I am currently working on a network type of application. Have you ever used run across the Win32 API for VB by Dan Appleman? If so there is a chapter that is included on cd that demostrates how to use the network APIs. In his example he takes a UNC and maps a drive/ makes a connection. Is this similar to what you are looking to do?


0
 
LVL 7

Accepted Solution

by:
tward earned 100 total points
ID: 1444048
I believe this function will take a UNC name, if not let me know there is another function that I can look into:

Declare Function GetDiskFreeSpace Lib "kernel32" Alias "GetDiskFreeSpaceA" (ByVal lpRootPathName As String, lpSectorsPerCluster As Long, lpBytesPerSector As Long, lpNumberOfFreeClusters As Long, lpTtoalNumberOfClusters As Long) As Long

The C/C++ Definition:

The GetDiskFreeSpace function retrieves information about the specified disk, including the amount of free space on the disk.
BOOL GetDiskFreeSpace(
    LPCTSTR lpRootPathName,      // address of root path
    LPDWORD lpSectorsPerCluster,      // address of sectors per cluster
    LPDWORD lpBytesPerSector,      // address of bytes per sector
    LPDWORD lpNumberOfFreeClusters,      // address of number of free clusters  
    LPDWORD lpTotalNumberOfClusters       // address of total number of clusters  
   );      
 
Parameters
lpRootPathName
Points to a null-terminated string that specifies the root directory of the disk to return information about. If lpRootPathName is NULL, the function uses the root of the current directory.
lpSectorsPerCluster
Points to a variable for the number of sectors per cluster.
lpBytesPerSector
Points to a variable for the number of bytes per sector.
lpNumberOfFreeClusters
Points to a variable for the total number of free clusters on the disk.
lpTotalNumberOfClusters
Points to a variable for the total number of clusters on the disk.
 
Return Values
If the function succeeds, the return value is TRUE.
If the function fails, the return value is FALSE. To get extended error information, call GetLastError.
See Also
GetDriveType

0
 

Author Comment

by:microdrainage
ID: 1444049
Cheers!! This solves the problem! We are off to buy the API guide!!!
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Create your own, high-performance VM backup appliance by installing NAKIVO Backup & Replication directly onto a Synology NAS!
VM backup deduplication is a method of reducing the amount of storage space needed to save VM backups. In most organizations, VMs contain many duplicate copies of data, such as VMs deployed from the same template, VMs with the same OS, or VMs that h…
This tutorial will walk an individual through the process of configuring basic necessities in order to use the 2010 version of Data Protection Manager. These include storage, agents, and protection jobs. Launch Data Protection Manager from the deskt…
This tutorial will walk an individual through setting the global and backup job media overwrite and protection periods in Backup Exec 2012. Log onto the Backup Exec Central Administration Server. Examine the services. If all or most of them are stop…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now