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

GetPriorityClipboardFormat

関数
優先順位リストから最初に利用可能なクリップボード形式を返す。
DLLUSER32.dll呼出規約winapiSetLastErrorあり対応OSWindows 2000 以降

シグネチャ

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

INT GetPriorityClipboardFormat(
    DWORD* paFormatPriorityList,
    INT cFormats
);

パラメーター

名前方向
paFormatPriorityListDWORD*in
cFormatsINTin

戻り値の型: INT

各言語での呼び出し定義

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

INT GetPriorityClipboardFormat(
    DWORD* paFormatPriorityList,
    INT cFormats
);
[DllImport("USER32.dll", SetLastError = true, ExactSpelling = true)]
static extern int GetPriorityClipboardFormat(
    ref uint paFormatPriorityList,   // DWORD*
    int cFormats   // INT
);
<DllImport("USER32.dll", SetLastError:=True, ExactSpelling:=True)>
Public Shared Function GetPriorityClipboardFormat(
    ByRef paFormatPriorityList As UInteger,   ' DWORD*
    cFormats As Integer   ' INT
) As Integer
End Function
' paFormatPriorityList : DWORD*
' cFormats : INT
Declare PtrSafe Function GetPriorityClipboardFormat Lib "user32" ( _
    ByRef paFormatPriorityList As Long, _
    ByVal cFormats As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

GetPriorityClipboardFormat = ctypes.windll.user32.GetPriorityClipboardFormat
GetPriorityClipboardFormat.restype = ctypes.c_int
GetPriorityClipboardFormat.argtypes = [
    ctypes.POINTER(wintypes.DWORD),  # paFormatPriorityList : DWORD*
    ctypes.c_int,  # cFormats : INT
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))
require 'fiddle'
require 'fiddle/import'

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

var (
	user32 = windows.NewLazySystemDLL("USER32.dll")
	procGetPriorityClipboardFormat = user32.NewProc("GetPriorityClipboardFormat")
)

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