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

ChangeIdleRoutine

関数
登録済みアイドルルーチンの優先度や間隔などの属性を変更する。
DLLMAPI32.dll呼出規約winapi

シグネチャ

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

void ChangeIdleRoutine(
    void* ftg,
    PFNIDLE lpfnIdle,
    void* lpvIdleParam,
    SHORT priIdle,
    DWORD csecIdle,
    WORD iroIdle,
    WORD ircIdle
);

パラメーター

名前方向
ftgvoid*inout
lpfnIdlePFNIDLEin
lpvIdleParamvoid*inout
priIdleSHORTin
csecIdleDWORDin
iroIdleWORDin
ircIdleWORDin

戻り値の型: void

各言語での呼び出し定義

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

void ChangeIdleRoutine(
    void* ftg,
    PFNIDLE lpfnIdle,
    void* lpvIdleParam,
    SHORT priIdle,
    DWORD csecIdle,
    WORD iroIdle,
    WORD ircIdle
);
[DllImport("MAPI32.dll", ExactSpelling = true)]
static extern void ChangeIdleRoutine(
    IntPtr ftg,   // void* in/out
    IntPtr lpfnIdle,   // PFNIDLE
    IntPtr lpvIdleParam,   // void* in/out
    short priIdle,   // SHORT
    uint csecIdle,   // DWORD
    ushort iroIdle,   // WORD
    ushort ircIdle   // WORD
);
<DllImport("MAPI32.dll", ExactSpelling:=True)>
Public Shared Sub ChangeIdleRoutine(
    ftg As IntPtr,   ' void* in/out
    lpfnIdle As IntPtr,   ' PFNIDLE
    lpvIdleParam As IntPtr,   ' void* in/out
    priIdle As Short,   ' SHORT
    csecIdle As UInteger,   ' DWORD
    iroIdle As UShort,   ' WORD
    ircIdle As UShort   ' WORD
)
End Sub
' ftg : void* in/out
' lpfnIdle : PFNIDLE
' lpvIdleParam : void* in/out
' priIdle : SHORT
' csecIdle : DWORD
' iroIdle : WORD
' ircIdle : WORD
Declare PtrSafe Sub ChangeIdleRoutine Lib "mapi32" ( _
    ByVal ftg As LongPtr, _
    ByVal lpfnIdle As LongPtr, _
    ByVal lpvIdleParam As LongPtr, _
    ByVal priIdle As Integer, _
    ByVal csecIdle As Long, _
    ByVal iroIdle As Integer, _
    ByVal ircIdle As Integer)
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

ChangeIdleRoutine = ctypes.windll.mapi32.ChangeIdleRoutine
ChangeIdleRoutine.restype = None
ChangeIdleRoutine.argtypes = [
    ctypes.POINTER(None),  # ftg : void* in/out
    ctypes.c_void_p,  # lpfnIdle : PFNIDLE
    ctypes.POINTER(None),  # lpvIdleParam : void* in/out
    ctypes.c_short,  # priIdle : SHORT
    wintypes.DWORD,  # csecIdle : DWORD
    ctypes.c_ushort,  # iroIdle : WORD
    ctypes.c_ushort,  # ircIdle : WORD
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('MAPI32.dll')
ChangeIdleRoutine = Fiddle::Function.new(
  lib['ChangeIdleRoutine'],
  [
    Fiddle::TYPE_VOIDP,  # ftg : void* in/out
    Fiddle::TYPE_VOIDP,  # lpfnIdle : PFNIDLE
    Fiddle::TYPE_VOIDP,  # lpvIdleParam : void* in/out
    Fiddle::TYPE_SHORT,  # priIdle : SHORT
    -Fiddle::TYPE_INT,  # csecIdle : DWORD
    -Fiddle::TYPE_SHORT,  # iroIdle : WORD
    -Fiddle::TYPE_SHORT,  # ircIdle : WORD
  ],
  Fiddle::TYPE_VOID)
#[link(name = "mapi32")]
extern "system" {
    fn ChangeIdleRoutine(
        ftg: *mut (),  // void* in/out
        lpfnIdle: *const core::ffi::c_void,  // PFNIDLE
        lpvIdleParam: *mut (),  // void* in/out
        priIdle: i16,  // SHORT
        csecIdle: u32,  // DWORD
        iroIdle: u16,  // WORD
        ircIdle: u16  // WORD
    );
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("MAPI32.dll")]
public static extern void ChangeIdleRoutine(IntPtr ftg, IntPtr lpfnIdle, IntPtr lpvIdleParam, short priIdle, uint csecIdle, ushort iroIdle, ushort ircIdle);
"@
$api = Add-Type -MemberDefinition $sig -Name 'MAPI32_ChangeIdleRoutine' -Namespace Win32 -PassThru
# $api::ChangeIdleRoutine(ftg, lpfnIdle, lpvIdleParam, priIdle, csecIdle, iroIdle, ircIdle)
#uselib "MAPI32.dll"
#func global ChangeIdleRoutine "ChangeIdleRoutine" sptr, sptr, sptr, sptr, sptr, sptr, sptr
; ChangeIdleRoutine ftg, lpfnIdle, lpvIdleParam, priIdle, csecIdle, iroIdle, ircIdle
; ftg : void* in/out -> "sptr"
; lpfnIdle : PFNIDLE -> "sptr"
; lpvIdleParam : void* in/out -> "sptr"
; priIdle : SHORT -> "sptr"
; csecIdle : DWORD -> "sptr"
; iroIdle : WORD -> "sptr"
; ircIdle : WORD -> "sptr"
#uselib "MAPI32.dll"
#func global ChangeIdleRoutine "ChangeIdleRoutine" sptr, sptr, sptr, int, int, int, int
; ChangeIdleRoutine ftg, lpfnIdle, lpvIdleParam, priIdle, csecIdle, iroIdle, ircIdle
; ftg : void* in/out -> "sptr"
; lpfnIdle : PFNIDLE -> "sptr"
; lpvIdleParam : void* in/out -> "sptr"
; priIdle : SHORT -> "int"
; csecIdle : DWORD -> "int"
; iroIdle : WORD -> "int"
; ircIdle : WORD -> "int"
; void ChangeIdleRoutine(void* ftg, PFNIDLE lpfnIdle, void* lpvIdleParam, SHORT priIdle, DWORD csecIdle, WORD iroIdle, WORD ircIdle)
#uselib "MAPI32.dll"
#func global ChangeIdleRoutine "ChangeIdleRoutine" intptr, intptr, intptr, int, int, int, int
; ChangeIdleRoutine ftg, lpfnIdle, lpvIdleParam, priIdle, csecIdle, iroIdle, ircIdle
; ftg : void* in/out -> "intptr"
; lpfnIdle : PFNIDLE -> "intptr"
; lpvIdleParam : void* in/out -> "intptr"
; priIdle : SHORT -> "int"
; csecIdle : DWORD -> "int"
; iroIdle : WORD -> "int"
; ircIdle : WORD -> "int"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	mapi32 = windows.NewLazySystemDLL("MAPI32.dll")
	procChangeIdleRoutine = mapi32.NewProc("ChangeIdleRoutine")
)

// ftg (void* in/out), lpfnIdle (PFNIDLE), lpvIdleParam (void* in/out), priIdle (SHORT), csecIdle (DWORD), iroIdle (WORD), ircIdle (WORD)
r1, _, err := procChangeIdleRoutine.Call(
	uintptr(ftg),
	uintptr(lpfnIdle),
	uintptr(lpvIdleParam),
	uintptr(priIdle),
	uintptr(csecIdle),
	uintptr(iroIdle),
	uintptr(ircIdle),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // void
procedure ChangeIdleRoutine(
  ftg: Pointer;   // void* in/out
  lpfnIdle: Pointer;   // PFNIDLE
  lpvIdleParam: Pointer;   // void* in/out
  priIdle: Smallint;   // SHORT
  csecIdle: DWORD;   // DWORD
  iroIdle: Word;   // WORD
  ircIdle: Word   // WORD
); stdcall;
  external 'MAPI32.dll' name 'ChangeIdleRoutine';
result := DllCall("MAPI32\ChangeIdleRoutine"
    , "Ptr", ftg   ; void* in/out
    , "Ptr", lpfnIdle   ; PFNIDLE
    , "Ptr", lpvIdleParam   ; void* in/out
    , "Short", priIdle   ; SHORT
    , "UInt", csecIdle   ; DWORD
    , "UShort", iroIdle   ; WORD
    , "UShort", ircIdle   ; WORD
    , "Int")   ; return: void
●ChangeIdleRoutine(ftg, lpfnIdle, lpvIdleParam, priIdle, csecIdle, iroIdle, ircIdle) = DLL("MAPI32.dll", "int ChangeIdleRoutine(void*, void*, void*, int, dword, int, int)")
# 呼び出し: ChangeIdleRoutine(ftg, lpfnIdle, lpvIdleParam, priIdle, csecIdle, iroIdle, ircIdle)
# ftg : void* in/out -> "void*"
# lpfnIdle : PFNIDLE -> "void*"
# lpvIdleParam : void* in/out -> "void*"
# priIdle : SHORT -> "int"
# csecIdle : DWORD -> "dword"
# iroIdle : WORD -> "int"
# ircIdle : WORD -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。