Nota
O acesso a esta página requer autorização. Pode tentar iniciar sessão ou alterar os diretórios.
O acesso a esta página requer autorização. Pode tentar alterar os diretórios.
Testa uma determinada cadeia de caracteres para determinar se ela está em conformidade com um formato de URL válido.
Sintaxe
BOOL PathIsURLA(
[in] LPCSTR pszPath
);
Parâmetros
[in] pszPath
Tipo: LPCTSTR
Um ponteiro para uma cadeia de caracteres terminada em nulo de comprimento máximo MAX_PATH que contém o caminho de URL a ser validado.
Valor de retorno
Tipo: BOOL
Retornará TRUE se pszPath tiver um formato de URL válido ou FALSE caso contrário.
Observações
Essa função não verifica se o caminho aponta para um site existente, apenas se ele tem um formato de URL válido.
Exemplos
#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
Nota
O cabeçalho shlwapi.h define PathIsURL como um alias que seleciona automaticamente a versão ANSI ou Unicode dessa função com base na definição da constante do pré-processador UNICODE. A combinação do uso do alias neutro de codificação com código que não é neutro em codificação pode levar a incompatibilidades que resultam em erros de compilação ou de runtime. Para obter mais informações, consulte Conventions for Function Prototypes.
Requisitos
Requisito | Valor |
---|---|
de cliente com suporte mínimo | Windows 2000 Professional, Windows XP [somente aplicativos da área de trabalho] |
servidor com suporte mínimo | Windows 2000 Server [somente aplicativos da área de trabalho] |
da Plataforma de Destino |
Windows |
cabeçalho | shlwapi.h |
biblioteca | Shlwapi.lib |
de DLL |
Shlwapi.dll (versão 4.71 ou posterior) |