Win32 API 日本語リファレンス
ホームSystem.DataExchange › UnpackDDElParam

UnpackDDElParam

関数
DDEメッセージのlParamを2つの値に展開する。
DLLUSER32.dll呼出規約winapi対応OSWindows 2000 以降

シグネチャ

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

BOOL UnpackDDElParam(
    DWORD msg,
    LPARAM lParam,
    UINT_PTR* puiLo,
    UINT_PTR* puiHi
);

パラメーター

名前方向
msgDWORDin
lParamLPARAMin
puiLoUINT_PTR*out
puiHiUINT_PTR*out

戻り値の型: BOOL

各言語での呼び出し定義

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

BOOL UnpackDDElParam(
    DWORD msg,
    LPARAM lParam,
    UINT_PTR* puiLo,
    UINT_PTR* puiHi
);
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("USER32.dll", ExactSpelling = true)]
static extern bool UnpackDDElParam(
    uint msg,   // DWORD
    IntPtr lParam,   // LPARAM
    out UIntPtr puiLo,   // UINT_PTR* out
    out UIntPtr puiHi   // UINT_PTR* out
);
<DllImport("USER32.dll", ExactSpelling:=True)>
Public Shared Function UnpackDDElParam(
    msg As UInteger,   ' DWORD
    lParam As IntPtr,   ' LPARAM
    <Out> ByRef puiLo As UIntPtr,   ' UINT_PTR* out
    <Out> ByRef puiHi As UIntPtr   ' UINT_PTR* out
) As Boolean
End Function
' msg : DWORD
' lParam : LPARAM
' puiLo : UINT_PTR* out
' puiHi : UINT_PTR* out
Declare PtrSafe Function UnpackDDElParam Lib "user32" ( _
    ByVal msg As Long, _
    ByVal lParam As LongPtr, _
    ByRef puiLo As LongPtr, _
    ByRef puiHi As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

UnpackDDElParam = ctypes.windll.user32.UnpackDDElParam
UnpackDDElParam.restype = wintypes.BOOL
UnpackDDElParam.argtypes = [
    wintypes.DWORD,  # msg : DWORD
    ctypes.c_ssize_t,  # lParam : LPARAM
    ctypes.POINTER(ctypes.c_size_t),  # puiLo : UINT_PTR* out
    ctypes.POINTER(ctypes.c_size_t),  # puiHi : UINT_PTR* out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('USER32.dll')
UnpackDDElParam = Fiddle::Function.new(
  lib['UnpackDDElParam'],
  [
    -Fiddle::TYPE_INT,  # msg : DWORD
    Fiddle::TYPE_INTPTR_T,  # lParam : LPARAM
    Fiddle::TYPE_VOIDP,  # puiLo : UINT_PTR* out
    Fiddle::TYPE_VOIDP,  # puiHi : UINT_PTR* out
  ],
  Fiddle::TYPE_INT)
#[link(name = "user32")]
extern "system" {
    fn UnpackDDElParam(
        msg: u32,  // DWORD
        lParam: isize,  // LPARAM
        puiLo: *mut usize,  // UINT_PTR* out
        puiHi: *mut usize  // UINT_PTR* out
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("USER32.dll")]
public static extern bool UnpackDDElParam(uint msg, IntPtr lParam, out UIntPtr puiLo, out UIntPtr puiHi);
"@
$api = Add-Type -MemberDefinition $sig -Name 'USER32_UnpackDDElParam' -Namespace Win32 -PassThru
# $api::UnpackDDElParam(msg, lParam, puiLo, puiHi)
#uselib "USER32.dll"
#func global UnpackDDElParam "UnpackDDElParam" sptr, sptr, sptr, sptr
; UnpackDDElParam msg, lParam, varptr(puiLo), varptr(puiHi)   ; 戻り値は stat
; msg : DWORD -> "sptr"
; lParam : LPARAM -> "sptr"
; puiLo : UINT_PTR* out -> "sptr"
; puiHi : UINT_PTR* out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "USER32.dll"
#cfunc global UnpackDDElParam "UnpackDDElParam" int, sptr, var, var
; res = UnpackDDElParam(msg, lParam, puiLo, puiHi)
; msg : DWORD -> "int"
; lParam : LPARAM -> "sptr"
; puiLo : UINT_PTR* out -> "var"
; puiHi : UINT_PTR* out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; BOOL UnpackDDElParam(DWORD msg, LPARAM lParam, UINT_PTR* puiLo, UINT_PTR* puiHi)
#uselib "USER32.dll"
#cfunc global UnpackDDElParam "UnpackDDElParam" int, intptr, var, var
; res = UnpackDDElParam(msg, lParam, puiLo, puiHi)
; msg : DWORD -> "int"
; lParam : LPARAM -> "intptr"
; puiLo : UINT_PTR* out -> "var"
; puiHi : UINT_PTR* out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	user32 = windows.NewLazySystemDLL("USER32.dll")
	procUnpackDDElParam = user32.NewProc("UnpackDDElParam")
)

// msg (DWORD), lParam (LPARAM), puiLo (UINT_PTR* out), puiHi (UINT_PTR* out)
r1, _, err := procUnpackDDElParam.Call(
	uintptr(msg),
	uintptr(lParam),
	uintptr(puiLo),
	uintptr(puiHi),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // BOOL
function UnpackDDElParam(
  msg: DWORD;   // DWORD
  lParam: NativeInt;   // LPARAM
  puiLo: Pointer;   // UINT_PTR* out
  puiHi: Pointer   // UINT_PTR* out
): BOOL; stdcall;
  external 'USER32.dll' name 'UnpackDDElParam';
result := DllCall("USER32\UnpackDDElParam"
    , "UInt", msg   ; DWORD
    , "Ptr", lParam   ; LPARAM
    , "Ptr", puiLo   ; UINT_PTR* out
    , "Ptr", puiHi   ; UINT_PTR* out
    , "Int")   ; return: BOOL
●UnpackDDElParam(msg, lParam, puiLo, puiHi) = DLL("USER32.dll", "bool UnpackDDElParam(dword, int, void*, void*)")
# 呼び出し: UnpackDDElParam(msg, lParam, puiLo, puiHi)
# msg : DWORD -> "dword"
# lParam : LPARAM -> "int"
# puiLo : UINT_PTR* out -> "void*"
# puiHi : UINT_PTR* out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。