Hi, I'm converting a C++ program over to C# (on .Net 2.0), and am not
sure of the best way to look up the UNC path for mapped drives.
The way the C++ program does this is it iterates through a listing of
drive letters, then calls WNetGetUniversalName for each to get the UNC.
.Net 2.0 seems to have a fairly broad selection of IO handling
options, but I've not yet found one to handle my problem.
Any pointers? 3 9367
Michael,
.NET doesn't have anything to handle this out of the box. However, you
can call the WNetGetUniversalName API through the P/Invoke layer if you
wish.
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com
"Michael Russell" <mr*******@hotmail.comwrote in message
news:%2****************@TK2MSFTNGP06.phx.gbl...
Hi, I'm converting a C++ program over to C# (on .Net 2.0), and am not sure
of the best way to look up the UNC path for mapped drives.
The way the C++ program does this is it iterates through a listing of
drive letters, then calls WNetGetUniversalName for each to get the UNC.
.Net 2.0 seems to have a fairly broad selection of IO handling options,
but I've not yet found one to handle my problem.
Any pointers?
Like Nicholas said, you should use WNetGetUniversalName. Here's a code
snippet that shows how to use P/Invoke to get the UNC path: http://groups.google.com/group/micro...e214768a2b3b76
Nicholas Paldino [.NET/C# MVP] wrote:
Michael,
.NET doesn't have anything to handle this out of the box. However, you
can call the WNetGetUniversalName API through the P/Invoke layer if you
wish.
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com
"Michael Russell" <mr*******@hotmail.comwrote in message
news:%2****************@TK2MSFTNGP06.phx.gbl...
Hi, I'm converting a C++ program over to C# (on .Net 2.0), and am not sure
of the best way to look up the UNC path for mapped drives.
The way the C++ program does this is it iterates through a listing of
drive letters, then calls WNetGetUniversalName for each to get the UNC.
.Net 2.0 seems to have a fairly broad selection of IO handling options,
but I've not yet found one to handle my problem.
Any pointers?
John Duval wrote:
Like Nicholas said, you should use WNetGetUniversalName. Here's a code
snippet that shows how to use P/Invoke to get the UNC path:
http://groups.google.com/group/micro...e214768a2b3b76
Nicholas Paldino [.NET/C# MVP] wrote:
>Michael,
.NET doesn't have anything to handle this out of the box. However, you can call the WNetGetUniversalName API through the P/Invoke layer if you wish.
Hope this helps.
-- - Nicholas Paldino [.NET/C# MVP] - mv*@spam.guard.caspershouse.com
"Michael Russell" <mr*******@hotmail.comwrote in message news:%2****************@TK2MSFTNGP06.phx.gbl...
>>Hi, I'm converting a C++ program over to C# (on .Net 2.0), and am not sure of the best way to look up the UNC path for mapped drives.
The way the C++ program does this is it iterates through a listing of drive letters, then calls WNetGetUniversalName for each to get the UNC. .Net 2.0 seems to have a fairly broad selection of IO handling options, but I've not yet found one to handle my problem.
Any pointers?
Thanks John and Nicholas. A little disappointing that there isn't
something built-in, but I appreciate the confirmation and the link to
the code snippet.
Michael This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Ben Reese |
last post by:
Kind people on this discussion group have previously helped me to dynamically
identify CD rom drives etc at runtime using objects in System.management
+++++++++++++++++++++++++++++++++++++++
Dim...
|
by: Ben Reese |
last post by:
Kind people on this discussion group have previously helped me to dynamically
identify CD rom drives etc at runtime using objects in System.management
+++++++++++++++++++++++++++++++++++++++
Dim...
|
by: Ricky |
last post by:
My question:
If I have a mapped driver letter g: that referes to
\\servername\d\foldername
How do I get java to convert it from g: to the real path so I can use
it?
I have a script that...
|
by: lastusernameleft |
last post by:
Is there a .NET method for doing this? I haven't found anything else that
works.
Thanks
|
by: Mark |
last post by:
I posted this question some time ago, but didn't get a response. So, I'll
try again.
Hello,
I have a VB.NET app which polls mapped drives periodically looking for files.
However, if the...
|
by: Ian Murrell |
last post by:
My application writes a text data file to a folder on another computer. The
other computer is mapped by drive letter to the root (C) shared folder, eg as
G:. The network is simple peer2peer, shared...
|
by: Ben |
last post by:
Hi, Thanks for reading this post... I am trying to get the
computer/server names from the mapped drives on the Clients PC when
they select a file from the upload "browse" button. When the user...
|
by: Jim Carlock |
last post by:
function CreateMyDataBaseFile($FQFN, $UID, $PW) {
$db = "sqlite:" . $FQFN;
$sql = "CREATE TABLE Customers(name1 TEXT, name2 TEXT);";
$dbh = new PDO($db, $UID, $PW);
$dbh->exec($sql);
$dbh =...
|
by: BigM |
last post by:
Hi Guys,
I am working up a little 'documents' section to an app of mine, where people can add links to docs on various share drives in our LAN, and they are displayed along with other details and...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
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...
|
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,...
|
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: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
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...
| |