Get the machine name of the mapped drive C++
-
Hi..... I have a small problem in getting the hostname of the mapped drive. I have mapped a shared folder of a machine in network on my system. I have to get the name of the machine from the mapped drive. I was not able to find any proper function for that. Please do let me know if there is some function or some way to do it, because in my program i have to get the name of the machine.Is there a way out? Please do help me out. Thnx in advance...
-
Hi..... I have a small problem in getting the hostname of the mapped drive. I have mapped a shared folder of a machine in network on my system. I have to get the name of the machine from the mapped drive. I was not able to find any proper function for that. Please do let me know if there is some function or some way to do it, because in my program i have to get the name of the machine.Is there a way out? Please do help me out. Thnx in advance...
raesa wrote:
Please do let me know if there is some function or some way to do it, because in my program i have to get the name of the machine.Is there a way out?
Have you tried
WNetGetConnection()
?"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
-
raesa wrote:
Please do let me know if there is some function or some way to do it, because in my program i have to get the name of the machine.Is there a way out?
Have you tried
WNetGetConnection()
?"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
oops
Codeproject MVP for C++, I can't believe it's for my lounge posts...
-
Hi..... I have a small problem in getting the hostname of the mapped drive. I have mapped a shared folder of a machine in network on my system. I have to get the name of the machine from the mapped drive. I was not able to find any proper function for that. Please do let me know if there is some function or some way to do it, because in my program i have to get the name of the machine.Is there a way out? Please do help me out. Thnx in advance...
I did some digging, and the following code worked for me:
TCHAR szBuf \[MAX\_PATH\]; DWORD dwSize = MAX\_PATH; DWORD dw = WNetGetConnection (\_T("p:"), szBuf, &dwSize);
It gave me "\\myserveraddress\sharename" in szBuf. Iain.
Codeproject MVP for C++, I can't believe it's for my lounge posts...
-
Hi..... I have a small problem in getting the hostname of the mapped drive. I have mapped a shared folder of a machine in network on my system. I have to get the name of the machine from the mapped drive. I was not able to find any proper function for that. Please do let me know if there is some function or some way to do it, because in my program i have to get the name of the machine.Is there a way out? Please do help me out. Thnx in advance...
[Message Deleted]
-
[Message Deleted]
That was one of the first results in google, but it's using .net namespace functionality, and mapping drives. So almost the exact opposite of what he needs. Phew, regained my sense of superiority after replying to the wrong person earlier! Iain.
Codeproject MVP for C++, I can't believe it's for my lounge posts...
-
That was one of the first results in google, but it's using .net namespace functionality, and mapping drives. So almost the exact opposite of what he needs. Phew, regained my sense of superiority after replying to the wrong person earlier! Iain.
Codeproject MVP for C++, I can't believe it's for my lounge posts...
Iain Clarke wrote:
Phew, regained my sense of superiority after replying to the wrong person earlier!
You can still delete that post and hardly anyone would know.
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
-
That was one of the first results in google, but it's using .net namespace functionality, and mapping drives. So almost the exact opposite of what he needs. Phew, regained my sense of superiority after replying to the wrong person earlier! Iain.
Codeproject MVP for C++, I can't believe it's for my lounge posts...
Yeah I didnt see .net I delete previous post. Now I changed title of my reply.:-D
Of one Essence is the human race thus has Creation put the base One Limb impacted is sufficient For all Others to feel the Mace (Saadi )
-
Yeah I didnt see .net I delete previous post. Now I changed title of my reply.:-D
Of one Essence is the human race thus has Creation put the base One Limb impacted is sufficient For all Others to feel the Mace (Saadi )
Hamid. wrote:
I delete previous post.
No, don't join them! :(( Iain.
Codeproject MVP for C++, I can't believe it's for my lounge posts...
-
Hamid. wrote:
I delete previous post.
No, don't join them! :(( Iain.
Codeproject MVP for C++, I can't believe it's for my lounge posts...
Iain Clarke wrote:
Codeproject MVP for C++, I can't believe it's for my lounge posts...
But I may have a superb reason to defy your arrogant assumptions.
It is a crappy thing, but it's life -^ Carlo Pallini
-
Iain Clarke wrote:
Codeproject MVP for C++, I can't believe it's for my lounge posts...
But I may have a superb reason to defy your arrogant assumptions.
It is a crappy thing, but it's life -^ Carlo Pallini
Infamy, infamy, they've all got it in fo' me! Iain.
Codeproject MVP for C++, I can't believe it's for my lounge posts...
-
raesa wrote:
Please do let me know if there is some function or some way to do it, because in my program i have to get the name of the machine.Is there a way out?
Have you tried
WNetGetConnection()
?"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch