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

SetMessageWaitingIndicator

関数
メッセージ待機インジケータの状態とメッセージ数を設定する。
DLLKERNEL32.dll呼出規約winapi

シグネチャ

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

BOOL SetMessageWaitingIndicator(
    HANDLE hMsgIndicator,
    DWORD ulMsgCount
);

パラメーター

名前方向
hMsgIndicatorHANDLEin
ulMsgCountDWORDin

戻り値の型: BOOL

各言語での呼び出し定義

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

BOOL SetMessageWaitingIndicator(
    HANDLE hMsgIndicator,
    DWORD ulMsgCount
);
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("KERNEL32.dll", ExactSpelling = true)]
static extern bool SetMessageWaitingIndicator(
    IntPtr hMsgIndicator,   // HANDLE
    uint ulMsgCount   // DWORD
);
<DllImport("KERNEL32.dll", ExactSpelling:=True)>
Public Shared Function SetMessageWaitingIndicator(
    hMsgIndicator As IntPtr,   ' HANDLE
    ulMsgCount As UInteger   ' DWORD
) As Boolean
End Function
' hMsgIndicator : HANDLE
' ulMsgCount : DWORD
Declare PtrSafe Function SetMessageWaitingIndicator Lib "kernel32" ( _
    ByVal hMsgIndicator As LongPtr, _
    ByVal ulMsgCount As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

SetMessageWaitingIndicator = ctypes.windll.kernel32.SetMessageWaitingIndicator
SetMessageWaitingIndicator.restype = wintypes.BOOL
SetMessageWaitingIndicator.argtypes = [
    wintypes.HANDLE,  # hMsgIndicator : HANDLE
    wintypes.DWORD,  # ulMsgCount : DWORD
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('KERNEL32.dll')
SetMessageWaitingIndicator = Fiddle::Function.new(
  lib['SetMessageWaitingIndicator'],
  [
    Fiddle::TYPE_VOIDP,  # hMsgIndicator : HANDLE
    -Fiddle::TYPE_INT,  # ulMsgCount : DWORD
  ],
  Fiddle::TYPE_INT)
#[link(name = "kernel32")]
extern "system" {
    fn SetMessageWaitingIndicator(
        hMsgIndicator: *mut core::ffi::c_void,  // HANDLE
        ulMsgCount: u32  // DWORD
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("KERNEL32.dll")]
public static extern bool SetMessageWaitingIndicator(IntPtr hMsgIndicator, uint ulMsgCount);
"@
$api = Add-Type -MemberDefinition $sig -Name 'KERNEL32_SetMessageWaitingIndicator' -Namespace Win32 -PassThru
# $api::SetMessageWaitingIndicator(hMsgIndicator, ulMsgCount)
#uselib "KERNEL32.dll"
#func global SetMessageWaitingIndicator "SetMessageWaitingIndicator" sptr, sptr
; SetMessageWaitingIndicator hMsgIndicator, ulMsgCount   ; 戻り値は stat
; hMsgIndicator : HANDLE -> "sptr"
; ulMsgCount : DWORD -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "KERNEL32.dll"
#cfunc global SetMessageWaitingIndicator "SetMessageWaitingIndicator" sptr, int
; res = SetMessageWaitingIndicator(hMsgIndicator, ulMsgCount)
; hMsgIndicator : HANDLE -> "sptr"
; ulMsgCount : DWORD -> "int"
; BOOL SetMessageWaitingIndicator(HANDLE hMsgIndicator, DWORD ulMsgCount)
#uselib "KERNEL32.dll"
#cfunc global SetMessageWaitingIndicator "SetMessageWaitingIndicator" intptr, int
; res = SetMessageWaitingIndicator(hMsgIndicator, ulMsgCount)
; hMsgIndicator : HANDLE -> "intptr"
; ulMsgCount : DWORD -> "int"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	kernel32 = windows.NewLazySystemDLL("KERNEL32.dll")
	procSetMessageWaitingIndicator = kernel32.NewProc("SetMessageWaitingIndicator")
)

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