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

EnableIdleRoutine

関数
アイドルルーチンの有効・無効を切り替える。
DLLMAPI32.dll呼出規約winapi

シグネチャ

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

void EnableIdleRoutine(
    void* ftg,
    BOOL fEnable
);

パラメーター

名前方向説明
ftgvoid*inout対象のアイドルルーチンのFTGハンドル。FtgRegisterIdleRoutineの戻り値を渡す。
fEnableBOOLinルーチンを有効化するならTRUE、無効化するならFALSEを指定する。

戻り値の型: void

各言語での呼び出し定義

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

void EnableIdleRoutine(
    void* ftg,
    BOOL fEnable
);
[DllImport("MAPI32.dll", ExactSpelling = true)]
static extern void EnableIdleRoutine(
    IntPtr ftg,   // void* in/out
    bool fEnable   // BOOL
);
<DllImport("MAPI32.dll", ExactSpelling:=True)>
Public Shared Sub EnableIdleRoutine(
    ftg As IntPtr,   ' void* in/out
    fEnable As Boolean   ' BOOL
)
End Sub
' ftg : void* in/out
' fEnable : BOOL
Declare PtrSafe Sub EnableIdleRoutine Lib "mapi32" ( _
    ByVal ftg As LongPtr, _
    ByVal fEnable As Long)
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

EnableIdleRoutine = ctypes.windll.mapi32.EnableIdleRoutine
EnableIdleRoutine.restype = None
EnableIdleRoutine.argtypes = [
    ctypes.POINTER(None),  # ftg : void* in/out
    wintypes.BOOL,  # fEnable : BOOL
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('MAPI32.dll')
EnableIdleRoutine = Fiddle::Function.new(
  lib['EnableIdleRoutine'],
  [
    Fiddle::TYPE_VOIDP,  # ftg : void* in/out
    Fiddle::TYPE_INT,  # fEnable : BOOL
  ],
  Fiddle::TYPE_VOID)
#[link(name = "mapi32")]
extern "system" {
    fn EnableIdleRoutine(
        ftg: *mut (),  // void* in/out
        fEnable: i32  // BOOL
    );
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("MAPI32.dll")]
public static extern void EnableIdleRoutine(IntPtr ftg, bool fEnable);
"@
$api = Add-Type -MemberDefinition $sig -Name 'MAPI32_EnableIdleRoutine' -Namespace Win32 -PassThru
# $api::EnableIdleRoutine(ftg, fEnable)
#uselib "MAPI32.dll"
#func global EnableIdleRoutine "EnableIdleRoutine" sptr, sptr
; EnableIdleRoutine ftg, fEnable
; ftg : void* in/out -> "sptr"
; fEnable : BOOL -> "sptr"
#uselib "MAPI32.dll"
#func global EnableIdleRoutine "EnableIdleRoutine" sptr, int
; EnableIdleRoutine ftg, fEnable
; ftg : void* in/out -> "sptr"
; fEnable : BOOL -> "int"
; void EnableIdleRoutine(void* ftg, BOOL fEnable)
#uselib "MAPI32.dll"
#func global EnableIdleRoutine "EnableIdleRoutine" intptr, int
; EnableIdleRoutine ftg, fEnable
; ftg : void* in/out -> "intptr"
; fEnable : BOOL -> "int"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	mapi32 = windows.NewLazySystemDLL("MAPI32.dll")
	procEnableIdleRoutine = mapi32.NewProc("EnableIdleRoutine")
)

// ftg (void* in/out), fEnable (BOOL)
r1, _, err := procEnableIdleRoutine.Call(
	uintptr(ftg),
	uintptr(fEnable),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // void
procedure EnableIdleRoutine(
  ftg: Pointer;   // void* in/out
  fEnable: BOOL   // BOOL
); stdcall;
  external 'MAPI32.dll' name 'EnableIdleRoutine';
result := DllCall("MAPI32\EnableIdleRoutine"
    , "Ptr", ftg   ; void* in/out
    , "Int", fEnable   ; BOOL
    , "Int")   ; return: void
●EnableIdleRoutine(ftg, fEnable) = DLL("MAPI32.dll", "int EnableIdleRoutine(void*, bool)")
# 呼び出し: EnableIdleRoutine(ftg, fEnable)
# ftg : void* in/out -> "void*"
# fEnable : BOOL -> "bool"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
const std = @import("std");

extern "mapi32" fn EnableIdleRoutine(
    ftg: ?*anyopaque, // void* in/out
    fEnable: i32 // BOOL
) callconv(std.os.windows.WINAPI) void;
proc EnableIdleRoutine(
    ftg: pointer,  # void* in/out
    fEnable: int32  # BOOL
) {.importc: "EnableIdleRoutine", stdcall, dynlib: "MAPI32.dll".}
pragma(lib, "mapi32");
extern(Windows)
void EnableIdleRoutine(
    void* ftg,   // void* in/out
    int fEnable   // BOOL
);
ccall((:EnableIdleRoutine, "MAPI32.dll"), stdcall, Cvoid,
      (Ptr{Cvoid}, Int32),
      ftg, fEnable)
# ftg : void* in/out -> Ptr{Cvoid}
# fEnable : BOOL -> Int32
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
void EnableIdleRoutine(
    void* ftg,
    int32_t fEnable);
]]
local mapi32 = ffi.load("mapi32")
-- mapi32.EnableIdleRoutine(ftg, fEnable)
-- ftg : void* in/out
-- fEnable : BOOL
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('MAPI32.dll');
const EnableIdleRoutine = lib.func('__stdcall', 'EnableIdleRoutine', 'void', ['void *', 'int32_t']);
// EnableIdleRoutine(ftg, fEnable)
// ftg : void* in/out -> 'void *'
// fEnable : BOOL -> 'int32_t'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("MAPI32.dll", {
  EnableIdleRoutine: { parameters: ["pointer", "i32"], result: "void" },
});
// lib.symbols.EnableIdleRoutine(ftg, fEnable)
// ftg : void* in/out -> "pointer"
// fEnable : BOOL -> "i32"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
void EnableIdleRoutine(
    void* ftg,
    int32_t fEnable);
C, "MAPI32.dll");
// $ffi->EnableIdleRoutine(ftg, fEnable);
// ftg : void* in/out
// fEnable : BOOL
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
// WINAPI(stdcall): x64 では呼出規約が統一されるため問題なし。x86 では __stdcall 対応のラッパが必要な場合あり。
import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;

public interface Mapi32 extends StdCallLibrary {
    Mapi32 INSTANCE = Native.load("mapi32", Mapi32.class);
    void EnableIdleRoutine(
        Pointer ftg,   // void* in/out
        boolean fEnable   // BOOL
    );
}
@[Link("mapi32")]
lib LibMAPI32
  fun EnableIdleRoutine = EnableIdleRoutine(
    ftg : Void*,   # void* in/out
    fEnable : Int32   # BOOL
  ) : Void
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef EnableIdleRoutineNative = Void Function(Pointer<Void>, Int32);
typedef EnableIdleRoutineDart = void Function(Pointer<Void>, int);
final EnableIdleRoutine = DynamicLibrary.open('MAPI32.dll')
    .lookupFunction<EnableIdleRoutineNative, EnableIdleRoutineDart>('EnableIdleRoutine');
// ftg : void* in/out -> Pointer<Void>
// fEnable : BOOL -> Int32
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
procedure EnableIdleRoutine(
  ftg: Pointer;   // void* in/out
  fEnable: BOOL   // BOOL
); stdcall;
  external 'MAPI32.dll' name 'EnableIdleRoutine';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "EnableIdleRoutine"
  c_EnableIdleRoutine :: Ptr () -> CInt -> IO ()
-- ftg : void* in/out -> Ptr ()
-- fEnable : BOOL -> CInt
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let enableidleroutine =
  foreign "EnableIdleRoutine"
    ((ptr void) @-> int32_t @-> returning void)
(* ftg : void* in/out -> (ptr void) *)
(* fEnable : BOOL -> int32_t *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library mapi32 (t "MAPI32.dll"))
(cffi:use-foreign-library mapi32)

(cffi:defcfun ("EnableIdleRoutine" enable-idle-routine :convention :stdcall) :void
  (ftg :pointer)   ; void* in/out
  (f-enable :int32))   ; BOOL
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $EnableIdleRoutine = Win32::API::More->new('MAPI32',
    'void EnableIdleRoutine(LPVOID ftg, BOOL fEnable)');
# my $ret = $EnableIdleRoutine->Call($ftg, $fEnable);
# ftg : void* in/out -> LPVOID
# fEnable : BOOL -> BOOL
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。