ホーム › System.StationsAndDesktops › EnumWindowStationsW
EnumWindowStationsW
関数現在のセッションのウィンドウステーションを列挙する。
シグネチャ
// USER32.dll (Unicode / -W)
#include <windows.h>
BOOL EnumWindowStationsW(
WINSTAENUMPROCW lpEnumFunc,
LPARAM lParam
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| lpEnumFunc | WINSTAENUMPROCW | in |
| lParam | LPARAM | in |
戻り値の型: BOOL
各言語での呼び出し定義
// USER32.dll (Unicode / -W)
#include <windows.h>
BOOL EnumWindowStationsW(
WINSTAENUMPROCW lpEnumFunc,
LPARAM lParam
);[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("USER32.dll", CharSet = CharSet.Unicode, SetLastError = true, ExactSpelling = true)]
static extern bool EnumWindowStationsW(
IntPtr lpEnumFunc, // WINSTAENUMPROCW
IntPtr lParam // LPARAM
);<DllImport("USER32.dll", CharSet:=CharSet.Unicode, SetLastError:=True, ExactSpelling:=True)>
Public Shared Function EnumWindowStationsW(
lpEnumFunc As IntPtr, ' WINSTAENUMPROCW
lParam As IntPtr ' LPARAM
) As Boolean
End Function' lpEnumFunc : WINSTAENUMPROCW
' lParam : LPARAM
Declare PtrSafe Function EnumWindowStationsW Lib "user32" ( _
ByVal lpEnumFunc As LongPtr, _
ByVal lParam As LongPtr) As Long
' Unicode(W): 文字列は ByVal As LongPtr とし StrPtr(unicodeStr) を渡す
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
EnumWindowStationsW = ctypes.windll.user32.EnumWindowStationsW
EnumWindowStationsW.restype = wintypes.BOOL
EnumWindowStationsW.argtypes = [
ctypes.c_void_p, # lpEnumFunc : WINSTAENUMPROCW
ctypes.c_ssize_t, # lParam : LPARAM
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('USER32.dll')
EnumWindowStationsW = Fiddle::Function.new(
lib['EnumWindowStationsW'],
[
Fiddle::TYPE_VOIDP, # lpEnumFunc : WINSTAENUMPROCW
Fiddle::TYPE_INTPTR_T, # lParam : LPARAM
],
Fiddle::TYPE_INT)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"#[link(name = "user32")]
extern "system" {
fn EnumWindowStationsW(
lpEnumFunc: *const core::ffi::c_void, // WINSTAENUMPROCW
lParam: isize // LPARAM
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("USER32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
public static extern bool EnumWindowStationsW(IntPtr lpEnumFunc, IntPtr lParam);
"@
$api = Add-Type -MemberDefinition $sig -Name 'USER32_EnumWindowStationsW' -Namespace Win32 -PassThru
# $api::EnumWindowStationsW(lpEnumFunc, lParam)#uselib "USER32.dll"
#func global EnumWindowStationsW "EnumWindowStationsW" wptr, wptr
; EnumWindowStationsW lpEnumFunc, lParam ; 戻り値は stat
; lpEnumFunc : WINSTAENUMPROCW -> "wptr"
; lParam : LPARAM -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "USER32.dll"
#cfunc global EnumWindowStationsW "EnumWindowStationsW" sptr, sptr
; res = EnumWindowStationsW(lpEnumFunc, lParam)
; lpEnumFunc : WINSTAENUMPROCW -> "sptr"
; lParam : LPARAM -> "sptr"; BOOL EnumWindowStationsW(WINSTAENUMPROCW lpEnumFunc, LPARAM lParam)
#uselib "USER32.dll"
#cfunc global EnumWindowStationsW "EnumWindowStationsW" intptr, intptr
; res = EnumWindowStationsW(lpEnumFunc, lParam)
; lpEnumFunc : WINSTAENUMPROCW -> "intptr"
; lParam : LPARAM -> "intptr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
user32 = windows.NewLazySystemDLL("USER32.dll")
procEnumWindowStationsW = user32.NewProc("EnumWindowStationsW")
)
// lpEnumFunc (WINSTAENUMPROCW), lParam (LPARAM)
r1, _, err := procEnumWindowStationsW.Call(
uintptr(lpEnumFunc),
uintptr(lParam),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // BOOLfunction EnumWindowStationsW(
lpEnumFunc: Pointer; // WINSTAENUMPROCW
lParam: NativeInt // LPARAM
): BOOL; stdcall;
external 'USER32.dll' name 'EnumWindowStationsW';result := DllCall("USER32\EnumWindowStationsW"
, "Ptr", lpEnumFunc ; WINSTAENUMPROCW
, "Ptr", lParam ; LPARAM
, "Int") ; return: BOOL●EnumWindowStationsW(lpEnumFunc, lParam) = DLL("USER32.dll", "bool EnumWindowStationsW(void*, int)")
# 呼び出し: EnumWindowStationsW(lpEnumFunc, lParam)
# lpEnumFunc : WINSTAENUMPROCW -> "void*"
# lParam : LPARAM -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※-W(Unicode)関数。なでしこ1はANSIのため -A 版の利用を推奨。