Win32 API 日本語リファレンス
ホームWeb.MsHtml › DoPrivacyDlg

DoPrivacyDlg

関数
サイトのプライバシー情報を表示するダイアログを開く。
DLLSHDOCVW.dll呼出規約winapi

シグネチャ

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

HRESULT DoPrivacyDlg(
    HWND hwndOwner,   // optional
    LPCWSTR pszUrl,
    IEnumPrivacyRecords* pPrivacyEnum,
    BOOL fReportAllSites
);

パラメーター

名前方向説明
hwndOwnerHWNDinoptionalプライバシーダイアログの親となるウィンドウのハンドルを指定する。
pszUrlLPCWSTRinプライバシー情報を表示する対象ページのURLを指すワイド文字列を指定する。
pPrivacyEnumIEnumPrivacyRecords*inP3Pプライバシーレコードを列挙するIEnumPrivacyRecordsへのポインタを指定する。
fReportAllSitesBOOLin全サイト(TRUE)か影響を受けたサイトのみ(FALSE)を表示するかを指定するブール値。

戻り値の型: HRESULT

各言語での呼び出し定義

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

HRESULT DoPrivacyDlg(
    HWND hwndOwner,   // optional
    LPCWSTR pszUrl,
    IEnumPrivacyRecords* pPrivacyEnum,
    BOOL fReportAllSites
);
[DllImport("SHDOCVW.dll", ExactSpelling = true)]
static extern int DoPrivacyDlg(
    IntPtr hwndOwner,   // HWND optional
    [MarshalAs(UnmanagedType.LPWStr)] string pszUrl,   // LPCWSTR
    IntPtr pPrivacyEnum,   // IEnumPrivacyRecords*
    bool fReportAllSites   // BOOL
);
<DllImport("SHDOCVW.dll", ExactSpelling:=True)>
Public Shared Function DoPrivacyDlg(
    hwndOwner As IntPtr,   ' HWND optional
    <MarshalAs(UnmanagedType.LPWStr)> pszUrl As String,   ' LPCWSTR
    pPrivacyEnum As IntPtr,   ' IEnumPrivacyRecords*
    fReportAllSites As Boolean   ' BOOL
) As Integer
End Function
' hwndOwner : HWND optional
' pszUrl : LPCWSTR
' pPrivacyEnum : IEnumPrivacyRecords*
' fReportAllSites : BOOL
Declare PtrSafe Function DoPrivacyDlg Lib "shdocvw" ( _
    ByVal hwndOwner As LongPtr, _
    ByVal pszUrl As LongPtr, _
    ByVal pPrivacyEnum As LongPtr, _
    ByVal fReportAllSites As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

DoPrivacyDlg = ctypes.windll.shdocvw.DoPrivacyDlg
DoPrivacyDlg.restype = ctypes.c_int
DoPrivacyDlg.argtypes = [
    wintypes.HANDLE,  # hwndOwner : HWND optional
    wintypes.LPCWSTR,  # pszUrl : LPCWSTR
    ctypes.c_void_p,  # pPrivacyEnum : IEnumPrivacyRecords*
    wintypes.BOOL,  # fReportAllSites : BOOL
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('SHDOCVW.dll')
DoPrivacyDlg = Fiddle::Function.new(
  lib['DoPrivacyDlg'],
  [
    Fiddle::TYPE_VOIDP,  # hwndOwner : HWND optional
    Fiddle::TYPE_VOIDP,  # pszUrl : LPCWSTR
    Fiddle::TYPE_VOIDP,  # pPrivacyEnum : IEnumPrivacyRecords*
    Fiddle::TYPE_INT,  # fReportAllSites : BOOL
  ],
  Fiddle::TYPE_INT)
#[link(name = "shdocvw")]
extern "system" {
    fn DoPrivacyDlg(
        hwndOwner: *mut core::ffi::c_void,  // HWND optional
        pszUrl: *const u16,  // LPCWSTR
        pPrivacyEnum: *mut core::ffi::c_void,  // IEnumPrivacyRecords*
        fReportAllSites: i32  // BOOL
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("SHDOCVW.dll")]
public static extern int DoPrivacyDlg(IntPtr hwndOwner, [MarshalAs(UnmanagedType.LPWStr)] string pszUrl, IntPtr pPrivacyEnum, bool fReportAllSites);
"@
$api = Add-Type -MemberDefinition $sig -Name 'SHDOCVW_DoPrivacyDlg' -Namespace Win32 -PassThru
# $api::DoPrivacyDlg(hwndOwner, pszUrl, pPrivacyEnum, fReportAllSites)
#uselib "SHDOCVW.dll"
#func global DoPrivacyDlg "DoPrivacyDlg" sptr, sptr, sptr, sptr
; DoPrivacyDlg hwndOwner, pszUrl, pPrivacyEnum, fReportAllSites   ; 戻り値は stat
; hwndOwner : HWND optional -> "sptr"
; pszUrl : LPCWSTR -> "sptr"
; pPrivacyEnum : IEnumPrivacyRecords* -> "sptr"
; fReportAllSites : BOOL -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "SHDOCVW.dll"
#cfunc global DoPrivacyDlg "DoPrivacyDlg" sptr, wstr, sptr, int
; res = DoPrivacyDlg(hwndOwner, pszUrl, pPrivacyEnum, fReportAllSites)
; hwndOwner : HWND optional -> "sptr"
; pszUrl : LPCWSTR -> "wstr"
; pPrivacyEnum : IEnumPrivacyRecords* -> "sptr"
; fReportAllSites : BOOL -> "int"
; HRESULT DoPrivacyDlg(HWND hwndOwner, LPCWSTR pszUrl, IEnumPrivacyRecords* pPrivacyEnum, BOOL fReportAllSites)
#uselib "SHDOCVW.dll"
#cfunc global DoPrivacyDlg "DoPrivacyDlg" intptr, wstr, intptr, int
; res = DoPrivacyDlg(hwndOwner, pszUrl, pPrivacyEnum, fReportAllSites)
; hwndOwner : HWND optional -> "intptr"
; pszUrl : LPCWSTR -> "wstr"
; pPrivacyEnum : IEnumPrivacyRecords* -> "intptr"
; fReportAllSites : BOOL -> "int"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	shdocvw = windows.NewLazySystemDLL("SHDOCVW.dll")
	procDoPrivacyDlg = shdocvw.NewProc("DoPrivacyDlg")
)

// hwndOwner (HWND optional), pszUrl (LPCWSTR), pPrivacyEnum (IEnumPrivacyRecords*), fReportAllSites (BOOL)
r1, _, err := procDoPrivacyDlg.Call(
	uintptr(hwndOwner),
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(pszUrl))),
	uintptr(pPrivacyEnum),
	uintptr(fReportAllSites),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // HRESULT
function DoPrivacyDlg(
  hwndOwner: THandle;   // HWND optional
  pszUrl: PWideChar;   // LPCWSTR
  pPrivacyEnum: Pointer;   // IEnumPrivacyRecords*
  fReportAllSites: BOOL   // BOOL
): Integer; stdcall;
  external 'SHDOCVW.dll' name 'DoPrivacyDlg';
result := DllCall("SHDOCVW\DoPrivacyDlg"
    , "Ptr", hwndOwner   ; HWND optional
    , "WStr", pszUrl   ; LPCWSTR
    , "Ptr", pPrivacyEnum   ; IEnumPrivacyRecords*
    , "Int", fReportAllSites   ; BOOL
    , "Int")   ; return: HRESULT
●DoPrivacyDlg(hwndOwner, pszUrl, pPrivacyEnum, fReportAllSites) = DLL("SHDOCVW.dll", "int DoPrivacyDlg(void*, char*, void*, bool)")
# 呼び出し: DoPrivacyDlg(hwndOwner, pszUrl, pPrivacyEnum, fReportAllSites)
# hwndOwner : HWND optional -> "void*"
# pszUrl : LPCWSTR -> "char*"
# pPrivacyEnum : IEnumPrivacyRecords* -> "void*"
# fReportAllSites : BOOL -> "bool"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
const std = @import("std");

extern "shdocvw" fn DoPrivacyDlg(
    hwndOwner: ?*anyopaque, // HWND optional
    pszUrl: [*c]const u16, // LPCWSTR
    pPrivacyEnum: ?*anyopaque, // IEnumPrivacyRecords*
    fReportAllSites: i32 // BOOL
) callconv(std.os.windows.WINAPI) i32;
proc DoPrivacyDlg(
    hwndOwner: pointer,  # HWND optional
    pszUrl: WideCString,  # LPCWSTR
    pPrivacyEnum: pointer,  # IEnumPrivacyRecords*
    fReportAllSites: int32  # BOOL
): int32 {.importc: "DoPrivacyDlg", stdcall, dynlib: "SHDOCVW.dll".}
pragma(lib, "shdocvw");
extern(Windows)
int DoPrivacyDlg(
    void* hwndOwner,   // HWND optional
    const(wchar)* pszUrl,   // LPCWSTR
    void* pPrivacyEnum,   // IEnumPrivacyRecords*
    int fReportAllSites   // BOOL
);
ccall((:DoPrivacyDlg, "SHDOCVW.dll"), stdcall, Int32,
      (Ptr{Cvoid}, Cwstring, Ptr{Cvoid}, Int32),
      hwndOwner, pszUrl, pPrivacyEnum, fReportAllSites)
# hwndOwner : HWND optional -> Ptr{Cvoid}
# pszUrl : LPCWSTR -> Cwstring
# pPrivacyEnum : IEnumPrivacyRecords* -> Ptr{Cvoid}
# fReportAllSites : BOOL -> Int32
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
int32_t DoPrivacyDlg(
    void* hwndOwner,
    const uint16_t* pszUrl,
    void* pPrivacyEnum,
    int32_t fReportAllSites);
]]
local shdocvw = ffi.load("shdocvw")
-- shdocvw.DoPrivacyDlg(hwndOwner, pszUrl, pPrivacyEnum, fReportAllSites)
-- hwndOwner : HWND optional
-- pszUrl : LPCWSTR
-- pPrivacyEnum : IEnumPrivacyRecords*
-- fReportAllSites : BOOL
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('SHDOCVW.dll');
const DoPrivacyDlg = lib.func('__stdcall', 'DoPrivacyDlg', 'int32_t', ['void *', 'str16', 'void *', 'int32_t']);
// DoPrivacyDlg(hwndOwner, pszUrl, pPrivacyEnum, fReportAllSites)
// hwndOwner : HWND optional -> 'void *'
// pszUrl : LPCWSTR -> 'str16'
// pPrivacyEnum : IEnumPrivacyRecords* -> 'void *'
// fReportAllSites : BOOL -> 'int32_t'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("SHDOCVW.dll", {
  DoPrivacyDlg: { parameters: ["pointer", "buffer", "pointer", "i32"], result: "i32" },
});
// lib.symbols.DoPrivacyDlg(hwndOwner, pszUrl, pPrivacyEnum, fReportAllSites)
// hwndOwner : HWND optional -> "pointer"
// pszUrl : LPCWSTR -> "buffer"
// pPrivacyEnum : IEnumPrivacyRecords* -> "pointer"
// fReportAllSites : BOOL -> "i32"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
int32_t DoPrivacyDlg(
    void* hwndOwner,
    const uint16_t* pszUrl,
    void* pPrivacyEnum,
    int32_t fReportAllSites);
C, "SHDOCVW.dll");
// $ffi->DoPrivacyDlg(hwndOwner, pszUrl, pPrivacyEnum, fReportAllSites);
// hwndOwner : HWND optional
// pszUrl : LPCWSTR
// pPrivacyEnum : IEnumPrivacyRecords*
// fReportAllSites : BOOL
// 構造体/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 Shdocvw extends StdCallLibrary {
    Shdocvw INSTANCE = Native.load("shdocvw", Shdocvw.class);
    int DoPrivacyDlg(
        Pointer hwndOwner,   // HWND optional
        WString pszUrl,   // LPCWSTR
        Pointer pPrivacyEnum,   // IEnumPrivacyRecords*
        boolean fReportAllSites   // BOOL
    );
}
@[Link("shdocvw")]
lib LibSHDOCVW
  fun DoPrivacyDlg = DoPrivacyDlg(
    hwndOwner : Void*,   # HWND optional
    pszUrl : UInt16*,   # LPCWSTR
    pPrivacyEnum : Void*,   # IEnumPrivacyRecords*
    fReportAllSites : Int32   # BOOL
  ) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef DoPrivacyDlgNative = Int32 Function(Pointer<Void>, Pointer<Utf16>, Pointer<Void>, Int32);
typedef DoPrivacyDlgDart = int Function(Pointer<Void>, Pointer<Utf16>, Pointer<Void>, int);
final DoPrivacyDlg = DynamicLibrary.open('SHDOCVW.dll')
    .lookupFunction<DoPrivacyDlgNative, DoPrivacyDlgDart>('DoPrivacyDlg');
// hwndOwner : HWND optional -> Pointer<Void>
// pszUrl : LPCWSTR -> Pointer<Utf16>
// pPrivacyEnum : IEnumPrivacyRecords* -> Pointer<Void>
// fReportAllSites : BOOL -> Int32
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function DoPrivacyDlg(
  hwndOwner: THandle;   // HWND optional
  pszUrl: PWideChar;   // LPCWSTR
  pPrivacyEnum: Pointer;   // IEnumPrivacyRecords*
  fReportAllSites: BOOL   // BOOL
): Integer; stdcall;
  external 'SHDOCVW.dll' name 'DoPrivacyDlg';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "DoPrivacyDlg"
  c_DoPrivacyDlg :: Ptr () -> CWString -> Ptr () -> CInt -> IO Int32
-- hwndOwner : HWND optional -> Ptr ()
-- pszUrl : LPCWSTR -> CWString
-- pPrivacyEnum : IEnumPrivacyRecords* -> Ptr ()
-- fReportAllSites : BOOL -> CInt
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let doprivacydlg =
  foreign "DoPrivacyDlg"
    ((ptr void) @-> (ptr uint16_t) @-> (ptr void) @-> int32_t @-> returning int32_t)
(* hwndOwner : HWND optional -> (ptr void) *)
(* pszUrl : LPCWSTR -> (ptr uint16_t) *)
(* pPrivacyEnum : IEnumPrivacyRecords* -> (ptr void) *)
(* fReportAllSites : BOOL -> int32_t *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library shdocvw (t "SHDOCVW.dll"))
(cffi:use-foreign-library shdocvw)

(cffi:defcfun ("DoPrivacyDlg" do-privacy-dlg :convention :stdcall) :int32
  (hwnd-owner :pointer)   ; HWND optional
  (psz-url (:string :encoding :utf-16le))   ; LPCWSTR
  (p-privacy-enum :pointer)   ; IEnumPrivacyRecords*
  (f-report-all-sites :int32))   ; BOOL
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $DoPrivacyDlg = Win32::API::More->new('SHDOCVW',
    'int DoPrivacyDlg(HANDLE hwndOwner, LPCWSTR pszUrl, LPVOID pPrivacyEnum, BOOL fReportAllSites)');
# my $ret = $DoPrivacyDlg->Call($hwndOwner, $pszUrl, $pPrivacyEnum, $fReportAllSites);
# hwndOwner : HWND optional -> HANDLE
# pszUrl : LPCWSTR -> LPCWSTR
# pPrivacyEnum : IEnumPrivacyRecords* -> LPVOID
# fReportAllSites : BOOL -> BOOL
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。

関連項目

使用する型