ホーム › UI.WindowsAndMessaging › ScrollWindowEx
ScrollWindowEx
関数オプション指定付きでウィンドウ内容をスクロールする。
シグネチャ
// USER32.dll
#include <windows.h>
INT ScrollWindowEx(
HWND hWnd,
INT dx,
INT dy,
const RECT* prcScroll, // optional
const RECT* prcClip, // optional
HRGN hrgnUpdate, // optional
RECT* prcUpdate, // optional
SCROLL_WINDOW_FLAGS flags
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hWnd | HWND | in |
| dx | INT | in |
| dy | INT | in |
| prcScroll | RECT* | inoptional |
| prcClip | RECT* | inoptional |
| hrgnUpdate | HRGN | inoptional |
| prcUpdate | RECT* | outoptional |
| flags | SCROLL_WINDOW_FLAGS | in |
戻り値の型: INT
各言語での呼び出し定義
// USER32.dll
#include <windows.h>
INT ScrollWindowEx(
HWND hWnd,
INT dx,
INT dy,
const RECT* prcScroll, // optional
const RECT* prcClip, // optional
HRGN hrgnUpdate, // optional
RECT* prcUpdate, // optional
SCROLL_WINDOW_FLAGS flags
);[DllImport("USER32.dll", SetLastError = true, ExactSpelling = true)]
static extern int ScrollWindowEx(
IntPtr hWnd, // HWND
int dx, // INT
int dy, // INT
IntPtr prcScroll, // RECT* optional
IntPtr prcClip, // RECT* optional
IntPtr hrgnUpdate, // HRGN optional
IntPtr prcUpdate, // RECT* optional, out
uint flags // SCROLL_WINDOW_FLAGS
);<DllImport("USER32.dll", SetLastError:=True, ExactSpelling:=True)>
Public Shared Function ScrollWindowEx(
hWnd As IntPtr, ' HWND
dx As Integer, ' INT
dy As Integer, ' INT
prcScroll As IntPtr, ' RECT* optional
prcClip As IntPtr, ' RECT* optional
hrgnUpdate As IntPtr, ' HRGN optional
prcUpdate As IntPtr, ' RECT* optional, out
flags As UInteger ' SCROLL_WINDOW_FLAGS
) As Integer
End Function' hWnd : HWND
' dx : INT
' dy : INT
' prcScroll : RECT* optional
' prcClip : RECT* optional
' hrgnUpdate : HRGN optional
' prcUpdate : RECT* optional, out
' flags : SCROLL_WINDOW_FLAGS
Declare PtrSafe Function ScrollWindowEx Lib "user32" ( _
ByVal hWnd As LongPtr, _
ByVal dx As Long, _
ByVal dy As Long, _
ByVal prcScroll As LongPtr, _
ByVal prcClip As LongPtr, _
ByVal hrgnUpdate As LongPtr, _
ByVal prcUpdate As LongPtr, _
ByVal flags As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
ScrollWindowEx = ctypes.windll.user32.ScrollWindowEx
ScrollWindowEx.restype = ctypes.c_int
ScrollWindowEx.argtypes = [
wintypes.HANDLE, # hWnd : HWND
ctypes.c_int, # dx : INT
ctypes.c_int, # dy : INT
ctypes.c_void_p, # prcScroll : RECT* optional
ctypes.c_void_p, # prcClip : RECT* optional
wintypes.HANDLE, # hrgnUpdate : HRGN optional
ctypes.c_void_p, # prcUpdate : RECT* optional, out
wintypes.DWORD, # flags : SCROLL_WINDOW_FLAGS
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('USER32.dll')
ScrollWindowEx = Fiddle::Function.new(
lib['ScrollWindowEx'],
[
Fiddle::TYPE_VOIDP, # hWnd : HWND
Fiddle::TYPE_INT, # dx : INT
Fiddle::TYPE_INT, # dy : INT
Fiddle::TYPE_VOIDP, # prcScroll : RECT* optional
Fiddle::TYPE_VOIDP, # prcClip : RECT* optional
Fiddle::TYPE_VOIDP, # hrgnUpdate : HRGN optional
Fiddle::TYPE_VOIDP, # prcUpdate : RECT* optional, out
-Fiddle::TYPE_INT, # flags : SCROLL_WINDOW_FLAGS
],
Fiddle::TYPE_INT)#[link(name = "user32")]
extern "system" {
fn ScrollWindowEx(
hWnd: *mut core::ffi::c_void, // HWND
dx: i32, // INT
dy: i32, // INT
prcScroll: *const RECT, // RECT* optional
prcClip: *const RECT, // RECT* optional
hrgnUpdate: *mut core::ffi::c_void, // HRGN optional
prcUpdate: *mut RECT, // RECT* optional, out
flags: u32 // SCROLL_WINDOW_FLAGS
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("USER32.dll", SetLastError = true)]
public static extern int ScrollWindowEx(IntPtr hWnd, int dx, int dy, IntPtr prcScroll, IntPtr prcClip, IntPtr hrgnUpdate, IntPtr prcUpdate, uint flags);
"@
$api = Add-Type -MemberDefinition $sig -Name 'USER32_ScrollWindowEx' -Namespace Win32 -PassThru
# $api::ScrollWindowEx(hWnd, dx, dy, prcScroll, prcClip, hrgnUpdate, prcUpdate, flags)#uselib "USER32.dll"
#func global ScrollWindowEx "ScrollWindowEx" sptr, sptr, sptr, sptr, sptr, sptr, sptr, sptr
; ScrollWindowEx hWnd, dx, dy, varptr(prcScroll), varptr(prcClip), hrgnUpdate, varptr(prcUpdate), flags ; 戻り値は stat
; hWnd : HWND -> "sptr"
; dx : INT -> "sptr"
; dy : INT -> "sptr"
; prcScroll : RECT* optional -> "sptr"
; prcClip : RECT* optional -> "sptr"
; hrgnUpdate : HRGN optional -> "sptr"
; prcUpdate : RECT* optional, out -> "sptr"
; flags : SCROLL_WINDOW_FLAGS -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "USER32.dll" #cfunc global ScrollWindowEx "ScrollWindowEx" sptr, int, int, var, var, sptr, var, int ; res = ScrollWindowEx(hWnd, dx, dy, prcScroll, prcClip, hrgnUpdate, prcUpdate, flags) ; hWnd : HWND -> "sptr" ; dx : INT -> "int" ; dy : INT -> "int" ; prcScroll : RECT* optional -> "var" ; prcClip : RECT* optional -> "var" ; hrgnUpdate : HRGN optional -> "sptr" ; prcUpdate : RECT* optional, out -> "var" ; flags : SCROLL_WINDOW_FLAGS -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "USER32.dll" #cfunc global ScrollWindowEx "ScrollWindowEx" sptr, int, int, sptr, sptr, sptr, sptr, int ; res = ScrollWindowEx(hWnd, dx, dy, varptr(prcScroll), varptr(prcClip), hrgnUpdate, varptr(prcUpdate), flags) ; hWnd : HWND -> "sptr" ; dx : INT -> "int" ; dy : INT -> "int" ; prcScroll : RECT* optional -> "sptr" ; prcClip : RECT* optional -> "sptr" ; hrgnUpdate : HRGN optional -> "sptr" ; prcUpdate : RECT* optional, out -> "sptr" ; flags : SCROLL_WINDOW_FLAGS -> "int" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; INT ScrollWindowEx(HWND hWnd, INT dx, INT dy, RECT* prcScroll, RECT* prcClip, HRGN hrgnUpdate, RECT* prcUpdate, SCROLL_WINDOW_FLAGS flags) #uselib "USER32.dll" #cfunc global ScrollWindowEx "ScrollWindowEx" intptr, int, int, var, var, intptr, var, int ; res = ScrollWindowEx(hWnd, dx, dy, prcScroll, prcClip, hrgnUpdate, prcUpdate, flags) ; hWnd : HWND -> "intptr" ; dx : INT -> "int" ; dy : INT -> "int" ; prcScroll : RECT* optional -> "var" ; prcClip : RECT* optional -> "var" ; hrgnUpdate : HRGN optional -> "intptr" ; prcUpdate : RECT* optional, out -> "var" ; flags : SCROLL_WINDOW_FLAGS -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; INT ScrollWindowEx(HWND hWnd, INT dx, INT dy, RECT* prcScroll, RECT* prcClip, HRGN hrgnUpdate, RECT* prcUpdate, SCROLL_WINDOW_FLAGS flags) #uselib "USER32.dll" #cfunc global ScrollWindowEx "ScrollWindowEx" intptr, int, int, intptr, intptr, intptr, intptr, int ; res = ScrollWindowEx(hWnd, dx, dy, varptr(prcScroll), varptr(prcClip), hrgnUpdate, varptr(prcUpdate), flags) ; hWnd : HWND -> "intptr" ; dx : INT -> "int" ; dy : INT -> "int" ; prcScroll : RECT* optional -> "intptr" ; prcClip : RECT* optional -> "intptr" ; hrgnUpdate : HRGN optional -> "intptr" ; prcUpdate : RECT* optional, out -> "intptr" ; flags : SCROLL_WINDOW_FLAGS -> "int" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
user32 = windows.NewLazySystemDLL("USER32.dll")
procScrollWindowEx = user32.NewProc("ScrollWindowEx")
)
// hWnd (HWND), dx (INT), dy (INT), prcScroll (RECT* optional), prcClip (RECT* optional), hrgnUpdate (HRGN optional), prcUpdate (RECT* optional, out), flags (SCROLL_WINDOW_FLAGS)
r1, _, err := procScrollWindowEx.Call(
uintptr(hWnd),
uintptr(dx),
uintptr(dy),
uintptr(prcScroll),
uintptr(prcClip),
uintptr(hrgnUpdate),
uintptr(prcUpdate),
uintptr(flags),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // INTfunction ScrollWindowEx(
hWnd: THandle; // HWND
dx: Integer; // INT
dy: Integer; // INT
prcScroll: Pointer; // RECT* optional
prcClip: Pointer; // RECT* optional
hrgnUpdate: THandle; // HRGN optional
prcUpdate: Pointer; // RECT* optional, out
flags: DWORD // SCROLL_WINDOW_FLAGS
): Integer; stdcall;
external 'USER32.dll' name 'ScrollWindowEx';result := DllCall("USER32\ScrollWindowEx"
, "Ptr", hWnd ; HWND
, "Int", dx ; INT
, "Int", dy ; INT
, "Ptr", prcScroll ; RECT* optional
, "Ptr", prcClip ; RECT* optional
, "Ptr", hrgnUpdate ; HRGN optional
, "Ptr", prcUpdate ; RECT* optional, out
, "UInt", flags ; SCROLL_WINDOW_FLAGS
, "Int") ; return: INT●ScrollWindowEx(hWnd, dx, dy, prcScroll, prcClip, hrgnUpdate, prcUpdate, flags) = DLL("USER32.dll", "int ScrollWindowEx(void*, int, int, void*, void*, void*, void*, dword)")
# 呼び出し: ScrollWindowEx(hWnd, dx, dy, prcScroll, prcClip, hrgnUpdate, prcUpdate, flags)
# hWnd : HWND -> "void*"
# dx : INT -> "int"
# dy : INT -> "int"
# prcScroll : RECT* optional -> "void*"
# prcClip : RECT* optional -> "void*"
# hrgnUpdate : HRGN optional -> "void*"
# prcUpdate : RECT* optional, out -> "void*"
# flags : SCROLL_WINDOW_FLAGS -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。