Win32 API 日本語リファレンス
ホームGraphics.Gdi › PaintDesktop

PaintDesktop

関数
指定したデバイスコンテキストにデスクトップ背景を描画する。
DLLUSER32.dll呼出規約winapi対応OSWindows 2000 以降

シグネチャ

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

BOOL PaintDesktop(
    HDC hdc
);

パラメーター

名前方向
hdcHDCin

戻り値の型: BOOL

各言語での呼び出し定義

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

BOOL PaintDesktop(
    HDC hdc
);
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("USER32.dll", ExactSpelling = true)]
static extern bool PaintDesktop(
    IntPtr hdc   // HDC
);
<DllImport("USER32.dll", ExactSpelling:=True)>
Public Shared Function PaintDesktop(
    hdc As IntPtr   ' HDC
) As Boolean
End Function
' hdc : HDC
Declare PtrSafe Function PaintDesktop Lib "user32" ( _
    ByVal hdc As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

PaintDesktop = ctypes.windll.user32.PaintDesktop
PaintDesktop.restype = wintypes.BOOL
PaintDesktop.argtypes = [
    wintypes.HANDLE,  # hdc : HDC
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('USER32.dll')
PaintDesktop = Fiddle::Function.new(
  lib['PaintDesktop'],
  [
    Fiddle::TYPE_VOIDP,  # hdc : HDC
  ],
  Fiddle::TYPE_INT)
#[link(name = "user32")]
extern "system" {
    fn PaintDesktop(
        hdc: *mut core::ffi::c_void  // HDC
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("USER32.dll")]
public static extern bool PaintDesktop(IntPtr hdc);
"@
$api = Add-Type -MemberDefinition $sig -Name 'USER32_PaintDesktop' -Namespace Win32 -PassThru
# $api::PaintDesktop(hdc)
#uselib "USER32.dll"
#func global PaintDesktop "PaintDesktop" sptr
; PaintDesktop hdc   ; 戻り値は stat
; hdc : HDC -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "USER32.dll"
#cfunc global PaintDesktop "PaintDesktop" sptr
; res = PaintDesktop(hdc)
; hdc : HDC -> "sptr"
; BOOL PaintDesktop(HDC hdc)
#uselib "USER32.dll"
#cfunc global PaintDesktop "PaintDesktop" intptr
; res = PaintDesktop(hdc)
; hdc : HDC -> "intptr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	user32 = windows.NewLazySystemDLL("USER32.dll")
	procPaintDesktop = user32.NewProc("PaintDesktop")
)

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