473,473 Members | 2,316 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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 1095
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.