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

DeletePwrScheme

関数
指定IDの電源スキームを削除する。
DLLPOWRPROF.dll呼出規約winapiSetLastErrorあり対応OSWindows XP 以降

シグネチャ

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

BOOLEAN DeletePwrScheme(
    DWORD uiID
);

パラメーター

名前方向
uiIDDWORDin

戻り値の型: BOOLEAN

各言語での呼び出し定義

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

BOOLEAN DeletePwrScheme(
    DWORD uiID
);
[DllImport("POWRPROF.dll", SetLastError = true, ExactSpelling = true)]
static extern byte DeletePwrScheme(
    uint uiID   // DWORD
);
<DllImport("POWRPROF.dll", SetLastError:=True, ExactSpelling:=True)>
Public Shared Function DeletePwrScheme(
    uiID As UInteger   ' DWORD
) As Byte
End Function
' uiID : DWORD
Declare PtrSafe Function DeletePwrScheme Lib "powrprof" ( _
    ByVal uiID As Long) As Byte
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

DeletePwrScheme = ctypes.windll.powrprof.DeletePwrScheme
DeletePwrScheme.restype = ctypes.c_byte
DeletePwrScheme.argtypes = [
    wintypes.DWORD,  # uiID : DWORD
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('POWRPROF.dll')
DeletePwrScheme = Fiddle::Function.new(
  lib['DeletePwrScheme'],
  [
    -Fiddle::TYPE_INT,  # uiID : DWORD
  ],
  Fiddle::TYPE_CHAR)
#[link(name = "powrprof")]
extern "system" {
    fn DeletePwrScheme(
        uiID: u32  // DWORD
    ) -> u8;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("POWRPROF.dll", SetLastError = true)]
public static extern byte DeletePwrScheme(uint uiID);
"@
$api = Add-Type -MemberDefinition $sig -Name 'POWRPROF_DeletePwrScheme' -Namespace Win32 -PassThru
# $api::DeletePwrScheme(uiID)
#uselib "POWRPROF.dll"
#func global DeletePwrScheme "DeletePwrScheme" sptr
; DeletePwrScheme uiID   ; 戻り値は stat
; uiID : DWORD -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "POWRPROF.dll"
#cfunc global DeletePwrScheme "DeletePwrScheme" int
; res = DeletePwrScheme(uiID)
; uiID : DWORD -> "int"
; BOOLEAN DeletePwrScheme(DWORD uiID)
#uselib "POWRPROF.dll"
#cfunc global DeletePwrScheme "DeletePwrScheme" int
; res = DeletePwrScheme(uiID)
; uiID : DWORD -> "int"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	powrprof = windows.NewLazySystemDLL("POWRPROF.dll")
	procDeletePwrScheme = powrprof.NewProc("DeletePwrScheme")
)

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