Win32 API 日本語リファレンス
ホームUI.Shell › ShellMessageBoxA

ShellMessageBoxA

関数可変長引数
リソース文字列を用いてメッセージボックスを表示する。
DLLSHLWAPI.dll文字セットANSI (-A)呼出規約cdeclSetLastErrorあり対応OSWindows XP 以降

シグネチャ

// SHLWAPI.dll  (ANSI / -A)
#include <windows.h>

INT ShellMessageBoxA(
    HINSTANCE hAppInst,   // optional
    HWND hWnd,   // optional
    LPCSTR lpcText,
    LPCSTR lpcTitle,   // optional
    MESSAGEBOX_STYLE fuStyle,
    ...
);
// ※可変長引数(printf形式・cdecl)。上記の固定引数の後に、書式に応じた引数を追加で渡します。

パラメーター

名前方向説明
hAppInstHINSTANCEinoptionalpszTitle で指定された文字列リソースを読み込むモジュールのハンドル。pszTitle が文字列リソースを指していない場合、このパラメーターは無視されます。pszMsg または pszTitle がリソース ID の場合、この値は有効である必要があります。
hWndHWNDinoptional作成するメッセージボックスの所有者ウィンドウへのハンドル。この変数が NULL でない場合、所有者ウィンドウのタイトルがメッセージボックスのタイトルとして使用されます。
lpcTextLPCSTRin表示するメッセージ、またはメッセージの取得元を指定するリソース ID のいずれかを格納した、null 終端文字列へのポインター。
lpcTitleLPCSTRinoptionalダイアログボックスのタイトル、またはタイトルの取得元を指定するリソース ID を格納した、null 終端文字列へのポインター。このパラメーターと hWnd の両方が NULL の場合、タイトルは表示されません。このパラメーターが MAKEINTRESOURCE マクロで作成された読み込み可能なリソースを指している場合、タイトルとして hWnd よりも優先されます。
fuStyleMESSAGEBOX_STYLEinダイアログボックスの内容と動作を指定します。指定可能な値については、MessageBox を参照してください。

戻り値の型: INT

公式ドキュメント

ShellMessageBox は変更されるか、利用できなくなる可能性があります。(ANSI)

戻り値

型: int

メッセージボックスで押されたボタンを示す整数値。具体的な値については、MessageBox を参照してください。

関数が失敗した場合、戻り値は 0 です。拡張エラー情報を取得するには、GetLastError を呼び出してください。

解説(Remarks)

メモ

shellapi.h ヘッダーは、UNICODE プリプロセッサー定数の定義に基づいて、この関数の ANSI 版または Unicode 版を自動的に選択するエイリアスとして ShellMessageBox を定義しています。エンコーディング中立のエイリアスの使用と、エンコーディング中立でないコードの使用を混在させると、不一致が発生し、コンパイルエラーや実行時エラーの原因となる可能性があります。詳細については、関数プロトタイプの規則 を参照してください。

出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)

各言語での呼び出し定義

// SHLWAPI.dll  (ANSI / -A)
#include <windows.h>

INT ShellMessageBoxA(
    HINSTANCE hAppInst,   // optional
    HWND hWnd,   // optional
    LPCSTR lpcText,
    LPCSTR lpcTitle,   // optional
    MESSAGEBOX_STYLE fuStyle,
    ...
);
// ※可変長引数(printf形式・cdecl)。上記の固定引数の後に、書式に応じた引数を追加で渡します。
[DllImport("SHLWAPI.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern int ShellMessageBoxA(
    IntPtr hAppInst,   // HINSTANCE optional
    IntPtr hWnd,   // HWND optional
    [MarshalAs(UnmanagedType.LPStr)] string lpcText,   // LPCSTR
    [MarshalAs(UnmanagedType.LPStr)] string lpcTitle,   // LPCSTR optional
    uint fuStyle,   // MESSAGEBOX_STYLE
    __arglist
);
// ※可変長引数(printf形式・cdecl)。上記の固定引数の後に、書式に応じた引数を追加で渡します。
<DllImport("SHLWAPI.dll", CharSet:=CharSet.Ansi, SetLastError:=True, ExactSpelling:=True, CallingConvention:=CallingConvention.Cdecl)>
Public Shared Function ShellMessageBoxA(
    hAppInst As IntPtr,   ' HINSTANCE optional
    hWnd As IntPtr,   ' HWND optional
    <MarshalAs(UnmanagedType.LPStr)> lpcText As String,   ' LPCSTR
    <MarshalAs(UnmanagedType.LPStr)> lpcTitle As String,   ' LPCSTR optional
    fuStyle As UInteger   ' MESSAGEBOX_STYLE
) As Integer
End Function
' ※可変長引数(printf形式・cdecl)。上記の固定引数の後に、書式に応じた引数を追加で渡します。
' hAppInst : HINSTANCE optional
' hWnd : HWND optional
' lpcText : LPCSTR
' lpcTitle : LPCSTR optional
' fuStyle : MESSAGEBOX_STYLE
Declare PtrSafe Function ShellMessageBoxA Lib "shlwapi" ( _
    ByVal hAppInst As LongPtr, _
    ByVal hWnd As LongPtr, _
    ByVal lpcText As String, _
    ByVal lpcTitle As String, _
    ByVal fuStyle As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
' ※可変長引数(printf形式・cdecl)。上記の固定引数の後に、書式に応じた引数を追加で渡します。
import ctypes
from ctypes import wintypes

ShellMessageBoxA = ctypes.cdll.shlwapi.ShellMessageBoxA
ShellMessageBoxA.restype = ctypes.c_int
ShellMessageBoxA.argtypes = [
    wintypes.HANDLE,  # hAppInst : HINSTANCE optional
    wintypes.HANDLE,  # hWnd : HWND optional
    wintypes.LPCSTR,  # lpcText : LPCSTR
    wintypes.LPCSTR,  # lpcTitle : LPCSTR optional
    wintypes.DWORD,  # fuStyle : MESSAGEBOX_STYLE
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))
# ※可変長引数(printf形式・cdecl)。上記の固定引数の後に、書式に応じた引数を追加で渡します。
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('SHLWAPI.dll')
ShellMessageBoxA = Fiddle::Function.new(
  lib['ShellMessageBoxA'],
  [
    Fiddle::TYPE_VOIDP,  # hAppInst : HINSTANCE optional
    Fiddle::TYPE_VOIDP,  # hWnd : HWND optional
    Fiddle::TYPE_VOIDP,  # lpcText : LPCSTR
    Fiddle::TYPE_VOIDP,  # lpcTitle : LPCSTR optional
    -Fiddle::TYPE_INT,  # fuStyle : MESSAGEBOX_STYLE
  ],
  Fiddle::TYPE_INT, Fiddle::Function::CDECL)
# ※可変長引数(printf形式・cdecl)。上記の固定引数の後に、書式に応じた引数を追加で渡します。
#[link(name = "shlwapi")]
extern "C" {
    fn ShellMessageBoxA(
        hAppInst: *mut core::ffi::c_void,  // HINSTANCE optional
        hWnd: *mut core::ffi::c_void,  // HWND optional
        lpcText: *const u8,  // LPCSTR
        lpcTitle: *const u8,  // LPCSTR optional
        fuStyle: u32,  // MESSAGEBOX_STYLE
        ...
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
// ※可変長引数(printf形式・cdecl)。上記の固定引数の後に、書式に応じた引数を追加で渡します。
$sig = @"
[DllImport("SHLWAPI.dll", CharSet = CharSet.Ansi, SetLastError = true, CallingConvention = CallingConvention.Cdecl)]
public static extern int ShellMessageBoxA(IntPtr hAppInst, IntPtr hWnd, [MarshalAs(UnmanagedType.LPStr)] string lpcText, [MarshalAs(UnmanagedType.LPStr)] string lpcTitle, uint fuStyle);
"@
$api = Add-Type -MemberDefinition $sig -Name 'SHLWAPI_ShellMessageBoxA' -Namespace Win32 -PassThru
# $api::ShellMessageBoxA(hAppInst, hWnd, lpcText, lpcTitle, fuStyle)
# ※可変長引数(printf形式・cdecl)。上記の固定引数の後に、書式に応じた引数を追加で渡します。
#uselib "SHLWAPI.dll"
#func global ShellMessageBoxA "ShellMessageBoxA" sptr, sptr, sptr, sptr, sptr
; ShellMessageBoxA hAppInst, hWnd, lpcText, lpcTitle, fuStyle   ; 戻り値は stat
; hAppInst : HINSTANCE optional -> "sptr"
; hWnd : HWND optional -> "sptr"
; lpcText : LPCSTR -> "sptr"
; lpcTitle : LPCSTR optional -> "sptr"
; fuStyle : MESSAGEBOX_STYLE -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
; ※可変長引数(printf形式・cdecl)。上記の固定引数の後に、書式に応じた引数を追加で渡します。
#uselib "SHLWAPI.dll"
#cfunc global ShellMessageBoxA "ShellMessageBoxA" sptr, sptr, str, str, int
; res = ShellMessageBoxA(hAppInst, hWnd, lpcText, lpcTitle, fuStyle)
; hAppInst : HINSTANCE optional -> "sptr"
; hWnd : HWND optional -> "sptr"
; lpcText : LPCSTR -> "str"
; lpcTitle : LPCSTR optional -> "str"
; fuStyle : MESSAGEBOX_STYLE -> "int"
; ※可変長引数(printf形式・cdecl)。上記の固定引数の後に、書式に応じた引数を追加で渡します。
; INT ShellMessageBoxA(HINSTANCE hAppInst, HWND hWnd, LPCSTR lpcText, LPCSTR lpcTitle, MESSAGEBOX_STYLE fuStyle)
#uselib "SHLWAPI.dll"
#cfunc global ShellMessageBoxA "ShellMessageBoxA" intptr, intptr, str, str, int
; res = ShellMessageBoxA(hAppInst, hWnd, lpcText, lpcTitle, fuStyle)
; hAppInst : HINSTANCE optional -> "intptr"
; hWnd : HWND optional -> "intptr"
; lpcText : LPCSTR -> "str"
; lpcTitle : LPCSTR optional -> "str"
; fuStyle : MESSAGEBOX_STYLE -> "int"
; ※可変長引数(printf形式・cdecl)。上記の固定引数の後に、書式に応じた引数を追加で渡します。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	shlwapi = windows.NewLazySystemDLL("SHLWAPI.dll")
	procShellMessageBoxA = shlwapi.NewProc("ShellMessageBoxA")
)

// hAppInst (HINSTANCE optional), hWnd (HWND optional), lpcText (LPCSTR), lpcTitle (LPCSTR optional), fuStyle (MESSAGEBOX_STYLE)
r1, _, err := procShellMessageBoxA.Call(
	uintptr(hAppInst),
	uintptr(hWnd),
	uintptr(unsafe.Pointer(windows.BytePtrFromString(lpcText))),
	uintptr(unsafe.Pointer(windows.BytePtrFromString(lpcTitle))),
	uintptr(fuStyle),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // INT
// ※可変長引数(printf形式・cdecl)。上記の固定引数の後に、書式に応じた引数を追加で渡します。
function ShellMessageBoxA(
  hAppInst: THandle;   // HINSTANCE optional
  hWnd: THandle;   // HWND optional
  lpcText: PAnsiChar;   // LPCSTR
  lpcTitle: PAnsiChar;   // LPCSTR optional
  fuStyle: DWORD   // MESSAGEBOX_STYLE
): Integer; cdecl; varargs;
  external 'SHLWAPI.dll' name 'ShellMessageBoxA';
// ※可変長引数(printf形式・cdecl)。上記の固定引数の後に、書式に応じた引数を追加で渡します。
result := DllCall("SHLWAPI\ShellMessageBoxA"
    , "Ptr", hAppInst   ; HINSTANCE optional
    , "Ptr", hWnd   ; HWND optional
    , "AStr", lpcText   ; LPCSTR
    , "AStr", lpcTitle   ; LPCSTR optional
    , "UInt", fuStyle   ; MESSAGEBOX_STYLE
    , "Cdecl Int")   ; return: INT
; ※可変長引数(printf形式・cdecl)。上記の固定引数の後に、書式に応じた引数を追加で渡します。
●ShellMessageBoxA(hAppInst, hWnd, lpcText, lpcTitle, fuStyle) = DLL("SHLWAPI.dll", "int ShellMessageBoxA(void*, void*, char*, char*, dword)")
# 呼び出し: ShellMessageBoxA(hAppInst, hWnd, lpcText, lpcTitle, fuStyle)
# hAppInst : HINSTANCE optional -> "void*"
# hWnd : HWND optional -> "void*"
# lpcText : LPCSTR -> "char*"
# lpcTitle : LPCSTR optional -> "char*"
# fuStyle : MESSAGEBOX_STYLE -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※cdecl関数。DLL()宣言はstdcall前提。cdeclは EXEC_PTR(`cdecl`,…) を使用。
# ※可変長引数。DLL()は固定引数のみ。追加引数は EXEC_PTR で渡してください。
# ※可変長引数(printf形式・cdecl)。上記の固定引数の後に、書式に応じた引数を追加で渡します。
const std = @import("std");

extern "shlwapi" fn ShellMessageBoxA(
    hAppInst: ?*anyopaque, // HINSTANCE optional
    hWnd: ?*anyopaque, // HWND optional
    lpcText: [*c]const u8, // LPCSTR
    lpcTitle: [*c]const u8, // LPCSTR optional
    fuStyle: u32, // MESSAGEBOX_STYLE
    ...
) callconv(.c) i32;
// ※可変長引数(printf形式・cdecl)。上記の固定引数の後に、書式に応じた引数を追加で渡します。
proc ShellMessageBoxA(
    hAppInst: pointer,  # HINSTANCE optional
    hWnd: pointer,  # HWND optional
    lpcText: cstring,  # LPCSTR
    lpcTitle: cstring,  # LPCSTR optional
    fuStyle: uint32  # MESSAGEBOX_STYLE
): int32 {.importc: "ShellMessageBoxA", cdecl, varargs, dynlib: "SHLWAPI.dll".}
# ※可変長引数(printf形式・cdecl)。上記の固定引数の後に、書式に応じた引数を追加で渡します。
pragma(lib, "shlwapi");
extern(C)
int ShellMessageBoxA(
    void* hAppInst,   // HINSTANCE optional
    void* hWnd,   // HWND optional
    const(char)* lpcText,   // LPCSTR
    const(char)* lpcTitle,   // LPCSTR optional
    uint fuStyle,   // MESSAGEBOX_STYLE
    ...
);
// ※可変長引数(printf形式・cdecl)。上記の固定引数の後に、書式に応じた引数を追加で渡します。
ccall((:ShellMessageBoxA, "SHLWAPI.dll"), Int32,
      (Ptr{Cvoid}, Ptr{Cvoid}, Cstring, Cstring, UInt32),
      hAppInst, hWnd, lpcText, lpcTitle, fuStyle)
# hAppInst : HINSTANCE optional -> Ptr{Cvoid}
# hWnd : HWND optional -> Ptr{Cvoid}
# lpcText : LPCSTR -> Cstring
# lpcTitle : LPCSTR optional -> Cstring
# fuStyle : MESSAGEBOX_STYLE -> UInt32
# ※可変長引数(printf形式・cdecl)。上記の固定引数の後に、書式に応じた引数を追加で渡します。
local ffi = require("ffi")
ffi.cdef[[
int32_t ShellMessageBoxA(
    void* hAppInst,
    void* hWnd,
    const char* lpcText,
    const char* lpcTitle,
    uint32_t fuStyle,
    ...);
]]
local shlwapi = ffi.load("shlwapi")
-- shlwapi.ShellMessageBoxA(hAppInst, hWnd, lpcText, lpcTitle, fuStyle)
-- hAppInst : HINSTANCE optional
-- hWnd : HWND optional
-- lpcText : LPCSTR
-- lpcTitle : LPCSTR optional
-- fuStyle : MESSAGEBOX_STYLE
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
-- ※可変長引数(printf形式・cdecl)。上記の固定引数の後に、書式に応じた引数を追加で渡します。
const koffi = require('koffi');
const lib = koffi.load('SHLWAPI.dll');
const ShellMessageBoxA = lib.func('__cdecl', 'ShellMessageBoxA', 'int32_t', ['void *', 'void *', 'str', 'str', 'uint32_t', '...']);
// ShellMessageBoxA(hAppInst, hWnd, lpcText, lpcTitle, fuStyle)
// hAppInst : HINSTANCE optional -> 'void *'
// hWnd : HWND optional -> 'void *'
// lpcText : LPCSTR -> 'str'
// lpcTitle : LPCSTR optional -> 'str'
// fuStyle : MESSAGEBOX_STYLE -> 'uint32_t'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
// ※可変長引数(printf形式・cdecl)。上記の固定引数の後に、書式に応じた引数を追加で渡します。
const lib = Deno.dlopen("SHLWAPI.dll", {
  ShellMessageBoxA: { parameters: ["pointer", "pointer", "buffer", "buffer", "u32"], result: "i32" },
});
// lib.symbols.ShellMessageBoxA(hAppInst, hWnd, lpcText, lpcTitle, fuStyle)
// hAppInst : HINSTANCE optional -> "pointer"
// hWnd : HWND optional -> "pointer"
// lpcText : LPCSTR -> "buffer"
// lpcTitle : LPCSTR optional -> "buffer"
// fuStyle : MESSAGEBOX_STYLE -> "u32"
// 文字列は "buffer"。ANSI(-A) は new TextEncoder() で UTF-8/ANSI バイト列(末尾に \x00)を渡す。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
// ※可変長引数(printf形式・cdecl)。上記の固定引数の後に、書式に応じた引数を追加で渡します。
<?php
$ffi = FFI::cdef(<<<C
int32_t ShellMessageBoxA(
    void* hAppInst,
    void* hWnd,
    const char* lpcText,
    const char* lpcTitle,
    uint32_t fuStyle,
    ...);
C, "SHLWAPI.dll");
// $ffi->ShellMessageBoxA(hAppInst, hWnd, lpcText, lpcTitle, fuStyle);
// hAppInst : HINSTANCE optional
// hWnd : HWND optional
// lpcText : LPCSTR
// lpcTitle : LPCSTR optional
// fuStyle : MESSAGEBOX_STYLE
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
// ※可変長引数(printf形式・cdecl)。上記の固定引数の後に、書式に応じた引数を追加で渡します。
import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;

public interface Shlwapi extends Library {
    Shlwapi INSTANCE = Native.load("shlwapi", Shlwapi.class, W32APIOptions.ASCII_OPTIONS);
    int ShellMessageBoxA(
        Pointer hAppInst,   // HINSTANCE optional
        Pointer hWnd,   // HWND optional
        String lpcText,   // LPCSTR
        String lpcTitle,   // LPCSTR optional
        int fuStyle,   // MESSAGEBOX_STYLE
        Object... args   // 可変長引数(printf形式)
    );
}
// ※可変長引数(printf形式・cdecl)。上記の固定引数の後に、書式に応じた引数を追加で渡します。
@[Link("shlwapi")]
lib LibSHLWAPI
  fun ShellMessageBoxA = ShellMessageBoxA(
    hAppInst : Void*,   # HINSTANCE optional
    hWnd : Void*,   # HWND optional
    lpcText : UInt8*,   # LPCSTR
    lpcTitle : UInt8*,   # LPCSTR optional
    fuStyle : UInt32,   # MESSAGEBOX_STYLE
    ...
  ) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# ※可変長引数(printf形式・cdecl)。上記の固定引数の後に、書式に応じた引数を追加で渡します。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef ShellMessageBoxANative = Int32 Function(Pointer<Void>, Pointer<Void>, Pointer<Utf8>, Pointer<Utf8>, Uint32);
typedef ShellMessageBoxADart = int Function(Pointer<Void>, Pointer<Void>, Pointer<Utf8>, Pointer<Utf8>, int);
final ShellMessageBoxA = DynamicLibrary.open('SHLWAPI.dll')
    .lookupFunction<ShellMessageBoxANative, ShellMessageBoxADart>('ShellMessageBoxA');
// hAppInst : HINSTANCE optional -> Pointer<Void>
// hWnd : HWND optional -> Pointer<Void>
// lpcText : LPCSTR -> Pointer<Utf8>
// lpcTitle : LPCSTR optional -> Pointer<Utf8>
// fuStyle : MESSAGEBOX_STYLE -> Uint32
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
// ※可変長引数(printf形式・cdecl)。上記の固定引数の後に、書式に応じた引数を追加で渡します。
{$mode objfpc}{$H+}
function ShellMessageBoxA(
  hAppInst: THandle;   // HINSTANCE optional
  hWnd: THandle;   // HWND optional
  lpcText: PAnsiChar;   // LPCSTR
  lpcTitle: PAnsiChar;   // LPCSTR optional
  fuStyle: DWORD   // MESSAGEBOX_STYLE
): Integer; cdecl; varargs;
  external 'SHLWAPI.dll' name 'ShellMessageBoxA';
// ※可変長引数(printf形式・cdecl)。上記の固定引数の後に、書式に応じた引数を追加で渡します。
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import ccall safe "ShellMessageBoxA"
  c_ShellMessageBoxA :: Ptr () -> Ptr () -> CString -> CString -> Word32 -> IO Int32
-- hAppInst : HINSTANCE optional -> Ptr ()
-- hWnd : HWND optional -> Ptr ()
-- lpcText : LPCSTR -> CString
-- lpcTitle : LPCSTR optional -> CString
-- fuStyle : MESSAGEBOX_STYLE -> Word32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
-- ※可変長引数(printf形式・cdecl)。上記の固定引数の後に、書式に応じた引数を追加で渡します。
open Ctypes
open Foreign

let shellmessageboxa =
  foreign "ShellMessageBoxA"
    ((ptr void) @-> (ptr void) @-> string @-> string @-> uint32_t @-> returning int32_t)
(* hAppInst : HINSTANCE optional -> (ptr void) *)
(* hWnd : HWND optional -> (ptr void) *)
(* lpcText : LPCSTR -> string *)
(* lpcTitle : LPCSTR optional -> string *)
(* fuStyle : MESSAGEBOX_STYLE -> uint32_t *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(* ※可変長引数(printf形式・cdecl)。上記の固定引数の後に、書式に応じた引数を追加で渡します。
(cffi:define-foreign-library shlwapi (t "SHLWAPI.dll"))
(cffi:use-foreign-library shlwapi)

(cffi:defcfun ("ShellMessageBoxA" shell-message-box-a :convention :cdecl) :int32
  (h-app-inst :pointer)   ; HINSTANCE optional
  (h-wnd :pointer)   ; HWND optional
  (lpc-text :string)   ; LPCSTR
  (lpc-title :string)   ; LPCSTR optional
  (fu-style :uint32)   ; MESSAGEBOX_STYLE
  &rest)   ; 可変長引数(printf形式)
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
; ※可変長引数(printf形式・cdecl)。上記の固定引数の後に、書式に応じた引数を追加で渡します。
use Win32::API;
my $ShellMessageBoxA = Win32::API::More->new('SHLWAPI',
    'int ShellMessageBoxA(HANDLE hAppInst, HANDLE hWnd, LPCSTR lpcText, LPCSTR lpcTitle, DWORD fuStyle)');
# my $ret = $ShellMessageBoxA->Call($hAppInst, $hWnd, $lpcText, $lpcTitle, $fuStyle);
# hAppInst : HINSTANCE optional -> HANDLE
# hWnd : HWND optional -> HANDLE
# lpcText : LPCSTR -> LPCSTR
# lpcTitle : LPCSTR optional -> LPCSTR
# fuStyle : MESSAGEBOX_STYLE -> DWORD
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。
# ※可変長引数(printf形式・cdecl)。上記の固定引数の後に、書式に応じた引数を追加で渡します。

関連項目

文字セット違い
使用する型