UrlGetLocationW
関数URLから位置(フラグメント)部分の先頭ポインタを取得する。
シグネチャ
// SHLWAPI.dll (Unicode / -W)
#include <windows.h>
LPWSTR UrlGetLocationW(
LPCWSTR pszURL
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| pszURL | LPCWSTR | in |
戻り値の型: LPWSTR
各言語での呼び出し定義
// SHLWAPI.dll (Unicode / -W)
#include <windows.h>
LPWSTR UrlGetLocationW(
LPCWSTR pszURL
);[DllImport("SHLWAPI.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
static extern IntPtr UrlGetLocationW(
[MarshalAs(UnmanagedType.LPWStr)] string pszURL // LPCWSTR
);<DllImport("SHLWAPI.dll", CharSet:=CharSet.Unicode, ExactSpelling:=True)>
Public Shared Function UrlGetLocationW(
<MarshalAs(UnmanagedType.LPWStr)> pszURL As String ' LPCWSTR
) As IntPtr
End Function' pszURL : LPCWSTR
Declare PtrSafe Function UrlGetLocationW Lib "shlwapi" ( _
ByVal pszURL As LongPtr) As LongPtr
' 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
UrlGetLocationW = ctypes.windll.shlwapi.UrlGetLocationW
UrlGetLocationW.restype = wintypes.LPWSTR
UrlGetLocationW.argtypes = [
wintypes.LPCWSTR, # pszURL : LPCWSTR
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('SHLWAPI.dll')
UrlGetLocationW = Fiddle::Function.new(
lib['UrlGetLocationW'],
[
Fiddle::TYPE_VOIDP, # pszURL : LPCWSTR
],
Fiddle::TYPE_VOIDP)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"#[link(name = "shlwapi")]
extern "system" {
fn UrlGetLocationW(
pszURL: *const u16 // LPCWSTR
) -> *mut u16;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("SHLWAPI.dll", CharSet = CharSet.Unicode)]
public static extern IntPtr UrlGetLocationW([MarshalAs(UnmanagedType.LPWStr)] string pszURL);
"@
$api = Add-Type -MemberDefinition $sig -Name 'SHLWAPI_UrlGetLocationW' -Namespace Win32 -PassThru
# $api::UrlGetLocationW(pszURL)#uselib "SHLWAPI.dll"
#func global UrlGetLocationW "UrlGetLocationW" wptr
; UrlGetLocationW pszURL ; 戻り値は stat
; pszURL : LPCWSTR -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "SHLWAPI.dll"
#cfunc global UrlGetLocationW "UrlGetLocationW" wstr
; res = UrlGetLocationW(pszURL)
; pszURL : LPCWSTR -> "wstr"; LPWSTR UrlGetLocationW(LPCWSTR pszURL)
#uselib "SHLWAPI.dll"
#cfunc global UrlGetLocationW "UrlGetLocationW" wstr
; res = UrlGetLocationW(pszURL)
; pszURL : LPCWSTR -> "wstr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
shlwapi = windows.NewLazySystemDLL("SHLWAPI.dll")
procUrlGetLocationW = shlwapi.NewProc("UrlGetLocationW")
)
// pszURL (LPCWSTR)
r1, _, err := procUrlGetLocationW.Call(
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(pszURL))),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // LPWSTRfunction UrlGetLocationW(
pszURL: PWideChar // LPCWSTR
): PWideChar; stdcall;
external 'SHLWAPI.dll' name 'UrlGetLocationW';result := DllCall("SHLWAPI\UrlGetLocationW"
, "WStr", pszURL ; LPCWSTR
, "Ptr") ; return: LPWSTR●UrlGetLocationW(pszURL) = DLL("SHLWAPI.dll", "char* UrlGetLocationW(char*)")
# 呼び出し: UrlGetLocationW(pszURL)
# pszURL : LPCWSTR -> "char*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※-W(Unicode)関数。なでしこ1はANSIのため -A 版の利用を推奨。