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