ホーム › Networking.WinInet › GopherGetLocatorTypeW
GopherGetLocatorTypeW
関数Gopherロケーターの種類を解析して取得する(Unicode版)。
シグネチャ
// WININET.dll (Unicode / -W)
#include <windows.h>
BOOL GopherGetLocatorTypeW(
LPCWSTR lpszLocator,
DWORD* lpdwGopherType
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| lpszLocator | LPCWSTR | in |
| lpdwGopherType | DWORD* | out |
戻り値の型: BOOL
各言語での呼び出し定義
// WININET.dll (Unicode / -W)
#include <windows.h>
BOOL GopherGetLocatorTypeW(
LPCWSTR lpszLocator,
DWORD* lpdwGopherType
);[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("WININET.dll", CharSet = CharSet.Unicode, SetLastError = true, ExactSpelling = true)]
static extern bool GopherGetLocatorTypeW(
[MarshalAs(UnmanagedType.LPWStr)] string lpszLocator, // LPCWSTR
out uint lpdwGopherType // DWORD* out
);<DllImport("WININET.dll", CharSet:=CharSet.Unicode, SetLastError:=True, ExactSpelling:=True)>
Public Shared Function GopherGetLocatorTypeW(
<MarshalAs(UnmanagedType.LPWStr)> lpszLocator As String, ' LPCWSTR
<Out> ByRef lpdwGopherType As UInteger ' DWORD* out
) As Boolean
End Function' lpszLocator : LPCWSTR
' lpdwGopherType : DWORD* out
Declare PtrSafe Function GopherGetLocatorTypeW Lib "wininet" ( _
ByVal lpszLocator As LongPtr, _
ByRef lpdwGopherType 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
GopherGetLocatorTypeW = ctypes.windll.wininet.GopherGetLocatorTypeW
GopherGetLocatorTypeW.restype = wintypes.BOOL
GopherGetLocatorTypeW.argtypes = [
wintypes.LPCWSTR, # lpszLocator : LPCWSTR
ctypes.POINTER(wintypes.DWORD), # lpdwGopherType : DWORD* out
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('WININET.dll')
GopherGetLocatorTypeW = Fiddle::Function.new(
lib['GopherGetLocatorTypeW'],
[
Fiddle::TYPE_VOIDP, # lpszLocator : LPCWSTR
Fiddle::TYPE_VOIDP, # lpdwGopherType : DWORD* out
],
Fiddle::TYPE_INT)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"#[link(name = "wininet")]
extern "system" {
fn GopherGetLocatorTypeW(
lpszLocator: *const u16, // LPCWSTR
lpdwGopherType: *mut u32 // DWORD* out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("WININET.dll", CharSet = CharSet.Unicode, SetLastError = true)]
public static extern bool GopherGetLocatorTypeW([MarshalAs(UnmanagedType.LPWStr)] string lpszLocator, out uint lpdwGopherType);
"@
$api = Add-Type -MemberDefinition $sig -Name 'WININET_GopherGetLocatorTypeW' -Namespace Win32 -PassThru
# $api::GopherGetLocatorTypeW(lpszLocator, lpdwGopherType)#uselib "WININET.dll"
#func global GopherGetLocatorTypeW "GopherGetLocatorTypeW" wptr, wptr
; GopherGetLocatorTypeW lpszLocator, varptr(lpdwGopherType) ; 戻り値は stat
; lpszLocator : LPCWSTR -> "wptr"
; lpdwGopherType : DWORD* out -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "WININET.dll" #cfunc global GopherGetLocatorTypeW "GopherGetLocatorTypeW" wstr, var ; res = GopherGetLocatorTypeW(lpszLocator, lpdwGopherType) ; lpszLocator : LPCWSTR -> "wstr" ; lpdwGopherType : DWORD* out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "WININET.dll" #cfunc global GopherGetLocatorTypeW "GopherGetLocatorTypeW" wstr, sptr ; res = GopherGetLocatorTypeW(lpszLocator, varptr(lpdwGopherType)) ; lpszLocator : LPCWSTR -> "wstr" ; lpdwGopherType : DWORD* out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; BOOL GopherGetLocatorTypeW(LPCWSTR lpszLocator, DWORD* lpdwGopherType) #uselib "WININET.dll" #cfunc global GopherGetLocatorTypeW "GopherGetLocatorTypeW" wstr, var ; res = GopherGetLocatorTypeW(lpszLocator, lpdwGopherType) ; lpszLocator : LPCWSTR -> "wstr" ; lpdwGopherType : DWORD* out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; BOOL GopherGetLocatorTypeW(LPCWSTR lpszLocator, DWORD* lpdwGopherType) #uselib "WININET.dll" #cfunc global GopherGetLocatorTypeW "GopherGetLocatorTypeW" wstr, intptr ; res = GopherGetLocatorTypeW(lpszLocator, varptr(lpdwGopherType)) ; lpszLocator : LPCWSTR -> "wstr" ; lpdwGopherType : DWORD* out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
wininet = windows.NewLazySystemDLL("WININET.dll")
procGopherGetLocatorTypeW = wininet.NewProc("GopherGetLocatorTypeW")
)
// lpszLocator (LPCWSTR), lpdwGopherType (DWORD* out)
r1, _, err := procGopherGetLocatorTypeW.Call(
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(lpszLocator))),
uintptr(lpdwGopherType),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // BOOLfunction GopherGetLocatorTypeW(
lpszLocator: PWideChar; // LPCWSTR
lpdwGopherType: Pointer // DWORD* out
): BOOL; stdcall;
external 'WININET.dll' name 'GopherGetLocatorTypeW';result := DllCall("WININET\GopherGetLocatorTypeW"
, "WStr", lpszLocator ; LPCWSTR
, "Ptr", lpdwGopherType ; DWORD* out
, "Int") ; return: BOOL●GopherGetLocatorTypeW(lpszLocator, lpdwGopherType) = DLL("WININET.dll", "bool GopherGetLocatorTypeW(char*, void*)")
# 呼び出し: GopherGetLocatorTypeW(lpszLocator, lpdwGopherType)
# lpszLocator : LPCWSTR -> "char*"
# lpdwGopherType : DWORD* out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※-W(Unicode)関数。なでしこ1はANSIのため -A 版の利用を推奨。