Win32 API 日本語リファレンス
ホームSystem.Threading › SetProcessRestrictionExemption

SetProcessRestrictionExemption

関数
プロセスのウィンドウ操作制限の免除を設定する。
DLLUSER32.dll呼出規約winapiSetLastErrorあり対応OSwindows8.0

シグネチャ

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

BOOL SetProcessRestrictionExemption(
    BOOL fEnableExemption
);

パラメーター

名前方向
fEnableExemptionBOOLin

戻り値の型: BOOL

各言語での呼び出し定義

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

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

SetProcessRestrictionExemption = ctypes.windll.user32.SetProcessRestrictionExemption
SetProcessRestrictionExemption.restype = wintypes.BOOL
SetProcessRestrictionExemption.argtypes = [
    wintypes.BOOL,  # fEnableExemption : BOOL
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('USER32.dll')
SetProcessRestrictionExemption = Fiddle::Function.new(
  lib['SetProcessRestrictionExemption'],
  [
    Fiddle::TYPE_INT,  # fEnableExemption : BOOL
  ],
  Fiddle::TYPE_INT)
#[link(name = "user32")]
extern "system" {
    fn SetProcessRestrictionExemption(
        fEnableExemption: i32  // BOOL
    ) -> 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 SetProcessRestrictionExemption(bool fEnableExemption);
"@
$api = Add-Type -MemberDefinition $sig -Name 'USER32_SetProcessRestrictionExemption' -Namespace Win32 -PassThru
# $api::SetProcessRestrictionExemption(fEnableExemption)
#uselib "USER32.dll"
#func global SetProcessRestrictionExemption "SetProcessRestrictionExemption" sptr
; SetProcessRestrictionExemption fEnableExemption   ; 戻り値は stat
; fEnableExemption : BOOL -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "USER32.dll"
#cfunc global SetProcessRestrictionExemption "SetProcessRestrictionExemption" int
; res = SetProcessRestrictionExemption(fEnableExemption)
; fEnableExemption : BOOL -> "int"
; BOOL SetProcessRestrictionExemption(BOOL fEnableExemption)
#uselib "USER32.dll"
#cfunc global SetProcessRestrictionExemption "SetProcessRestrictionExemption" int
; res = SetProcessRestrictionExemption(fEnableExemption)
; fEnableExemption : BOOL -> "int"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	user32 = windows.NewLazySystemDLL("USER32.dll")
	procSetProcessRestrictionExemption = user32.NewProc("SetProcessRestrictionExemption")
)

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