ホーム › Networking.WinInet › InternetSetOptionExA
InternetSetOptionExA
関数WinINetハンドルのオプション値を拡張フラグ付きで設定する(ANSI)。
シグネチャ
// WININET.dll (ANSI / -A)
#include <windows.h>
BOOL InternetSetOptionExA(
void* hInternet, // optional
DWORD dwOption,
void* lpBuffer, // optional
DWORD dwBufferLength,
DWORD dwFlags
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hInternet | void* | inoptional |
| dwOption | DWORD | in |
| lpBuffer | void* | inoptional |
| dwBufferLength | DWORD | in |
| dwFlags | DWORD | in |
戻り値の型: BOOL
各言語での呼び出し定義
// WININET.dll (ANSI / -A)
#include <windows.h>
BOOL InternetSetOptionExA(
void* hInternet, // optional
DWORD dwOption,
void* lpBuffer, // optional
DWORD dwBufferLength,
DWORD dwFlags
);[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("WININET.dll", CharSet = CharSet.Ansi, ExactSpelling = true)]
static extern bool InternetSetOptionExA(
IntPtr hInternet, // void* optional
uint dwOption, // DWORD
IntPtr lpBuffer, // void* optional
uint dwBufferLength, // DWORD
uint dwFlags // DWORD
);<DllImport("WININET.dll", CharSet:=CharSet.Ansi, ExactSpelling:=True)>
Public Shared Function InternetSetOptionExA(
hInternet As IntPtr, ' void* optional
dwOption As UInteger, ' DWORD
lpBuffer As IntPtr, ' void* optional
dwBufferLength As UInteger, ' DWORD
dwFlags As UInteger ' DWORD
) As Boolean
End Function' hInternet : void* optional
' dwOption : DWORD
' lpBuffer : void* optional
' dwBufferLength : DWORD
' dwFlags : DWORD
Declare PtrSafe Function InternetSetOptionExA Lib "wininet" ( _
ByVal hInternet As LongPtr, _
ByVal dwOption As Long, _
ByVal lpBuffer As LongPtr, _
ByVal dwBufferLength As Long, _
ByVal dwFlags As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
InternetSetOptionExA = ctypes.windll.wininet.InternetSetOptionExA
InternetSetOptionExA.restype = wintypes.BOOL
InternetSetOptionExA.argtypes = [
ctypes.POINTER(None), # hInternet : void* optional
wintypes.DWORD, # dwOption : DWORD
ctypes.POINTER(None), # lpBuffer : void* optional
wintypes.DWORD, # dwBufferLength : DWORD
wintypes.DWORD, # dwFlags : DWORD
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('WININET.dll')
InternetSetOptionExA = Fiddle::Function.new(
lib['InternetSetOptionExA'],
[
Fiddle::TYPE_VOIDP, # hInternet : void* optional
-Fiddle::TYPE_INT, # dwOption : DWORD
Fiddle::TYPE_VOIDP, # lpBuffer : void* optional
-Fiddle::TYPE_INT, # dwBufferLength : DWORD
-Fiddle::TYPE_INT, # dwFlags : DWORD
],
Fiddle::TYPE_INT)#[link(name = "wininet")]
extern "system" {
fn InternetSetOptionExA(
hInternet: *mut (), // void* optional
dwOption: u32, // DWORD
lpBuffer: *mut (), // void* optional
dwBufferLength: u32, // DWORD
dwFlags: u32 // DWORD
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("WININET.dll", CharSet = CharSet.Ansi)]
public static extern bool InternetSetOptionExA(IntPtr hInternet, uint dwOption, IntPtr lpBuffer, uint dwBufferLength, uint dwFlags);
"@
$api = Add-Type -MemberDefinition $sig -Name 'WININET_InternetSetOptionExA' -Namespace Win32 -PassThru
# $api::InternetSetOptionExA(hInternet, dwOption, lpBuffer, dwBufferLength, dwFlags)#uselib "WININET.dll"
#func global InternetSetOptionExA "InternetSetOptionExA" sptr, sptr, sptr, sptr, sptr
; InternetSetOptionExA hInternet, dwOption, lpBuffer, dwBufferLength, dwFlags ; 戻り値は stat
; hInternet : void* optional -> "sptr"
; dwOption : DWORD -> "sptr"
; lpBuffer : void* optional -> "sptr"
; dwBufferLength : DWORD -> "sptr"
; dwFlags : DWORD -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "WININET.dll"
#cfunc global InternetSetOptionExA "InternetSetOptionExA" sptr, int, sptr, int, int
; res = InternetSetOptionExA(hInternet, dwOption, lpBuffer, dwBufferLength, dwFlags)
; hInternet : void* optional -> "sptr"
; dwOption : DWORD -> "int"
; lpBuffer : void* optional -> "sptr"
; dwBufferLength : DWORD -> "int"
; dwFlags : DWORD -> "int"; BOOL InternetSetOptionExA(void* hInternet, DWORD dwOption, void* lpBuffer, DWORD dwBufferLength, DWORD dwFlags)
#uselib "WININET.dll"
#cfunc global InternetSetOptionExA "InternetSetOptionExA" intptr, int, intptr, int, int
; res = InternetSetOptionExA(hInternet, dwOption, lpBuffer, dwBufferLength, dwFlags)
; hInternet : void* optional -> "intptr"
; dwOption : DWORD -> "int"
; lpBuffer : void* optional -> "intptr"
; dwBufferLength : DWORD -> "int"
; dwFlags : DWORD -> "int"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
wininet = windows.NewLazySystemDLL("WININET.dll")
procInternetSetOptionExA = wininet.NewProc("InternetSetOptionExA")
)
// hInternet (void* optional), dwOption (DWORD), lpBuffer (void* optional), dwBufferLength (DWORD), dwFlags (DWORD)
r1, _, err := procInternetSetOptionExA.Call(
uintptr(hInternet),
uintptr(dwOption),
uintptr(lpBuffer),
uintptr(dwBufferLength),
uintptr(dwFlags),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // BOOLfunction InternetSetOptionExA(
hInternet: Pointer; // void* optional
dwOption: DWORD; // DWORD
lpBuffer: Pointer; // void* optional
dwBufferLength: DWORD; // DWORD
dwFlags: DWORD // DWORD
): BOOL; stdcall;
external 'WININET.dll' name 'InternetSetOptionExA';result := DllCall("WININET\InternetSetOptionExA"
, "Ptr", hInternet ; void* optional
, "UInt", dwOption ; DWORD
, "Ptr", lpBuffer ; void* optional
, "UInt", dwBufferLength ; DWORD
, "UInt", dwFlags ; DWORD
, "Int") ; return: BOOL●InternetSetOptionExA(hInternet, dwOption, lpBuffer, dwBufferLength, dwFlags) = DLL("WININET.dll", "bool InternetSetOptionExA(void*, dword, void*, dword, dword)")
# 呼び出し: InternetSetOptionExA(hInternet, dwOption, lpBuffer, dwBufferLength, dwFlags)
# hInternet : void* optional -> "void*"
# dwOption : DWORD -> "dword"
# lpBuffer : void* optional -> "void*"
# dwBufferLength : DWORD -> "dword"
# dwFlags : DWORD -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。