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

PackDDElParam

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

シグネチャ

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

LPARAM PackDDElParam(
    DWORD msg,
    UINT_PTR uiLo,
    UINT_PTR uiHi
);

パラメーター

名前方向
msgDWORDin
uiLoUINT_PTRin
uiHiUINT_PTRin

戻り値の型: LPARAM

各言語での呼び出し定義

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

LPARAM PackDDElParam(
    DWORD msg,
    UINT_PTR uiLo,
    UINT_PTR uiHi
);
[DllImport("USER32.dll", ExactSpelling = true)]
static extern IntPtr PackDDElParam(
    uint msg,   // DWORD
    UIntPtr uiLo,   // UINT_PTR
    UIntPtr uiHi   // UINT_PTR
);
<DllImport("USER32.dll", ExactSpelling:=True)>
Public Shared Function PackDDElParam(
    msg As UInteger,   ' DWORD
    uiLo As UIntPtr,   ' UINT_PTR
    uiHi As UIntPtr   ' UINT_PTR
) As IntPtr
End Function
' msg : DWORD
' uiLo : UINT_PTR
' uiHi : UINT_PTR
Declare PtrSafe Function PackDDElParam Lib "user32" ( _
    ByVal msg As Long, _
    ByVal uiLo As LongPtr, _
    ByVal uiHi As LongPtr) As LongPtr
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

PackDDElParam = ctypes.windll.user32.PackDDElParam
PackDDElParam.restype = ctypes.c_ssize_t
PackDDElParam.argtypes = [
    wintypes.DWORD,  # msg : DWORD
    ctypes.c_size_t,  # uiLo : UINT_PTR
    ctypes.c_size_t,  # uiHi : UINT_PTR
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('USER32.dll')
PackDDElParam = Fiddle::Function.new(
  lib['PackDDElParam'],
  [
    -Fiddle::TYPE_INT,  # msg : DWORD
    Fiddle::TYPE_UINTPTR_T,  # uiLo : UINT_PTR
    Fiddle::TYPE_UINTPTR_T,  # uiHi : UINT_PTR
  ],
  Fiddle::TYPE_INTPTR_T)
#[link(name = "user32")]
extern "system" {
    fn PackDDElParam(
        msg: u32,  // DWORD
        uiLo: usize,  // UINT_PTR
        uiHi: usize  // UINT_PTR
    ) -> isize;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("USER32.dll")]
public static extern IntPtr PackDDElParam(uint msg, UIntPtr uiLo, UIntPtr uiHi);
"@
$api = Add-Type -MemberDefinition $sig -Name 'USER32_PackDDElParam' -Namespace Win32 -PassThru
# $api::PackDDElParam(msg, uiLo, uiHi)
#uselib "USER32.dll"
#func global PackDDElParam "PackDDElParam" sptr, sptr, sptr
; PackDDElParam msg, uiLo, uiHi   ; 戻り値は stat
; msg : DWORD -> "sptr"
; uiLo : UINT_PTR -> "sptr"
; uiHi : UINT_PTR -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "USER32.dll"
#cfunc global PackDDElParam "PackDDElParam" int, sptr, sptr
; res = PackDDElParam(msg, uiLo, uiHi)
; msg : DWORD -> "int"
; uiLo : UINT_PTR -> "sptr"
; uiHi : UINT_PTR -> "sptr"
; LPARAM PackDDElParam(DWORD msg, UINT_PTR uiLo, UINT_PTR uiHi)
#uselib "USER32.dll"
#cfunc global PackDDElParam "PackDDElParam" int, intptr, intptr
; res = PackDDElParam(msg, uiLo, uiHi)
; msg : DWORD -> "int"
; uiLo : UINT_PTR -> "intptr"
; uiHi : UINT_PTR -> "intptr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	user32 = windows.NewLazySystemDLL("USER32.dll")
	procPackDDElParam = user32.NewProc("PackDDElParam")
)

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