Win32 API 日本語リファレンス
ホームNetworking.WinInet › RegisterUrlCacheNotification

RegisterUrlCacheNotification

関数
URLキャッシュ操作の通知を登録する。
DLLWININET.dll呼出規約winapi

シグネチャ

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

BOOL RegisterUrlCacheNotification(
    HWND hWnd,   // optional
    DWORD uMsg,
    LONGLONG gid,
    DWORD dwOpsFilter,
    DWORD dwReserved
);

パラメーター

名前方向
hWndHWNDinoptional
uMsgDWORDin
gidLONGLONGin
dwOpsFilterDWORDin
dwReservedDWORDin

戻り値の型: BOOL

各言語での呼び出し定義

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

BOOL RegisterUrlCacheNotification(
    HWND hWnd,   // optional
    DWORD uMsg,
    LONGLONG gid,
    DWORD dwOpsFilter,
    DWORD dwReserved
);
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("WININET.dll", ExactSpelling = true)]
static extern bool RegisterUrlCacheNotification(
    IntPtr hWnd,   // HWND optional
    uint uMsg,   // DWORD
    long gid,   // LONGLONG
    uint dwOpsFilter,   // DWORD
    uint dwReserved   // DWORD
);
<DllImport("WININET.dll", ExactSpelling:=True)>
Public Shared Function RegisterUrlCacheNotification(
    hWnd As IntPtr,   ' HWND optional
    uMsg As UInteger,   ' DWORD
    gid As Long,   ' LONGLONG
    dwOpsFilter As UInteger,   ' DWORD
    dwReserved As UInteger   ' DWORD
) As Boolean
End Function
' hWnd : HWND optional
' uMsg : DWORD
' gid : LONGLONG
' dwOpsFilter : DWORD
' dwReserved : DWORD
Declare PtrSafe Function RegisterUrlCacheNotification Lib "wininet" ( _
    ByVal hWnd As LongPtr, _
    ByVal uMsg As Long, _
    ByVal gid As LongLong, _
    ByVal dwOpsFilter 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

RegisterUrlCacheNotification = ctypes.windll.wininet.RegisterUrlCacheNotification
RegisterUrlCacheNotification.restype = wintypes.BOOL
RegisterUrlCacheNotification.argtypes = [
    wintypes.HANDLE,  # hWnd : HWND optional
    wintypes.DWORD,  # uMsg : DWORD
    ctypes.c_longlong,  # gid : LONGLONG
    wintypes.DWORD,  # dwOpsFilter : DWORD
    wintypes.DWORD,  # dwReserved : DWORD
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('WININET.dll')
RegisterUrlCacheNotification = Fiddle::Function.new(
  lib['RegisterUrlCacheNotification'],
  [
    Fiddle::TYPE_VOIDP,  # hWnd : HWND optional
    -Fiddle::TYPE_INT,  # uMsg : DWORD
    Fiddle::TYPE_LONG_LONG,  # gid : LONGLONG
    -Fiddle::TYPE_INT,  # dwOpsFilter : DWORD
    -Fiddle::TYPE_INT,  # dwReserved : DWORD
  ],
  Fiddle::TYPE_INT)
#[link(name = "wininet")]
extern "system" {
    fn RegisterUrlCacheNotification(
        hWnd: *mut core::ffi::c_void,  // HWND optional
        uMsg: u32,  // DWORD
        gid: i64,  // LONGLONG
        dwOpsFilter: u32,  // DWORD
        dwReserved: u32  // DWORD
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("WININET.dll")]
public static extern bool RegisterUrlCacheNotification(IntPtr hWnd, uint uMsg, long gid, uint dwOpsFilter, uint dwReserved);
"@
$api = Add-Type -MemberDefinition $sig -Name 'WININET_RegisterUrlCacheNotification' -Namespace Win32 -PassThru
# $api::RegisterUrlCacheNotification(hWnd, uMsg, gid, dwOpsFilter, dwReserved)
#uselib "WININET.dll"
#func global RegisterUrlCacheNotification "RegisterUrlCacheNotification" sptr, sptr, sptr, sptr, sptr
; RegisterUrlCacheNotification hWnd, uMsg, gid, dwOpsFilter, dwReserved   ; 戻り値は stat
; hWnd : HWND optional -> "sptr"
; uMsg : DWORD -> "sptr"
; gid : LONGLONG -> "sptr"
; dwOpsFilter : DWORD -> "sptr"
; dwReserved : DWORD -> "sptr"
; ※HSP3.7は int64 引数(64bit値渡し)に非対応です。
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "WININET.dll"
#cfunc global RegisterUrlCacheNotification "RegisterUrlCacheNotification" sptr, int, int64, int, int
; res = RegisterUrlCacheNotification(hWnd, uMsg, gid, dwOpsFilter, dwReserved)
; hWnd : HWND optional -> "sptr"
; uMsg : DWORD -> "int"
; gid : LONGLONG -> "int64"
; dwOpsFilter : DWORD -> "int"
; dwReserved : DWORD -> "int"
; ※int64 引数の DLL 値渡しは x64 ランタイム(hsp3_64)のみ対応(x86 は未対応)。
; BOOL RegisterUrlCacheNotification(HWND hWnd, DWORD uMsg, LONGLONG gid, DWORD dwOpsFilter, DWORD dwReserved)
#uselib "WININET.dll"
#cfunc global RegisterUrlCacheNotification "RegisterUrlCacheNotification" intptr, int, int64, int, int
; res = RegisterUrlCacheNotification(hWnd, uMsg, gid, dwOpsFilter, dwReserved)
; hWnd : HWND optional -> "intptr"
; uMsg : DWORD -> "int"
; gid : LONGLONG -> "int64"
; dwOpsFilter : DWORD -> "int"
; dwReserved : DWORD -> "int"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	wininet = windows.NewLazySystemDLL("WININET.dll")
	procRegisterUrlCacheNotification = wininet.NewProc("RegisterUrlCacheNotification")
)

// hWnd (HWND optional), uMsg (DWORD), gid (LONGLONG), dwOpsFilter (DWORD), dwReserved (DWORD)
r1, _, err := procRegisterUrlCacheNotification.Call(
	uintptr(hWnd),
	uintptr(uMsg),
	uintptr(gid),
	uintptr(dwOpsFilter),
	uintptr(dwReserved),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // BOOL
function RegisterUrlCacheNotification(
  hWnd: THandle;   // HWND optional
  uMsg: DWORD;   // DWORD
  gid: Int64;   // LONGLONG
  dwOpsFilter: DWORD;   // DWORD
  dwReserved: DWORD   // DWORD
): BOOL; stdcall;
  external 'WININET.dll' name 'RegisterUrlCacheNotification';
result := DllCall("WININET\RegisterUrlCacheNotification"
    , "Ptr", hWnd   ; HWND optional
    , "UInt", uMsg   ; DWORD
    , "Int64", gid   ; LONGLONG
    , "UInt", dwOpsFilter   ; DWORD
    , "UInt", dwReserved   ; DWORD
    , "Int")   ; return: BOOL
●RegisterUrlCacheNotification(hWnd, uMsg, gid, dwOpsFilter, dwReserved) = DLL("WININET.dll", "bool RegisterUrlCacheNotification(void*, dword, int64, dword, dword)")
# 呼び出し: RegisterUrlCacheNotification(hWnd, uMsg, gid, dwOpsFilter, dwReserved)
# hWnd : HWND optional -> "void*"
# uMsg : DWORD -> "dword"
# gid : LONGLONG -> "int64"
# dwOpsFilter : DWORD -> "dword"
# dwReserved : DWORD -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。