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

UrlIsW

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

シグネチャ

// SHLWAPI.dll  (Unicode / -W)
#include <windows.h>

BOOL UrlIsW(
    LPCWSTR pszUrl,
    URLIS UrlIs
);

パラメーター

名前方向
pszUrlLPCWSTRin
UrlIsURLISin

戻り値の型: BOOL

各言語での呼び出し定義

// SHLWAPI.dll  (Unicode / -W)
#include <windows.h>

BOOL UrlIsW(
    LPCWSTR pszUrl,
    URLIS UrlIs
);
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("SHLWAPI.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
static extern bool UrlIsW(
    [MarshalAs(UnmanagedType.LPWStr)] string pszUrl,   // LPCWSTR
    int UrlIs   // URLIS
);
<DllImport("SHLWAPI.dll", CharSet:=CharSet.Unicode, ExactSpelling:=True)>
Public Shared Function UrlIsW(
    <MarshalAs(UnmanagedType.LPWStr)> pszUrl As String,   ' LPCWSTR
    UrlIs As Integer   ' URLIS
) As Boolean
End Function
' pszUrl : LPCWSTR
' UrlIs : URLIS
Declare PtrSafe Function UrlIsW Lib "shlwapi" ( _
    ByVal pszUrl As LongPtr, _
    ByVal UrlIs As Long) As Long
' Unicode(W): 文字列は ByVal As LongPtr とし StrPtr(unicodeStr) を渡す
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

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

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

var (
	shlwapi = windows.NewLazySystemDLL("SHLWAPI.dll")
	procUrlIsW = shlwapi.NewProc("UrlIsW")
)

// pszUrl (LPCWSTR), UrlIs (URLIS)
r1, _, err := procUrlIsW.Call(
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(pszUrl))),
	uintptr(UrlIs),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // BOOL
function UrlIsW(
  pszUrl: PWideChar;   // LPCWSTR
  UrlIs: Integer   // URLIS
): BOOL; stdcall;
  external 'SHLWAPI.dll' name 'UrlIsW';
result := DllCall("SHLWAPI\UrlIsW"
    , "WStr", pszUrl   ; LPCWSTR
    , "Int", UrlIs   ; URLIS
    , "Int")   ; return: BOOL
●UrlIsW(pszUrl, UrlIs) = DLL("SHLWAPI.dll", "bool UrlIsW(char*, int)")
# 呼び出し: UrlIsW(pszUrl, UrlIs)
# pszUrl : LPCWSTR -> "char*"
# UrlIs : URLIS -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※-W(Unicode)関数。なでしこ1はANSIのため -A 版の利用を推奨。