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