Win32 API 日本語リファレンス
ホームMedia.Multimedia › DrawDibChangePalette

DrawDibChangePalette

関数
DrawDibのパレットエントリを変更する。
DLLMSVFW32.dll呼出規約winapi対応OSWindows 2000 以降

シグネチャ

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

BOOL DrawDibChangePalette(
    INT_PTR hdd,
    INT iStart,
    INT iLen,
    PALETTEENTRY* lppe
);

パラメーター

名前方向
hddINT_PTRin
iStartINTin
iLenINTin
lppePALETTEENTRY*in

戻り値の型: BOOL

各言語での呼び出し定義

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

BOOL DrawDibChangePalette(
    INT_PTR hdd,
    INT iStart,
    INT iLen,
    PALETTEENTRY* lppe
);
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("MSVFW32.dll", ExactSpelling = true)]
static extern bool DrawDibChangePalette(
    IntPtr hdd,   // INT_PTR
    int iStart,   // INT
    int iLen,   // INT
    IntPtr lppe   // PALETTEENTRY*
);
<DllImport("MSVFW32.dll", ExactSpelling:=True)>
Public Shared Function DrawDibChangePalette(
    hdd As IntPtr,   ' INT_PTR
    iStart As Integer,   ' INT
    iLen As Integer,   ' INT
    lppe As IntPtr   ' PALETTEENTRY*
) As Boolean
End Function
' hdd : INT_PTR
' iStart : INT
' iLen : INT
' lppe : PALETTEENTRY*
Declare PtrSafe Function DrawDibChangePalette Lib "msvfw32" ( _
    ByVal hdd As LongPtr, _
    ByVal iStart As Long, _
    ByVal iLen As Long, _
    ByVal lppe As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

DrawDibChangePalette = ctypes.windll.msvfw32.DrawDibChangePalette
DrawDibChangePalette.restype = wintypes.BOOL
DrawDibChangePalette.argtypes = [
    ctypes.c_ssize_t,  # hdd : INT_PTR
    ctypes.c_int,  # iStart : INT
    ctypes.c_int,  # iLen : INT
    ctypes.c_void_p,  # lppe : PALETTEENTRY*
]
require 'fiddle'
require 'fiddle/import'

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

var (
	msvfw32 = windows.NewLazySystemDLL("MSVFW32.dll")
	procDrawDibChangePalette = msvfw32.NewProc("DrawDibChangePalette")
)

// hdd (INT_PTR), iStart (INT), iLen (INT), lppe (PALETTEENTRY*)
r1, _, err := procDrawDibChangePalette.Call(
	uintptr(hdd),
	uintptr(iStart),
	uintptr(iLen),
	uintptr(lppe),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // BOOL
function DrawDibChangePalette(
  hdd: NativeInt;   // INT_PTR
  iStart: Integer;   // INT
  iLen: Integer;   // INT
  lppe: Pointer   // PALETTEENTRY*
): BOOL; stdcall;
  external 'MSVFW32.dll' name 'DrawDibChangePalette';
result := DllCall("MSVFW32\DrawDibChangePalette"
    , "Ptr", hdd   ; INT_PTR
    , "Int", iStart   ; INT
    , "Int", iLen   ; INT
    , "Ptr", lppe   ; PALETTEENTRY*
    , "Int")   ; return: BOOL
●DrawDibChangePalette(hdd, iStart, iLen, lppe) = DLL("MSVFW32.dll", "bool DrawDibChangePalette(int, int, int, void*)")
# 呼び出し: DrawDibChangePalette(hdd, iStart, iLen, lppe)
# hdd : INT_PTR -> "int"
# iStart : INT -> "int"
# iLen : INT -> "int"
# lppe : PALETTEENTRY* -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。