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キャッシュ変更時にポストされる通知メッセージID。
gidLONGLONGin監視対象のキャッシュグループID(GROUPID)を示す64ビット値。0で全グループ。
dwOpsFilterDWORDin通知対象とするキャッシュ操作種別を絞り込むフィルタフラグ。
dwReservedDWORDin予約パラメータ。0を指定する。

戻り値の型: 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 <MarshalAs(UnmanagedType.Bool)> 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)。
const std = @import("std");

extern "wininet" fn RegisterUrlCacheNotification(
    hWnd: ?*anyopaque, // HWND optional
    uMsg: u32, // DWORD
    gid: i64, // LONGLONG
    dwOpsFilter: u32, // DWORD
    dwReserved: u32 // DWORD
) callconv(std.os.windows.WINAPI) i32;
proc RegisterUrlCacheNotification(
    hWnd: pointer,  # HWND optional
    uMsg: uint32,  # DWORD
    gid: int64,  # LONGLONG
    dwOpsFilter: uint32,  # DWORD
    dwReserved: uint32  # DWORD
): int32 {.importc: "RegisterUrlCacheNotification", stdcall, dynlib: "WININET.dll".}
pragma(lib, "wininet");
extern(Windows)
int RegisterUrlCacheNotification(
    void* hWnd,   // HWND optional
    uint uMsg,   // DWORD
    long gid,   // LONGLONG
    uint dwOpsFilter,   // DWORD
    uint dwReserved   // DWORD
);
ccall((:RegisterUrlCacheNotification, "WININET.dll"), stdcall, Int32,
      (Ptr{Cvoid}, UInt32, Int64, UInt32, UInt32),
      hWnd, uMsg, gid, dwOpsFilter, dwReserved)
# hWnd : HWND optional -> Ptr{Cvoid}
# uMsg : DWORD -> UInt32
# gid : LONGLONG -> Int64
# dwOpsFilter : DWORD -> UInt32
# dwReserved : DWORD -> UInt32
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
int32_t RegisterUrlCacheNotification(
    void* hWnd,
    uint32_t uMsg,
    int64_t gid,
    uint32_t dwOpsFilter,
    uint32_t dwReserved);
]]
local wininet = ffi.load("wininet")
-- wininet.RegisterUrlCacheNotification(hWnd, uMsg, gid, dwOpsFilter, dwReserved)
-- hWnd : HWND optional
-- uMsg : DWORD
-- gid : LONGLONG
-- dwOpsFilter : DWORD
-- dwReserved : DWORD
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('WININET.dll');
const RegisterUrlCacheNotification = lib.func('__stdcall', 'RegisterUrlCacheNotification', 'int32_t', ['void *', 'uint32_t', 'int64_t', 'uint32_t', 'uint32_t']);
// RegisterUrlCacheNotification(hWnd, uMsg, gid, dwOpsFilter, dwReserved)
// hWnd : HWND optional -> 'void *'
// uMsg : DWORD -> 'uint32_t'
// gid : LONGLONG -> 'int64_t'
// dwOpsFilter : DWORD -> 'uint32_t'
// dwReserved : DWORD -> 'uint32_t'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("WININET.dll", {
  RegisterUrlCacheNotification: { parameters: ["pointer", "u32", "i64", "u32", "u32"], result: "i32" },
});
// lib.symbols.RegisterUrlCacheNotification(hWnd, uMsg, gid, dwOpsFilter, dwReserved)
// hWnd : HWND optional -> "pointer"
// uMsg : DWORD -> "u32"
// gid : LONGLONG -> "i64"
// dwOpsFilter : DWORD -> "u32"
// dwReserved : DWORD -> "u32"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
int32_t RegisterUrlCacheNotification(
    void* hWnd,
    uint32_t uMsg,
    int64_t gid,
    uint32_t dwOpsFilter,
    uint32_t dwReserved);
C, "WININET.dll");
// $ffi->RegisterUrlCacheNotification(hWnd, uMsg, gid, dwOpsFilter, dwReserved);
// hWnd : HWND optional
// uMsg : DWORD
// gid : LONGLONG
// dwOpsFilter : DWORD
// dwReserved : DWORD
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
// WINAPI(stdcall): x64 では呼出規約が統一されるため問題なし。x86 では __stdcall 対応のラッパが必要な場合あり。
import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;

public interface Wininet extends StdCallLibrary {
    Wininet INSTANCE = Native.load("wininet", Wininet.class);
    boolean RegisterUrlCacheNotification(
        Pointer hWnd,   // HWND optional
        int uMsg,   // DWORD
        long gid,   // LONGLONG
        int dwOpsFilter,   // DWORD
        int dwReserved   // DWORD
    );
}
@[Link("wininet")]
lib LibWININET
  fun RegisterUrlCacheNotification = RegisterUrlCacheNotification(
    hWnd : Void*,   # HWND optional
    uMsg : UInt32,   # DWORD
    gid : Int64,   # LONGLONG
    dwOpsFilter : UInt32,   # DWORD
    dwReserved : UInt32   # DWORD
  ) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef RegisterUrlCacheNotificationNative = Int32 Function(Pointer<Void>, Uint32, Int64, Uint32, Uint32);
typedef RegisterUrlCacheNotificationDart = int Function(Pointer<Void>, int, int, int, int);
final RegisterUrlCacheNotification = DynamicLibrary.open('WININET.dll')
    .lookupFunction<RegisterUrlCacheNotificationNative, RegisterUrlCacheNotificationDart>('RegisterUrlCacheNotification');
// hWnd : HWND optional -> Pointer<Void>
// uMsg : DWORD -> Uint32
// gid : LONGLONG -> Int64
// dwOpsFilter : DWORD -> Uint32
// dwReserved : DWORD -> Uint32
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
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';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "RegisterUrlCacheNotification"
  c_RegisterUrlCacheNotification :: Ptr () -> Word32 -> Int64 -> Word32 -> Word32 -> IO CInt
-- hWnd : HWND optional -> Ptr ()
-- uMsg : DWORD -> Word32
-- gid : LONGLONG -> Int64
-- dwOpsFilter : DWORD -> Word32
-- dwReserved : DWORD -> Word32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let registerurlcachenotification =
  foreign "RegisterUrlCacheNotification"
    ((ptr void) @-> uint32_t @-> int64_t @-> uint32_t @-> uint32_t @-> returning int32_t)
(* hWnd : HWND optional -> (ptr void) *)
(* uMsg : DWORD -> uint32_t *)
(* gid : LONGLONG -> int64_t *)
(* dwOpsFilter : DWORD -> uint32_t *)
(* dwReserved : DWORD -> uint32_t *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library wininet (t "WININET.dll"))
(cffi:use-foreign-library wininet)

(cffi:defcfun ("RegisterUrlCacheNotification" register-url-cache-notification :convention :stdcall) :int32
  (h-wnd :pointer)   ; HWND optional
  (u-msg :uint32)   ; DWORD
  (gid :int64)   ; LONGLONG
  (dw-ops-filter :uint32)   ; DWORD
  (dw-reserved :uint32))   ; DWORD
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $RegisterUrlCacheNotification = Win32::API::More->new('WININET',
    'BOOL RegisterUrlCacheNotification(HANDLE hWnd, DWORD uMsg, INT64 gid, DWORD dwOpsFilter, DWORD dwReserved)');
# my $ret = $RegisterUrlCacheNotification->Call($hWnd, $uMsg, $gid, $dwOpsFilter, $dwReserved);
# hWnd : HWND optional -> HANDLE
# uMsg : DWORD -> DWORD
# gid : LONGLONG -> INT64
# dwOpsFilter : DWORD -> DWORD
# dwReserved : DWORD -> DWORD
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。