-
hi there,
I am in a real jam.
in my application, there is a databse on a client's machine that should be accessed from the server.
Suppose it's path is 'C:\Database'
how do i get the UNC path for the above mentioned folder. For ex: '\\clientName\clientName_C\Database'. Else how can i access the client database path from the server.
in short is there a API to get the share name of the drive ??
Please reply asap at [email protected]
-
This may help but on reading your question a second time I'm not sure if this is what you want...
Use the very useful but not very well known Scripting Runtime.
Click on PROJECT / REFERENCES and select "Microsoft Scripting Runtime" from the list.
In code;
Code:
Dim fso As New FileSystemObject
Dim drv As Drive
For Each drv In fso.Drives
Debug.Print drv.DriveLetter & vbTab & drv.ShareName
Next
This will display the drive letter and sharename for each drive on your system in the Immediate Window.
You can use
[variable] = fso.Drives("S").Sharename
to get the sharename of the S: drive for example.
-
Hey, thanx for the same
But it will not work.
you see, the sharename property is used only for mapped drives of other computers.
i used all the fso's. doesn't work
what i want is to know the sharename of my drive itself.
in the api listing there is an API called WnetGetuniversalName or something like that.
know how to use that ???
Thanx once again
-
Did you ever get this problem resolved?
I am looking for the exact same solution....
-
Have you tried using the registry? In Windows 95, 98, and Millenium, there is the following key:
HKLM\Security\Access\
And each sub key under this key represents a shared folder. Since I don't have these OSs, I can't give you more info on this one.
In other Windows OSs, the key is:
HKLM\SYSTEM\CurrentControlSet\Services\lanmanserver\Shares\
And each value in this key represents a shared folder. The data for each value contains the actual path, as in "Path=c:\data\databases".
So, you could loop through each key/value (depending on OS) and look for the one that contains the path to the database. To get the actual share, just add the computer name to the front. To get the computername, you can do Environ("%computername%).
-
Thanks, but that only solves half my problem.
See my newer post for the whole picture:
http://www.vbforums.com/showthread.p...hreadid=241285