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

ADsPropShowErrorDialog

関数
プロパティページのエラーダイアログを表示する。
DLLdsprop.dll呼出規約winapi対応OSWindows Vista 以降

シグネチャ

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

BOOL ADsPropShowErrorDialog(
    HWND hNotifyObj,
    HWND hPage
);

パラメーター

名前方向説明
hNotifyObjHWNDin通知オブジェクトのウィンドウハンドル。
hPageHWNDinエラーを表示する対象プロパティページのウィンドウハンドル。

戻り値の型: BOOL

各言語での呼び出し定義

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

BOOL ADsPropShowErrorDialog(
    HWND hNotifyObj,
    HWND hPage
);
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("dsprop.dll", ExactSpelling = true)]
static extern bool ADsPropShowErrorDialog(
    IntPtr hNotifyObj,   // HWND
    IntPtr hPage   // HWND
);
<DllImport("dsprop.dll", ExactSpelling:=True)>
Public Shared Function ADsPropShowErrorDialog(
    hNotifyObj As IntPtr,   ' HWND
    hPage As IntPtr   ' HWND
) As <MarshalAs(UnmanagedType.Bool)> Boolean
End Function
' hNotifyObj : HWND
' hPage : HWND
Declare PtrSafe Function ADsPropShowErrorDialog Lib "dsprop" ( _
    ByVal hNotifyObj As LongPtr, _
    ByVal hPage As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

ADsPropShowErrorDialog = ctypes.windll.dsprop.ADsPropShowErrorDialog
ADsPropShowErrorDialog.restype = wintypes.BOOL
ADsPropShowErrorDialog.argtypes = [
    wintypes.HANDLE,  # hNotifyObj : HWND
    wintypes.HANDLE,  # hPage : HWND
]
require 'fiddle'
require 'fiddle/import'

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

var (
	dsprop = windows.NewLazySystemDLL("dsprop.dll")
	procADsPropShowErrorDialog = dsprop.NewProc("ADsPropShowErrorDialog")
)

// hNotifyObj (HWND), hPage (HWND)
r1, _, err := procADsPropShowErrorDialog.Call(
	uintptr(hNotifyObj),
	uintptr(hPage),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // BOOL
function ADsPropShowErrorDialog(
  hNotifyObj: THandle;   // HWND
  hPage: THandle   // HWND
): BOOL; stdcall;
  external 'dsprop.dll' name 'ADsPropShowErrorDialog';
result := DllCall("dsprop\ADsPropShowErrorDialog"
    , "Ptr", hNotifyObj   ; HWND
    , "Ptr", hPage   ; HWND
    , "Int")   ; return: BOOL
●ADsPropShowErrorDialog(hNotifyObj, hPage) = DLL("dsprop.dll", "bool ADsPropShowErrorDialog(void*, void*)")
# 呼び出し: ADsPropShowErrorDialog(hNotifyObj, hPage)
# hNotifyObj : HWND -> "void*"
# hPage : HWND -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
const std = @import("std");

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

typedef ADsPropShowErrorDialogNative = Int32 Function(Pointer<Void>, Pointer<Void>);
typedef ADsPropShowErrorDialogDart = int Function(Pointer<Void>, Pointer<Void>);
final ADsPropShowErrorDialog = DynamicLibrary.open('dsprop.dll')
    .lookupFunction<ADsPropShowErrorDialogNative, ADsPropShowErrorDialogDart>('ADsPropShowErrorDialog');
// hNotifyObj : HWND -> Pointer<Void>
// hPage : HWND -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function ADsPropShowErrorDialog(
  hNotifyObj: THandle;   // HWND
  hPage: THandle   // HWND
): BOOL; stdcall;
  external 'dsprop.dll' name 'ADsPropShowErrorDialog';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "ADsPropShowErrorDialog"
  c_ADsPropShowErrorDialog :: Ptr () -> Ptr () -> IO CInt
-- hNotifyObj : HWND -> Ptr ()
-- hPage : HWND -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let adspropshowerrordialog =
  foreign "ADsPropShowErrorDialog"
    ((ptr void) @-> (ptr void) @-> returning int32_t)
(* hNotifyObj : HWND -> (ptr void) *)
(* hPage : HWND -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library dsprop (t "dsprop.dll"))
(cffi:use-foreign-library dsprop)

(cffi:defcfun ("ADsPropShowErrorDialog" ads-prop-show-error-dialog :convention :stdcall) :int32
  (h-notify-obj :pointer)   ; HWND
  (h-page :pointer))   ; HWND
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $ADsPropShowErrorDialog = Win32::API::More->new('dsprop',
    'BOOL ADsPropShowErrorDialog(HANDLE hNotifyObj, HANDLE hPage)');
# my $ret = $ADsPropShowErrorDialog->Call($hNotifyObj, $hPage);
# hNotifyObj : HWND -> HANDLE
# hPage : HWND -> HANDLE
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。