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

ADsPropCreateNotifyObj

関数
プロパティページ用の通知オブジェクトを作成する。
DLLdsprop.dll呼出規約winapi対応OSWindows Vista 以降

シグネチャ

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

HRESULT ADsPropCreateNotifyObj(
    IDataObject* pAppThdDataObj,
    LPWSTR pwzADsObjName,
    HWND* phNotifyObj
);

パラメーター

名前方向
pAppThdDataObjIDataObject*in
pwzADsObjNameLPWSTRin
phNotifyObjHWND*inout

戻り値の型: HRESULT

各言語での呼び出し定義

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

HRESULT ADsPropCreateNotifyObj(
    IDataObject* pAppThdDataObj,
    LPWSTR pwzADsObjName,
    HWND* phNotifyObj
);
[DllImport("dsprop.dll", ExactSpelling = true)]
static extern int ADsPropCreateNotifyObj(
    IntPtr pAppThdDataObj,   // IDataObject*
    [MarshalAs(UnmanagedType.LPWStr)] string pwzADsObjName,   // LPWSTR
    IntPtr phNotifyObj   // HWND* in/out
);
<DllImport("dsprop.dll", ExactSpelling:=True)>
Public Shared Function ADsPropCreateNotifyObj(
    pAppThdDataObj As IntPtr,   ' IDataObject*
    <MarshalAs(UnmanagedType.LPWStr)> pwzADsObjName As String,   ' LPWSTR
    phNotifyObj As IntPtr   ' HWND* in/out
) As Integer
End Function
' pAppThdDataObj : IDataObject*
' pwzADsObjName : LPWSTR
' phNotifyObj : HWND* in/out
Declare PtrSafe Function ADsPropCreateNotifyObj Lib "dsprop" ( _
    ByVal pAppThdDataObj As LongPtr, _
    ByVal pwzADsObjName As LongPtr, _
    ByVal phNotifyObj As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

ADsPropCreateNotifyObj = ctypes.windll.dsprop.ADsPropCreateNotifyObj
ADsPropCreateNotifyObj.restype = ctypes.c_int
ADsPropCreateNotifyObj.argtypes = [
    ctypes.c_void_p,  # pAppThdDataObj : IDataObject*
    wintypes.LPCWSTR,  # pwzADsObjName : LPWSTR
    ctypes.c_void_p,  # phNotifyObj : HWND* in/out
]
require 'fiddle'
require 'fiddle/import'

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

var (
	dsprop = windows.NewLazySystemDLL("dsprop.dll")
	procADsPropCreateNotifyObj = dsprop.NewProc("ADsPropCreateNotifyObj")
)

// pAppThdDataObj (IDataObject*), pwzADsObjName (LPWSTR), phNotifyObj (HWND* in/out)
r1, _, err := procADsPropCreateNotifyObj.Call(
	uintptr(pAppThdDataObj),
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(pwzADsObjName))),
	uintptr(phNotifyObj),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // HRESULT
function ADsPropCreateNotifyObj(
  pAppThdDataObj: Pointer;   // IDataObject*
  pwzADsObjName: PWideChar;   // LPWSTR
  phNotifyObj: Pointer   // HWND* in/out
): Integer; stdcall;
  external 'dsprop.dll' name 'ADsPropCreateNotifyObj';
result := DllCall("dsprop\ADsPropCreateNotifyObj"
    , "Ptr", pAppThdDataObj   ; IDataObject*
    , "WStr", pwzADsObjName   ; LPWSTR
    , "Ptr", phNotifyObj   ; HWND* in/out
    , "Int")   ; return: HRESULT
●ADsPropCreateNotifyObj(pAppThdDataObj, pwzADsObjName, phNotifyObj) = DLL("dsprop.dll", "int ADsPropCreateNotifyObj(void*, char*, void*)")
# 呼び出し: ADsPropCreateNotifyObj(pAppThdDataObj, pwzADsObjName, phNotifyObj)
# pAppThdDataObj : IDataObject* -> "void*"
# pwzADsObjName : LPWSTR -> "char*"
# phNotifyObj : HWND* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。