473,385 Members | 1,908 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Recognize a mapped network path

Hi,

can anyone tell me how I can find out if e.g.

"T:\Folder\SubFolder"

is a mapped networkdrive or a local drive when I
get this string from a file open dialog ?

Thanks

HKannen

Nov 22 '05 #1
2 1093
This is one way to find it:

[DllImport("kernel32.dll")]
public static extern int GetDriveType (string lpRootPathName);

string s = @"T:\Folder\SubFolder";
int i = s.IndexOf (Path.DirectorySeparatorChar);
s = s.Substring (0, i+1);

if (GetDriveType (s) == 4)
{
Console.WriteLine (s + " is a network mapped drive");
}

HTH

"HKannen" <HK*****@discussions.microsoft.com> wrote in message
news:E4**********************************@microsof t.com...
Hi,

can anyone tell me how I can find out if e.g.

"T:\Folder\SubFolder"

is a mapped networkdrive or a local drive when I
get this string from a file open dialog ?

Thanks

HKannen
Nov 22 '05 #2
Hi Shiva,

thanks a lot for your help.
This method wors fine.

HKannen

"Shiva" wrote:
This is one way to find it:

[DllImport("kernel32.dll")]
public static extern int GetDriveType (string lpRootPathName);

string s = @"T:\Folder\SubFolder";
int i = s.IndexOf (Path.DirectorySeparatorChar);
s = s.Substring (0, i+1);

if (GetDriveType (s) == 4)
{
Console.WriteLine (s + " is a network mapped drive");
}

HTH

"HKannen" <HK*****@discussions.microsoft.com> wrote in message
news:E4**********************************@microsof t.com...
Hi,

can anyone tell me how I can find out if e.g.

"T:\Folder\SubFolder"

is a mapped networkdrive or a local drive when I
get this string from a file open dialog ?

Thanks

HKannen

Nov 22 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: moonriver | last post by:
I write a program accessing files in network drive o:. It is doable as a standalone application. However, if it is running under windows service, the following exception will appear: 13/07/2004...
2
by: HKannen | last post by:
Hi, can anyone tell me how I can find out if e.g. "T:\Folder\SubFolder" is a mapped networkdrive or a local drive when I get this string from a file open dialog ? Thanks
2
by: giloosh99 | last post by:
Hello, Im grabbing tables via VB code using visual foxpro ODBC drives. The tables directory is in a mapped network drive. The code works fine and does the job, however if the computer is idle for...
5
by: Niloday | last post by:
Hi All, I am trying to access a mapped network drive from a service that I have created. The service needs to create/delete folders/files on a network drive. When I tried to connect to a...
3
by: Bonj | last post by:
I have a service which is a Windows Service, but it is running under a User account - I enter my own credentials on installing. It can access network files by specifying the full UNC path, i.e....
5
by: Nirosh | last post by:
Hi All, Can any one suggest me a best way to do this .. I have a thrid party tool "EXE" that we need to use with our web service to manipulate some complex XML files, which reside in a...
2
by: Sridhar | last post by:
Hi, I have a question. I am trying to write File Functions to read data from a file. This function accepts FilePath as the parameter and returns Byte() Array. Some times if the file is on the...
1
by: Ronald S. Cook | last post by:
Hi, My ASPX code is trying to read a file on a mapped drive. But I get the error below. Any help would be greatly appreciated. Could not find a part of the path 'Z:\Events.nss'. ...
4
by: sajid_yusuf | last post by:
Hi I am trying to develop a Windows service in VB.NET which has timer enabled and keeps checking a folder (or group of folders) for any new file or changed files. As soon as it detects any new...
3
by: naveen.sabapathy | last post by:
Hi, I am trying to use virtual serial ports to develop/test my serial communication program. Running in to trouble... I am using com0com to create the virtual ports. The virtual ports seem to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.