Win32 API 日本語リファレンス
ホームSystem.Com.Urlmon › UrlMkSetSessionOption

UrlMkSetSessionOption

関数
URLモニカーセッションのオプションを設定する。
DLLurlmon.dll呼出規約winapi

シグネチャ

// urlmon.dll
#include <windows.h>

HRESULT UrlMkSetSessionOption(
    DWORD dwOption,
    void* pBuffer,   // optional
    DWORD dwBufferLength,
    DWORD dwReserved   // optional
);

パラメーター

名前方向
dwOptionDWORDin
pBuffervoid*inoptional
dwBufferLengthDWORDin
dwReservedDWORDoptional

戻り値の型: HRESULT

各言語での呼び出し定義

// urlmon.dll
#include <windows.h>

HRESULT UrlMkSetSessionOption(
    DWORD dwOption,
    void* pBuffer,   // optional
    DWORD dwBufferLength,
    DWORD dwReserved   // optional
);
[DllImport("urlmon.dll", ExactSpelling = true)]
static extern int UrlMkSetSessionOption(
    uint dwOption,   // DWORD
    IntPtr pBuffer,   // void* optional
    uint dwBufferLength,   // DWORD
    uint dwReserved   // DWORD optional
);
<DllImport("urlmon.dll", ExactSpelling:=True)>
Public Shared Function UrlMkSetSessionOption(
    dwOption As UInteger,   ' DWORD
    pBuffer As IntPtr,   ' void* optional
    dwBufferLength As UInteger,   ' DWORD
    dwReserved As UInteger   ' DWORD optional
) As Integer
End Function
' dwOption : DWORD
' pBuffer : void* optional
' dwBufferLength : DWORD
' dwReserved : DWORD optional
Declare PtrSafe Function UrlMkSetSessionOption Lib "urlmon" ( _
    ByVal dwOption As Long, _
    ByVal pBuffer As LongPtr, _
    ByVal dwBufferLength As Long, _
    ByVal dwReserved As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

UrlMkSetSessionOption = ctypes.windll.urlmon.UrlMkSetSessionOption
UrlMkSetSessionOption.restype = ctypes.c_int
UrlMkSetSessionOption.argtypes = [
    wintypes.DWORD,  # dwOption : DWORD
    ctypes.POINTER(None),  # pBuffer : void* optional
    wintypes.DWORD,  # dwBufferLength : DWORD
    wintypes.DWORD,  # dwReserved : DWORD optional
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('urlmon.dll')
UrlMkSetSessionOption = Fiddle::Function.new(
  lib['UrlMkSetSessionOption'],
  [
    -Fiddle::TYPE_INT,  # dwOption : DWORD
    Fiddle::TYPE_VOIDP,  # pBuffer : void* optional
    -Fiddle::TYPE_INT,  # dwBufferLength : DWORD
    -Fiddle::TYPE_INT,  # dwReserved : DWORD optional
  ],
  Fiddle::TYPE_INT)
#[link(name = "urlmon")]
extern "system" {
    fn UrlMkSetSessionOption(
        dwOption: u32,  // DWORD
        pBuffer: *mut (),  // void* optional
        dwBufferLength: u32,  // DWORD
        dwReserved: u32  // DWORD optional
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("urlmon.dll")]
public static extern int UrlMkSetSessionOption(uint dwOption, IntPtr pBuffer, uint dwBufferLength, uint dwReserved);
"@
$api = Add-Type -MemberDefinition $sig -Name 'urlmon_UrlMkSetSessionOption' -Namespace Win32 -PassThru
# $api::UrlMkSetSessionOption(dwOption, pBuffer, dwBufferLength, dwReserved)
#uselib "urlmon.dll"
#func global UrlMkSetSessionOption "UrlMkSetSessionOption" sptr, sptr, sptr, sptr
; UrlMkSetSessionOption dwOption, pBuffer, dwBufferLength, dwReserved   ; 戻り値は stat
; dwOption : DWORD -> "sptr"
; pBuffer : void* optional -> "sptr"
; dwBufferLength : DWORD -> "sptr"
; dwReserved : DWORD optional -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "urlmon.dll"
#cfunc global UrlMkSetSessionOption "UrlMkSetSessionOption" int, sptr, int, int
; res = UrlMkSetSessionOption(dwOption, pBuffer, dwBufferLength, dwReserved)
; dwOption : DWORD -> "int"
; pBuffer : void* optional -> "sptr"
; dwBufferLength : DWORD -> "int"
; dwReserved : DWORD optional -> "int"
; HRESULT UrlMkSetSessionOption(DWORD dwOption, void* pBuffer, DWORD dwBufferLength, DWORD dwReserved)
#uselib "urlmon.dll"
#cfunc global UrlMkSetSessionOption "UrlMkSetSessionOption" int, intptr, int, int
; res = UrlMkSetSessionOption(dwOption, pBuffer, dwBufferLength, dwReserved)
; dwOption : DWORD -> "int"
; pBuffer : void* optional -> "intptr"
; dwBufferLength : DWORD -> "int"
; dwReserved : DWORD optional -> "int"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	urlmon = windows.NewLazySystemDLL("urlmon.dll")
	procUrlMkSetSessionOption = urlmon.NewProc("UrlMkSetSessionOption")
)

// dwOption (DWORD), pBuffer (void* optional), dwBufferLength (DWORD), dwReserved (DWORD optional)
r1, _, err := procUrlMkSetSessionOption.Call(
	uintptr(dwOption),
	uintptr(pBuffer),
	uintptr(dwBufferLength),
	uintptr(dwReserved),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // HRESULT
function UrlMkSetSessionOption(
  dwOption: DWORD;   // DWORD
  pBuffer: Pointer;   // void* optional
  dwBufferLength: DWORD;   // DWORD
  dwReserved: DWORD   // DWORD optional
): Integer; stdcall;
  external 'urlmon.dll' name 'UrlMkSetSessionOption';
result := DllCall("urlmon\UrlMkSetSessionOption"
    , "UInt", dwOption   ; DWORD
    , "Ptr", pBuffer   ; void* optional
    , "UInt", dwBufferLength   ; DWORD
    , "UInt", dwReserved   ; DWORD optional
    , "Int")   ; return: HRESULT
●UrlMkSetSessionOption(dwOption, pBuffer, dwBufferLength, dwReserved) = DLL("urlmon.dll", "int UrlMkSetSessionOption(dword, void*, dword, dword)")
# 呼び出し: UrlMkSetSessionOption(dwOption, pBuffer, dwBufferLength, dwReserved)
# dwOption : DWORD -> "dword"
# pBuffer : void* optional -> "void*"
# dwBufferLength : DWORD -> "dword"
# dwReserved : DWORD optional -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。