ホーム › Networking.ActiveDirectory › ADsPropSendErrorMessage
ADsPropSendErrorMessage
関数プロパティページのエラーメッセージを通知オブジェクトへ送る。
シグネチャ
// dsprop.dll
#include <windows.h>
BOOL ADsPropSendErrorMessage(
HWND hNotifyObj,
ADSPROPERROR* pError
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| hNotifyObj | HWND | in | 通知オブジェクトのウィンドウハンドル。 |
| pError | ADSPROPERROR* | inout | 送信するエラー情報を保持するADSPROPERROR構造体へのポインタ。 |
戻り値の型: BOOL
各言語での呼び出し定義
// dsprop.dll
#include <windows.h>
BOOL ADsPropSendErrorMessage(
HWND hNotifyObj,
ADSPROPERROR* pError
);[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("dsprop.dll", ExactSpelling = true)]
static extern bool ADsPropSendErrorMessage(
IntPtr hNotifyObj, // HWND
IntPtr pError // ADSPROPERROR* in/out
);<DllImport("dsprop.dll", ExactSpelling:=True)>
Public Shared Function ADsPropSendErrorMessage(
hNotifyObj As IntPtr, ' HWND
pError As IntPtr ' ADSPROPERROR* in/out
) As <MarshalAs(UnmanagedType.Bool)> Boolean
End Function' hNotifyObj : HWND
' pError : ADSPROPERROR* in/out
Declare PtrSafe Function ADsPropSendErrorMessage Lib "dsprop" ( _
ByVal hNotifyObj As LongPtr, _
ByVal pError As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
ADsPropSendErrorMessage = ctypes.windll.dsprop.ADsPropSendErrorMessage
ADsPropSendErrorMessage.restype = wintypes.BOOL
ADsPropSendErrorMessage.argtypes = [
wintypes.HANDLE, # hNotifyObj : HWND
ctypes.c_void_p, # pError : ADSPROPERROR* in/out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('dsprop.dll')
ADsPropSendErrorMessage = Fiddle::Function.new(
lib['ADsPropSendErrorMessage'],
[
Fiddle::TYPE_VOIDP, # hNotifyObj : HWND
Fiddle::TYPE_VOIDP, # pError : ADSPROPERROR* in/out
],
Fiddle::TYPE_INT)#[link(name = "dsprop")]
extern "system" {
fn ADsPropSendErrorMessage(
hNotifyObj: *mut core::ffi::c_void, // HWND
pError: *mut ADSPROPERROR // ADSPROPERROR* in/out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("dsprop.dll")]
public static extern bool ADsPropSendErrorMessage(IntPtr hNotifyObj, IntPtr pError);
"@
$api = Add-Type -MemberDefinition $sig -Name 'dsprop_ADsPropSendErrorMessage' -Namespace Win32 -PassThru
# $api::ADsPropSendErrorMessage(hNotifyObj, pError)#uselib "dsprop.dll"
#func global ADsPropSendErrorMessage "ADsPropSendErrorMessage" sptr, sptr
; ADsPropSendErrorMessage hNotifyObj, varptr(pError) ; 戻り値は stat
; hNotifyObj : HWND -> "sptr"
; pError : ADSPROPERROR* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "dsprop.dll" #cfunc global ADsPropSendErrorMessage "ADsPropSendErrorMessage" sptr, var ; res = ADsPropSendErrorMessage(hNotifyObj, pError) ; hNotifyObj : HWND -> "sptr" ; pError : ADSPROPERROR* in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "dsprop.dll" #cfunc global ADsPropSendErrorMessage "ADsPropSendErrorMessage" sptr, sptr ; res = ADsPropSendErrorMessage(hNotifyObj, varptr(pError)) ; hNotifyObj : HWND -> "sptr" ; pError : ADSPROPERROR* in/out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; BOOL ADsPropSendErrorMessage(HWND hNotifyObj, ADSPROPERROR* pError) #uselib "dsprop.dll" #cfunc global ADsPropSendErrorMessage "ADsPropSendErrorMessage" intptr, var ; res = ADsPropSendErrorMessage(hNotifyObj, pError) ; hNotifyObj : HWND -> "intptr" ; pError : ADSPROPERROR* in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; BOOL ADsPropSendErrorMessage(HWND hNotifyObj, ADSPROPERROR* pError) #uselib "dsprop.dll" #cfunc global ADsPropSendErrorMessage "ADsPropSendErrorMessage" intptr, intptr ; res = ADsPropSendErrorMessage(hNotifyObj, varptr(pError)) ; hNotifyObj : HWND -> "intptr" ; pError : ADSPROPERROR* in/out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
dsprop = windows.NewLazySystemDLL("dsprop.dll")
procADsPropSendErrorMessage = dsprop.NewProc("ADsPropSendErrorMessage")
)
// hNotifyObj (HWND), pError (ADSPROPERROR* in/out)
r1, _, err := procADsPropSendErrorMessage.Call(
uintptr(hNotifyObj),
uintptr(pError),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // BOOLfunction ADsPropSendErrorMessage(
hNotifyObj: THandle; // HWND
pError: Pointer // ADSPROPERROR* in/out
): BOOL; stdcall;
external 'dsprop.dll' name 'ADsPropSendErrorMessage';result := DllCall("dsprop\ADsPropSendErrorMessage"
, "Ptr", hNotifyObj ; HWND
, "Ptr", pError ; ADSPROPERROR* in/out
, "Int") ; return: BOOL●ADsPropSendErrorMessage(hNotifyObj, pError) = DLL("dsprop.dll", "bool ADsPropSendErrorMessage(void*, void*)")
# 呼び出し: ADsPropSendErrorMessage(hNotifyObj, pError)
# hNotifyObj : HWND -> "void*"
# pError : ADSPROPERROR* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "dsprop" fn ADsPropSendErrorMessage(
hNotifyObj: ?*anyopaque, // HWND
pError: [*c]ADSPROPERROR // ADSPROPERROR* in/out
) callconv(std.os.windows.WINAPI) i32;proc ADsPropSendErrorMessage(
hNotifyObj: pointer, # HWND
pError: ptr ADSPROPERROR # ADSPROPERROR* in/out
): int32 {.importc: "ADsPropSendErrorMessage", stdcall, dynlib: "dsprop.dll".}pragma(lib, "dsprop");
extern(Windows)
int ADsPropSendErrorMessage(
void* hNotifyObj, // HWND
ADSPROPERROR* pError // ADSPROPERROR* in/out
);ccall((:ADsPropSendErrorMessage, "dsprop.dll"), stdcall, Int32,
(Ptr{Cvoid}, Ptr{ADSPROPERROR}),
hNotifyObj, pError)
# hNotifyObj : HWND -> Ptr{Cvoid}
# pError : ADSPROPERROR* in/out -> Ptr{ADSPROPERROR}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t ADsPropSendErrorMessage(
void* hNotifyObj,
void* pError);
]]
local dsprop = ffi.load("dsprop")
-- dsprop.ADsPropSendErrorMessage(hNotifyObj, pError)
-- hNotifyObj : HWND
-- pError : ADSPROPERROR* in/out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('dsprop.dll');
const ADsPropSendErrorMessage = lib.func('__stdcall', 'ADsPropSendErrorMessage', 'int32_t', ['void *', 'void *']);
// ADsPropSendErrorMessage(hNotifyObj, pError)
// hNotifyObj : HWND -> 'void *'
// pError : ADSPROPERROR* in/out -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("dsprop.dll", {
ADsPropSendErrorMessage: { parameters: ["pointer", "pointer"], result: "i32" },
});
// lib.symbols.ADsPropSendErrorMessage(hNotifyObj, pError)
// hNotifyObj : HWND -> "pointer"
// pError : ADSPROPERROR* in/out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t ADsPropSendErrorMessage(
void* hNotifyObj,
void* pError);
C, "dsprop.dll");
// $ffi->ADsPropSendErrorMessage(hNotifyObj, pError);
// hNotifyObj : HWND
// pError : ADSPROPERROR* in/out
// 構造体/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 ADsPropSendErrorMessage(
Pointer hNotifyObj, // HWND
Pointer pError // ADSPROPERROR* in/out
);
}@[Link("dsprop")]
lib Libdsprop
fun ADsPropSendErrorMessage = ADsPropSendErrorMessage(
hNotifyObj : Void*, # HWND
pError : ADSPROPERROR* # ADSPROPERROR* in/out
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef ADsPropSendErrorMessageNative = Int32 Function(Pointer<Void>, Pointer<Void>);
typedef ADsPropSendErrorMessageDart = int Function(Pointer<Void>, Pointer<Void>);
final ADsPropSendErrorMessage = DynamicLibrary.open('dsprop.dll')
.lookupFunction<ADsPropSendErrorMessageNative, ADsPropSendErrorMessageDart>('ADsPropSendErrorMessage');
// hNotifyObj : HWND -> Pointer<Void>
// pError : ADSPROPERROR* in/out -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function ADsPropSendErrorMessage(
hNotifyObj: THandle; // HWND
pError: Pointer // ADSPROPERROR* in/out
): BOOL; stdcall;
external 'dsprop.dll' name 'ADsPropSendErrorMessage';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "ADsPropSendErrorMessage"
c_ADsPropSendErrorMessage :: Ptr () -> Ptr () -> IO CInt
-- hNotifyObj : HWND -> Ptr ()
-- pError : ADSPROPERROR* in/out -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let adspropsenderrormessage =
foreign "ADsPropSendErrorMessage"
((ptr void) @-> (ptr void) @-> returning int32_t)
(* hNotifyObj : HWND -> (ptr void) *)
(* pError : ADSPROPERROR* in/out -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library dsprop (t "dsprop.dll"))
(cffi:use-foreign-library dsprop)
(cffi:defcfun ("ADsPropSendErrorMessage" ads-prop-send-error-message :convention :stdcall) :int32
(h-notify-obj :pointer) ; HWND
(p-error :pointer)) ; ADSPROPERROR* in/out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $ADsPropSendErrorMessage = Win32::API::More->new('dsprop',
'BOOL ADsPropSendErrorMessage(HANDLE hNotifyObj, LPVOID pError)');
# my $ret = $ADsPropSendErrorMessage->Call($hNotifyObj, $pError);
# hNotifyObj : HWND -> HANDLE
# pError : ADSPROPERROR* in/out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。関連項目
使用する型