ホーム › Networking.WinHttp › WinHttpRegisterProxyChangeNotification
WinHttpRegisterProxyChangeNotification
関数プロキシ設定変更の通知を登録する。
シグネチャ
// WINHTTP.dll
#include <windows.h>
DWORD WinHttpRegisterProxyChangeNotification(
ULONGLONG ullFlags,
WINHTTP_PROXY_CHANGE_CALLBACK pfnCallback,
void* pvContext,
void** hRegistration
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| ullFlags | ULONGLONG | in |
| pfnCallback | WINHTTP_PROXY_CHANGE_CALLBACK | in |
| pvContext | void* | in |
| hRegistration | void** | out |
戻り値の型: DWORD
各言語での呼び出し定義
// WINHTTP.dll
#include <windows.h>
DWORD WinHttpRegisterProxyChangeNotification(
ULONGLONG ullFlags,
WINHTTP_PROXY_CHANGE_CALLBACK pfnCallback,
void* pvContext,
void** hRegistration
);[DllImport("WINHTTP.dll", ExactSpelling = true)]
static extern uint WinHttpRegisterProxyChangeNotification(
ulong ullFlags, // ULONGLONG
IntPtr pfnCallback, // WINHTTP_PROXY_CHANGE_CALLBACK
IntPtr pvContext, // void*
IntPtr hRegistration // void** out
);<DllImport("WINHTTP.dll", ExactSpelling:=True)>
Public Shared Function WinHttpRegisterProxyChangeNotification(
ullFlags As ULong, ' ULONGLONG
pfnCallback As IntPtr, ' WINHTTP_PROXY_CHANGE_CALLBACK
pvContext As IntPtr, ' void*
hRegistration As IntPtr ' void** out
) As UInteger
End Function' ullFlags : ULONGLONG
' pfnCallback : WINHTTP_PROXY_CHANGE_CALLBACK
' pvContext : void*
' hRegistration : void** out
Declare PtrSafe Function WinHttpRegisterProxyChangeNotification Lib "winhttp" ( _
ByVal ullFlags As LongLong, _
ByVal pfnCallback As LongPtr, _
ByVal pvContext As LongPtr, _
ByVal hRegistration As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
WinHttpRegisterProxyChangeNotification = ctypes.windll.winhttp.WinHttpRegisterProxyChangeNotification
WinHttpRegisterProxyChangeNotification.restype = wintypes.DWORD
WinHttpRegisterProxyChangeNotification.argtypes = [
ctypes.c_ulonglong, # ullFlags : ULONGLONG
ctypes.c_void_p, # pfnCallback : WINHTTP_PROXY_CHANGE_CALLBACK
ctypes.POINTER(None), # pvContext : void*
ctypes.c_void_p, # hRegistration : void** out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('WINHTTP.dll')
WinHttpRegisterProxyChangeNotification = Fiddle::Function.new(
lib['WinHttpRegisterProxyChangeNotification'],
[
-Fiddle::TYPE_LONG_LONG, # ullFlags : ULONGLONG
Fiddle::TYPE_VOIDP, # pfnCallback : WINHTTP_PROXY_CHANGE_CALLBACK
Fiddle::TYPE_VOIDP, # pvContext : void*
Fiddle::TYPE_VOIDP, # hRegistration : void** out
],
-Fiddle::TYPE_INT)#[link(name = "winhttp")]
extern "system" {
fn WinHttpRegisterProxyChangeNotification(
ullFlags: u64, // ULONGLONG
pfnCallback: *const core::ffi::c_void, // WINHTTP_PROXY_CHANGE_CALLBACK
pvContext: *mut (), // void*
hRegistration: *mut *mut () // void** out
) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("WINHTTP.dll")]
public static extern uint WinHttpRegisterProxyChangeNotification(ulong ullFlags, IntPtr pfnCallback, IntPtr pvContext, IntPtr hRegistration);
"@
$api = Add-Type -MemberDefinition $sig -Name 'WINHTTP_WinHttpRegisterProxyChangeNotification' -Namespace Win32 -PassThru
# $api::WinHttpRegisterProxyChangeNotification(ullFlags, pfnCallback, pvContext, hRegistration)#uselib "WINHTTP.dll"
#func global WinHttpRegisterProxyChangeNotification "WinHttpRegisterProxyChangeNotification" sptr, sptr, sptr, sptr
; WinHttpRegisterProxyChangeNotification ullFlags, pfnCallback, pvContext, hRegistration ; 戻り値は stat
; ullFlags : ULONGLONG -> "sptr"
; pfnCallback : WINHTTP_PROXY_CHANGE_CALLBACK -> "sptr"
; pvContext : void* -> "sptr"
; hRegistration : void** out -> "sptr"
; ※HSP3.7は int64 引数(64bit値渡し)に非対応です。
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "WINHTTP.dll"
#cfunc global WinHttpRegisterProxyChangeNotification "WinHttpRegisterProxyChangeNotification" int64, sptr, sptr, sptr
; res = WinHttpRegisterProxyChangeNotification(ullFlags, pfnCallback, pvContext, hRegistration)
; ullFlags : ULONGLONG -> "int64"
; pfnCallback : WINHTTP_PROXY_CHANGE_CALLBACK -> "sptr"
; pvContext : void* -> "sptr"
; hRegistration : void** out -> "sptr"
; ※int64 引数の DLL 値渡しは x64 ランタイム(hsp3_64)のみ対応(x86 は未対応)。; DWORD WinHttpRegisterProxyChangeNotification(ULONGLONG ullFlags, WINHTTP_PROXY_CHANGE_CALLBACK pfnCallback, void* pvContext, void** hRegistration)
#uselib "WINHTTP.dll"
#cfunc global WinHttpRegisterProxyChangeNotification "WinHttpRegisterProxyChangeNotification" int64, intptr, intptr, intptr
; res = WinHttpRegisterProxyChangeNotification(ullFlags, pfnCallback, pvContext, hRegistration)
; ullFlags : ULONGLONG -> "int64"
; pfnCallback : WINHTTP_PROXY_CHANGE_CALLBACK -> "intptr"
; pvContext : void* -> "intptr"
; hRegistration : void** out -> "intptr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
winhttp = windows.NewLazySystemDLL("WINHTTP.dll")
procWinHttpRegisterProxyChangeNotification = winhttp.NewProc("WinHttpRegisterProxyChangeNotification")
)
// ullFlags (ULONGLONG), pfnCallback (WINHTTP_PROXY_CHANGE_CALLBACK), pvContext (void*), hRegistration (void** out)
r1, _, err := procWinHttpRegisterProxyChangeNotification.Call(
uintptr(ullFlags),
uintptr(pfnCallback),
uintptr(pvContext),
uintptr(hRegistration),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // DWORDfunction WinHttpRegisterProxyChangeNotification(
ullFlags: UInt64; // ULONGLONG
pfnCallback: Pointer; // WINHTTP_PROXY_CHANGE_CALLBACK
pvContext: Pointer; // void*
hRegistration: Pointer // void** out
): DWORD; stdcall;
external 'WINHTTP.dll' name 'WinHttpRegisterProxyChangeNotification';result := DllCall("WINHTTP\WinHttpRegisterProxyChangeNotification"
, "Int64", ullFlags ; ULONGLONG
, "Ptr", pfnCallback ; WINHTTP_PROXY_CHANGE_CALLBACK
, "Ptr", pvContext ; void*
, "Ptr", hRegistration ; void** out
, "UInt") ; return: DWORD●WinHttpRegisterProxyChangeNotification(ullFlags, pfnCallback, pvContext, hRegistration) = DLL("WINHTTP.dll", "dword WinHttpRegisterProxyChangeNotification(qword, void*, void*, void*)")
# 呼び出し: WinHttpRegisterProxyChangeNotification(ullFlags, pfnCallback, pvContext, hRegistration)
# ullFlags : ULONGLONG -> "qword"
# pfnCallback : WINHTTP_PROXY_CHANGE_CALLBACK -> "void*"
# pvContext : void* -> "void*"
# hRegistration : void** out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。