Win32 API 日本語リファレンス
ホームUI.Shell › UrlIsA

UrlIsA

関数
URLが指定した種別の条件を満たすかどうかを判定する。
DLLSHLWAPI.dll文字セットANSI (-A)呼出規約winapi対応OSWindows 2000 以降

シグネチャ

// SHLWAPI.dll  (ANSI / -A)
#include <windows.h>

BOOL UrlIsA(
    LPCSTR pszUrl,
    URLIS UrlIs
);

パラメーター

名前方向
pszUrlLPCSTRin
UrlIsURLISin

戻り値の型: BOOL

各言語での呼び出し定義

// SHLWAPI.dll  (ANSI / -A)
#include <windows.h>

BOOL UrlIsA(
    LPCSTR pszUrl,
    URLIS UrlIs
);
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("SHLWAPI.dll", CharSet = CharSet.Ansi, ExactSpelling = true)]
static extern bool UrlIsA(
    [MarshalAs(UnmanagedType.LPStr)] string pszUrl,   // LPCSTR
    int UrlIs   // URLIS
);
<DllImport("SHLWAPI.dll", CharSet:=CharSet.Ansi, ExactSpelling:=True)>
Public Shared Function UrlIsA(
    <MarshalAs(UnmanagedType.LPStr)> pszUrl As String,   ' LPCSTR
    UrlIs As Integer   ' URLIS
) As Boolean
End Function
' pszUrl : LPCSTR
' UrlIs : URLIS
Declare PtrSafe Function UrlIsA Lib "shlwapi" ( _
    ByVal pszUrl As String, _
    ByVal UrlIs As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

UrlIsA = ctypes.windll.shlwapi.UrlIsA
UrlIsA.restype = wintypes.BOOL
UrlIsA.argtypes = [
    wintypes.LPCSTR,  # pszUrl : LPCSTR
    ctypes.c_int,  # UrlIs : URLIS
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('SHLWAPI.dll')
UrlIsA = Fiddle::Function.new(
  lib['UrlIsA'],
  [
    Fiddle::TYPE_VOIDP,  # pszUrl : LPCSTR
    Fiddle::TYPE_INT,  # UrlIs : URLIS
  ],
  Fiddle::TYPE_INT)
#[link(name = "shlwapi")]
extern "system" {
    fn UrlIsA(
        pszUrl: *const u8,  // LPCSTR
        UrlIs: i32  // URLIS
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("SHLWAPI.dll", CharSet = CharSet.Ansi)]
public static extern bool UrlIsA([MarshalAs(UnmanagedType.LPStr)] string pszUrl, int UrlIs);
"@
$api = Add-Type -MemberDefinition $sig -Name 'SHLWAPI_UrlIsA' -Namespace Win32 -PassThru
# $api::UrlIsA(pszUrl, UrlIs)
#uselib "SHLWAPI.dll"
#func global UrlIsA "UrlIsA" sptr, sptr
; UrlIsA pszUrl, UrlIs   ; 戻り値は stat
; pszUrl : LPCSTR -> "sptr"
; UrlIs : URLIS -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "SHLWAPI.dll"
#cfunc global UrlIsA "UrlIsA" str, int
; res = UrlIsA(pszUrl, UrlIs)
; pszUrl : LPCSTR -> "str"
; UrlIs : URLIS -> "int"
; BOOL UrlIsA(LPCSTR pszUrl, URLIS UrlIs)
#uselib "SHLWAPI.dll"
#cfunc global UrlIsA "UrlIsA" str, int
; res = UrlIsA(pszUrl, UrlIs)
; pszUrl : LPCSTR -> "str"
; UrlIs : URLIS -> "int"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	shlwapi = windows.NewLazySystemDLL("SHLWAPI.dll")
	procUrlIsA = shlwapi.NewProc("UrlIsA")
)

// pszUrl (LPCSTR), UrlIs (URLIS)
r1, _, err := procUrlIsA.Call(
	uintptr(unsafe.Pointer(windows.BytePtrFromString(pszUrl))),
	uintptr(UrlIs),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // BOOL
function UrlIsA(
  pszUrl: PAnsiChar;   // LPCSTR
  UrlIs: Integer   // URLIS
): BOOL; stdcall;
  external 'SHLWAPI.dll' name 'UrlIsA';
result := DllCall("SHLWAPI\UrlIsA"
    , "AStr", pszUrl   ; LPCSTR
    , "Int", UrlIs   ; URLIS
    , "Int")   ; return: BOOL
●UrlIsA(pszUrl, UrlIs) = DLL("SHLWAPI.dll", "bool UrlIsA(char*, int)")
# 呼び出し: UrlIsA(pszUrl, UrlIs)
# pszUrl : LPCSTR -> "char*"
# UrlIs : URLIS -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。