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
Printable View
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
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 : [email protected]
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
mpr.lib is what you should link with.
Happy Coding
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
Hello Braudio,
Try this:
GetComputerName(lpszValue, &dwSize);
It works for me.
David Chan
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
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