PathIsUNCPathIsUNC*
*Contents  *Index  *Topic Contents
*Previous Topic: PathIsSystemFolder
*Next Topic: PathIsUNCServer

PathIsUNC


BOOL PathIsUNC(
    LPCTSTR pszPath
    );

Determines if the string is a valid UNC (universal naming convention) for a server and share path.

pszPath
Address of the path to validate.

Example:

#include <windows.h>
#include <iostream.h>
#include "Shlwapi.h"

void main( void )
{
	// String path name 1.
	char buffer_1[] = "\\\\path1\\path2";
	char *lpStr1;
	lpStr1 = buffer_1;

	// String path name 2.
	char buffer_2[] = "\\\\path3";
	char *lpStr2;
	lpStr2 = buffer_2;

	// String path name 3.
	char buffer_3[] = "acme\\path4\\path5";
	char *lpStr3;
	lpStr3 = buffer_3;

	// Variable to get the return 
	// from "PathIsUNC".	
    int	retval;	

	// Test path name 1.
    retval = PathIsUNC(lpStr1);
    cout << "The contents of String 1: " << lpStr1
		 << "\nThe return value from the function is " << retval << " = TRUE" << endl;
	// Test path name 2.
	retval = PathIsUNC(lpStr2);
    cout << "The contents of String 2: " << lpStr2
		 << "\nThe return value from the function is " << retval << " = TRUE" << endl;
	// Test path name 3.
	retval = PathIsUNC(lpStr3);
    cout << "The contents of String 3: " << lpStr3
		 << "\nThe return value from the function is " << retval << " = FALSE"<< endl;
}	
OUTPUT:
==============
The contents of String 1: \\path1\path2
The return value from the function is 1 = TRUE
The contents of String 2: \\path3
The return value from the function is 1 = TRUE
The contents of String 3: acme\path4\path5
The return value from the function is 0 = FALSE

Up Top of Page
© 1997 Microsoft Corporation. All rights reserved. Terms of Use.