Hinweis
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, sich anzumelden oder das Verzeichnis zu wechseln.
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, das Verzeichnis zu wechseln.
Testet eine bestimmte Zeichenfolge, um festzustellen, ob sie einem gültigen URL-Format entspricht.
Syntax
BOOL PathIsURLW(
[in] LPCWSTR pszPath
);
Parameter
[in] pszPath
Typ: LPCTSTR-
Ein Zeiger auf eine mit Null beendete Zeichenfolge der maximalen Länge MAX_PATH, die den zu überprüfenden URL-Pfad enthält.
Rückgabewert
Typ: BOOL-
Gibt TRUE- zurück, wenn pszPath ein gültiges URL-Format aufweist, oder andernfalls FALSE.
Bemerkungen
Diese Funktion überprüft nicht, ob der Pfad auf eine vorhandene Website verweist – nur, dass er über ein gültiges URL-Format verfügt.
Beispiele
#include <windows.h>
#include <iostream.h>
#include "Shlwapi.h"
void main( void )
{
// String path name 1.
char buffer_1[ ] = "http://www.microsoft.com/software/index.html";
char *lpStr1;
lpStr1 = buffer_1;
// String path name 2.
char buffer_2[ ] = "http://www.microsoft.com";
char *lpStr2;
lpStr2 = buffer_2;
// String path name 3.
char buffer_3[ ] = "microsoft.com";
char *lpStr3;
lpStr3 = buffer_3;
// Variable to get the return
// from "PathIsURL".
int retval;
// Test path name 1.
retval = PathIsURL(lpStr1);
cout << "The contents of String 1: " << lpStr1
<< "\nThe return value from the function is " << retval << " = TRUE" << endl;
// Test path name 2.
retval = PathIsURL(lpStr2);
cout << "The contents of String 2: " << lpStr2
<< "\nThe return value from the function is " << retval << " = TRUE" << endl;
// Test path name 3.
retval = PathIsURL(lpStr3);
cout << "The contents of String 3: " << lpStr3
<< "\nThe return value from the function is " << retval << " = FALSE"<< endl;
}
OUTPUT:
=============
The contents of String 1: http://www.microsoft.com/software/index.html
The return value from the function is 1 = TRUE
The contents of String 2: http://www.microsoft.com
The return value from the function is 1 = TRUE
The contents of String 3: microsoft.com
The return value from the function is 0 = FALSE
Anmerkung
Der Header "shlwapi.h" definiert PathIsURL als Alias, der die ANSI- oder Unicode-Version dieser Funktion basierend auf der Definition der UNICODE-Präprozessorkonstante automatisch auswählt. Das Mischen der Verwendung des codierungsneutralen Alias mit Code, der nicht codierungsneutral ist, kann zu Nichtübereinstimmungen führen, die zu Kompilierungs- oder Laufzeitfehlern führen. Weitere Informationen finden Sie unter Konventionen für Funktionsprototypen.
Anforderungen
Anforderung | Wert |
---|---|
mindestens unterstützte Client- | Windows 2000 Professional, Windows XP [nur Desktop-Apps] |
mindestens unterstützte Server- | Windows 2000 Server [nur Desktop-Apps] |
Zielplattform- | Fenster |
Header- | shlwapi.h |
Library | Shlwapi.lib |
DLL- | Shlwapi.dll (Version 4.71 oder höher) |