Click to See Complete Forum and Search --> : How can I get the UNC path of a drive ?
Braulio
April 30th, 1999, 06:41 AM
Hi,
I would like to get the UNC path of one drive for example for:
F:
Win on SERVER1-NT-PC
Or something like that ;-), How can I get this ?
Thanks, Bye !
Braulio
suganyas
May 3rd, 1999, 03:05 AM
Hi Braulio!
The WNetGetUniversalName function takes a drive-based path for a network resource and obtains a data structure that contains a more universal form of the name. Look into the help for more details on how to use it.
Here is a piece of code which will help get the UNC path given the drive(in this case the drive letter E is given).
#include "winnetwk.h"
UNIVERSAL_NAME_INFO UNC;
DWORD dsize = 500;
WNetGetUniversalName("E:\\", UNIVERSAL_NAME_INFO_LEVEL,&UNC,(LPDWORD)&dsize);
AfxMessageBox(UNC.lpUniversalName);
Do let me know if it works.
Regards,
Sukanya Swaminathan
Software Engineer
Aditi Technologies
Blr - 80
Email : suganyas@aditi.com
Wollny
June 17th, 1999, 07:57 AM
Hello,
I tried to use WNetGetUniversalName, compiling works very well but linking failed with
Test.obj : error LNK2001: unresolved external symbol _WNetGetUniversalNameA@16
.
In the online-help I couldn't find any information about the need to add a lib for linking. Can you help me?
Thomas Wollny
John Holifield
June 17th, 1999, 10:56 AM
mpr.lib is what you should link with.
Happy Coding
Wollny
June 18th, 1999, 01:40 AM
Thanks John,
it seems I was blind, I looked 5 times into the Quick Info but didn't see the line "Import Library mpr.lib". Next time I will look better.
Thomas Wollny
June 18th, 1999, 04:19 AM
Hello Braudio,
Try this:
GetComputerName(lpszValue, &dwSize);
It works for me.
David Chan
June 18th, 1999, 07:45 AM
I tried this for practice and it works fine, the message box appears with the full name of the selected drive
however after that when I leave the
Maruthi Chirala
December 2nd, 1999, 08:14 PM
hi,
i too receiving the same error message during linking. But my requirement is on Win95. the quickinfo says its only supported on WinNT.
Can you guys help me out.
Maruthi Chirala
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.