473,396 Members | 1,990 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,396 software developers and data experts.

Getting an IP address.


Hi All.

I need to be able to determine the IP address a drive letter is mapped
to. When a user selects a file from a file open dialog, They will, as
usual, navigate to the file they want via; Drive letter, folder, folder etc.

The Windows file open dialog returns this path in the format
C:\folder\folder\file.ext. What I need to know is what is the IP of the
C:\ drive or any drive they select, be it P; U; or whatever.

I need a function or API call that given a drive letter returns the IP
of that drive be it the local machine OR a mapped machine.
Let's see how good we all are... :)

Nov 13 '05 #1
3 6031
Mr. Smith wrote:

Hi All.

I need to be able to determine the IP address a drive letter is mapped
to. When a user selects a file from a file open dialog, They will, as
usual, navigate to the file they want via; Drive letter, folder, folder
etc.

The Windows file open dialog returns this path in the format
C:\folder\folder\file.ext. What I need to know is what is the IP of the
C:\ drive or any drive they select, be it P; U; or whatever.

I need a function or API call that given a drive letter returns the IP
of that drive be it the local machine OR a mapped machine.
Let's see how good we all are... :)


You need a function that returns the UNC name - check out:
http://support.microsoft.com:80/supp...NoWebContent=1
This MSKB article explains a bit more about what you are trying to do...

--
'-------------------------------
' John Mishefske
'-------------------------------

Nov 13 '05 #2
Thanks but,

The reason I need IP addresses is because of the network config. A VPN
is used over a DSL network. I have nontice that I can't reference
machines at other locations by UNC (IE can't map a drive) but I can by
IP address. Maybe this is fixable but I'd rather solve it with a more
robust technique.

They use fixed IP addresses to BTW.

The problem I have is that users at location A will be supplied an
address of a file from the a table in the DB (they won't see this of
course) which is then used retrieve the file from location B only if
necessary. Consequently, when the user at location B saves the
reference to the file at location B (They will think they are saving the
file) I need to store the IP of the drive where the file is actually
located so that it can be made available to users at all other locations
and be used by app to know where to get the file from.

Each location needs their own files stored locally (locally as in on the
LAN) for fast access by the client app. Users at other locations will
only need to these files occasionally. But they will need to access them.

I figure this could be difficult to understand from text, so thank you
for your response. Regardless, the link you've provided is very useful
and I have kept the code for future refernce.
Cheers
Mr. Smith

John Mishefske wrote:
Mr. Smith wrote:

Hi All.

I need to be able to determine the IP address a drive letter is mapped
to. When a user selects a file from a file open dialog, They will, as
usual, navigate to the file they want via; Drive letter, folder,
folder etc.

The Windows file open dialog returns this path in the format
C:\folder\folder\file.ext. What I need to know is what is the IP of
the C:\ drive or any drive they select, be it P; U; or whatever.

I need a function or API call that given a drive letter returns the IP
of that drive be it the local machine OR a mapped machine.
Let's see how good we all are... :)


You need a function that returns the UNC name - check out:
http://support.microsoft.com:80/supp...NoWebContent=1

This MSKB article explains a bit more about what you are trying to do...

Nov 13 '05 #3
"Mr. Smith" <Mr.Smith@Large> wrote in message news:<40***********************@news.syd.swiftdsl. com.au>...
Thanks but,

The reason I need IP addresses is because of the network config. A VPN
is used over a DSL network. I have nontice that I can't reference
machines at other locations by UNC (IE can't map a drive) but I can by
IP address. Maybe this is fixable but I'd rather solve it with a more
robust technique.

They use fixed IP addresses to BTW.

The problem I have is that users at location A will be supplied an
address of a file from the a table in the DB (they won't see this of
course) which is then used retrieve the file from location B only if
necessary. Consequently, when the user at location B saves the
reference to the file at location B (They will think they are saving the
file) I need to store the IP of the drive where the file is actually
located so that it can be made available to users at all other locations
and be used by app to know where to get the file from.

Each location needs their own files stored locally (locally as in on the
LAN) for fast access by the client app. Users at other locations will
only need to these files occasionally. But they will need to access them.

I figure this could be difficult to understand from text, so thank you
for your response. Regardless, the link you've provided is very useful
and I have kept the code for future refernce.
Cheers
Mr. Smith

John Mishefske wrote:
Mr. Smith wrote:

Hi All.

I need to be able to determine the IP address a drive letter is mapped
to. When a user selects a file from a file open dialog, They will, as
usual, navigate to the file they want via; Drive letter, folder,
folder etc.

The Windows file open dialog returns this path in the format
C:\folder\folder\file.ext. What I need to know is what is the IP of
the C:\ drive or any drive they select, be it P; U; or whatever.

I need a function or API call that given a drive letter returns the IP
of that drive be it the local machine OR a mapped machine.
Let's see how good we all are... :)


You need a function that returns the UNC name - check out:
http://support.microsoft.com:80/supp...NoWebContent=1

This MSKB article explains a bit more about what you are trying to do...


Have a look at Randy Birch's site...
http://vbnet.mvps.org/

at this article:
"How to Resolve a Hostname Into an IP Address"

That might get you going in the right direction.
Nov 13 '05 #4

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

Similar topics

10
by: Spidah | last post by:
How do I get the contents of the browser address bar with PHP - assuming it is possible? In javascript it is done with: unescape(window.location.pathname), but is there a php equivalent? ...
9
by: Marchello | last post by:
Hi All. I will try to explain my question on following example: Having class CInteger (wraper on 'int' values): class CInteger { public: ..... void SetValueFromPoiner(int *new_value)
3
by: Fred Zwarts | last post by:
For some operations, e.g., if one needs to write a large vector of floats to a file, the address of a buffer is needed. Does the vector class is the STL offer a way to get access to its internal...
8
by: Timo | last post by:
I am trying to get address of myStruct to a string array texts. I am using M$ Visual C++ 6.0 (this is not OS specific question, though, this code should also work on 16 bit embedded compiler ;)). ...
7
by: Prashanth Badabagni | last post by:
#include<string.h> void (*foobar)(); void main() { char *str; strcpy(str,"Fun1"); strcat(str,"method1");
5
by: sujit1779 | last post by:
Hi, How can i get the address opened by a user in his internet explorer or any other browser. For eg if a user has opened site www.yahoo.com then, how can I get that programatically thanks
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: 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
0
BarryA
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...
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
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
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...

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.