?
Solved

ChDrive and Network Drives

Posted on 1998-05-08
5
Medium Priority
?
552 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 400 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
Your data is at risk. Probably more today that at any other time in history. There are simply more people with more access to the Web with bad intentions.
This tutorial will show how to configure a new Backup Exec 2012 server and move an existing database to that server with the use of the BEUtility. Install Backup Exec 2012 on the new server and apply all of the latest hotfixes and service packs. The…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
Suggested Courses

765 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