ホーム › System.DataExchange › UnpackDDElParam
UnpackDDElParam
関数DDEメッセージのlParamを2つの値に展開する。
シグネチャ
// USER32.dll
#include <windows.h>
BOOL UnpackDDElParam(
DWORD msg,
LPARAM lParam,
UINT_PTR* puiLo,
UINT_PTR* puiHi
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| msg | DWORD | in |
| lParam | LPARAM | in |
| puiLo | UINT_PTR* | out |
| puiHi | UINT_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 方式にも切替可。#uselib "USER32.dll" #cfunc global UnpackDDElParam "UnpackDDElParam" int, sptr, sptr, sptr ; res = UnpackDDElParam(msg, lParam, varptr(puiLo), varptr(puiHi)) ; msg : DWORD -> "int" ; lParam : LPARAM -> "sptr" ; puiLo : UINT_PTR* out -> "sptr" ; puiHi : UINT_PTR* out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは 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 方式にも切替可。; BOOL UnpackDDElParam(DWORD msg, LPARAM lParam, UINT_PTR* puiLo, UINT_PTR* puiHi) #uselib "USER32.dll" #cfunc global UnpackDDElParam "UnpackDDElParam" int, intptr, intptr, intptr ; res = UnpackDDElParam(msg, lParam, varptr(puiLo), varptr(puiHi)) ; msg : DWORD -> "int" ; lParam : LPARAM -> "intptr" ; puiLo : UINT_PTR* out -> "intptr" ; puiHi : UINT_PTR* out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは 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 // BOOLfunction 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)。