Win32 API 日本語リファレンス
ホームUI.WindowsAndMessaging › CancelShutdown

CancelShutdown

関数
進行中のシステムシャットダウン処理を取り消す。
DLLUSER32.dll呼出規約winapi

シグネチャ

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

BOOL CancelShutdown(void);

パラメーターなし。戻り値: BOOL

各言語での呼び出し定義

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

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

CancelShutdown = ctypes.windll.user32.CancelShutdown
CancelShutdown.restype = wintypes.BOOL
CancelShutdown.argtypes = []
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('USER32.dll')
CancelShutdown = Fiddle::Function.new(
  lib['CancelShutdown'],
  [],
  Fiddle::TYPE_INT)
#[link(name = "user32")]
extern "system" {
    fn CancelShutdown() -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("USER32.dll")]
public static extern bool CancelShutdown();
"@
$api = Add-Type -MemberDefinition $sig -Name 'USER32_CancelShutdown' -Namespace Win32 -PassThru
# $api::CancelShutdown()
#uselib "USER32.dll"
#func global CancelShutdown "CancelShutdown"
; CancelShutdown   ; 戻り値は stat
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "USER32.dll"
#cfunc global CancelShutdown "CancelShutdown"
; res = CancelShutdown()
; BOOL CancelShutdown()
#uselib "USER32.dll"
#cfunc global CancelShutdown "CancelShutdown"
; res = CancelShutdown()
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	user32 = windows.NewLazySystemDLL("USER32.dll")
	procCancelShutdown = user32.NewProc("CancelShutdown")
)

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