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