ホーム › Graphics.Gdi › GetWindowOrgEx
GetWindowOrgEx
関数DCのウィンドウの原点を取得する。
シグネチャ
// GDI32.dll
#include <windows.h>
BOOL GetWindowOrgEx(
HDC hdc,
POINT* lppoint
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hdc | HDC | in |
| lppoint | POINT* | out |
戻り値の型: BOOL
各言語での呼び出し定義
// GDI32.dll
#include <windows.h>
BOOL GetWindowOrgEx(
HDC hdc,
POINT* lppoint
);[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("GDI32.dll", ExactSpelling = true)]
static extern bool GetWindowOrgEx(
IntPtr hdc, // HDC
IntPtr lppoint // POINT* out
);<DllImport("GDI32.dll", ExactSpelling:=True)>
Public Shared Function GetWindowOrgEx(
hdc As IntPtr, ' HDC
lppoint As IntPtr ' POINT* out
) As Boolean
End Function' hdc : HDC
' lppoint : POINT* out
Declare PtrSafe Function GetWindowOrgEx Lib "gdi32" ( _
ByVal hdc As LongPtr, _
ByVal lppoint As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
GetWindowOrgEx = ctypes.windll.gdi32.GetWindowOrgEx
GetWindowOrgEx.restype = wintypes.BOOL
GetWindowOrgEx.argtypes = [
wintypes.HANDLE, # hdc : HDC
ctypes.c_void_p, # lppoint : POINT* out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('GDI32.dll')
GetWindowOrgEx = Fiddle::Function.new(
lib['GetWindowOrgEx'],
[
Fiddle::TYPE_VOIDP, # hdc : HDC
Fiddle::TYPE_VOIDP, # lppoint : POINT* out
],
Fiddle::TYPE_INT)#[link(name = "gdi32")]
extern "system" {
fn GetWindowOrgEx(
hdc: *mut core::ffi::c_void, // HDC
lppoint: *mut POINT // POINT* out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("GDI32.dll")]
public static extern bool GetWindowOrgEx(IntPtr hdc, IntPtr lppoint);
"@
$api = Add-Type -MemberDefinition $sig -Name 'GDI32_GetWindowOrgEx' -Namespace Win32 -PassThru
# $api::GetWindowOrgEx(hdc, lppoint)#uselib "GDI32.dll"
#func global GetWindowOrgEx "GetWindowOrgEx" sptr, sptr
; GetWindowOrgEx hdc, varptr(lppoint) ; 戻り値は stat
; hdc : HDC -> "sptr"
; lppoint : POINT* out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "GDI32.dll" #cfunc global GetWindowOrgEx "GetWindowOrgEx" sptr, var ; res = GetWindowOrgEx(hdc, lppoint) ; hdc : HDC -> "sptr" ; lppoint : POINT* out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "GDI32.dll" #cfunc global GetWindowOrgEx "GetWindowOrgEx" sptr, sptr ; res = GetWindowOrgEx(hdc, varptr(lppoint)) ; hdc : HDC -> "sptr" ; lppoint : POINT* out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; BOOL GetWindowOrgEx(HDC hdc, POINT* lppoint) #uselib "GDI32.dll" #cfunc global GetWindowOrgEx "GetWindowOrgEx" intptr, var ; res = GetWindowOrgEx(hdc, lppoint) ; hdc : HDC -> "intptr" ; lppoint : POINT* out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; BOOL GetWindowOrgEx(HDC hdc, POINT* lppoint) #uselib "GDI32.dll" #cfunc global GetWindowOrgEx "GetWindowOrgEx" intptr, intptr ; res = GetWindowOrgEx(hdc, varptr(lppoint)) ; hdc : HDC -> "intptr" ; lppoint : POINT* out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
gdi32 = windows.NewLazySystemDLL("GDI32.dll")
procGetWindowOrgEx = gdi32.NewProc("GetWindowOrgEx")
)
// hdc (HDC), lppoint (POINT* out)
r1, _, err := procGetWindowOrgEx.Call(
uintptr(hdc),
uintptr(lppoint),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // BOOLfunction GetWindowOrgEx(
hdc: THandle; // HDC
lppoint: Pointer // POINT* out
): BOOL; stdcall;
external 'GDI32.dll' name 'GetWindowOrgEx';result := DllCall("GDI32\GetWindowOrgEx"
, "Ptr", hdc ; HDC
, "Ptr", lppoint ; POINT* out
, "Int") ; return: BOOL●GetWindowOrgEx(hdc, lppoint) = DLL("GDI32.dll", "bool GetWindowOrgEx(void*, void*)")
# 呼び出し: GetWindowOrgEx(hdc, lppoint)
# hdc : HDC -> "void*"
# lppoint : POINT* out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。