SHMessageBoxCheckW
関数再表示抑止チェック付きのメッセージボックスを表示する。
シグネチャ
// SHLWAPI.dll (Unicode / -W)
#include <windows.h>
INT SHMessageBoxCheckW(
HWND hwnd, // optional
LPCWSTR pszText,
LPCWSTR pszCaption,
DWORD uType,
INT iDefault,
LPCWSTR pszRegVal
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hwnd | HWND | inoptional |
| pszText | LPCWSTR | in |
| pszCaption | LPCWSTR | in |
| uType | DWORD | in |
| iDefault | INT | in |
| pszRegVal | LPCWSTR | in |
戻り値の型: INT
各言語での呼び出し定義
// SHLWAPI.dll (Unicode / -W)
#include <windows.h>
INT SHMessageBoxCheckW(
HWND hwnd, // optional
LPCWSTR pszText,
LPCWSTR pszCaption,
DWORD uType,
INT iDefault,
LPCWSTR pszRegVal
);[DllImport("SHLWAPI.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
static extern int SHMessageBoxCheckW(
IntPtr hwnd, // HWND optional
[MarshalAs(UnmanagedType.LPWStr)] string pszText, // LPCWSTR
[MarshalAs(UnmanagedType.LPWStr)] string pszCaption, // LPCWSTR
uint uType, // DWORD
int iDefault, // INT
[MarshalAs(UnmanagedType.LPWStr)] string pszRegVal // LPCWSTR
);<DllImport("SHLWAPI.dll", CharSet:=CharSet.Unicode, ExactSpelling:=True)>
Public Shared Function SHMessageBoxCheckW(
hwnd As IntPtr, ' HWND optional
<MarshalAs(UnmanagedType.LPWStr)> pszText As String, ' LPCWSTR
<MarshalAs(UnmanagedType.LPWStr)> pszCaption As String, ' LPCWSTR
uType As UInteger, ' DWORD
iDefault As Integer, ' INT
<MarshalAs(UnmanagedType.LPWStr)> pszRegVal As String ' LPCWSTR
) As Integer
End Function' hwnd : HWND optional
' pszText : LPCWSTR
' pszCaption : LPCWSTR
' uType : DWORD
' iDefault : INT
' pszRegVal : LPCWSTR
Declare PtrSafe Function SHMessageBoxCheckW Lib "shlwapi" ( _
ByVal hwnd As LongPtr, _
ByVal pszText As LongPtr, _
ByVal pszCaption As LongPtr, _
ByVal uType As Long, _
ByVal iDefault As Long, _
ByVal pszRegVal As LongPtr) As Long
' Unicode(W): 文字列は ByVal As LongPtr とし StrPtr(unicodeStr) を渡す
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
SHMessageBoxCheckW = ctypes.windll.shlwapi.SHMessageBoxCheckW
SHMessageBoxCheckW.restype = ctypes.c_int
SHMessageBoxCheckW.argtypes = [
wintypes.HANDLE, # hwnd : HWND optional
wintypes.LPCWSTR, # pszText : LPCWSTR
wintypes.LPCWSTR, # pszCaption : LPCWSTR
wintypes.DWORD, # uType : DWORD
ctypes.c_int, # iDefault : INT
wintypes.LPCWSTR, # pszRegVal : LPCWSTR
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('SHLWAPI.dll')
SHMessageBoxCheckW = Fiddle::Function.new(
lib['SHMessageBoxCheckW'],
[
Fiddle::TYPE_VOIDP, # hwnd : HWND optional
Fiddle::TYPE_VOIDP, # pszText : LPCWSTR
Fiddle::TYPE_VOIDP, # pszCaption : LPCWSTR
-Fiddle::TYPE_INT, # uType : DWORD
Fiddle::TYPE_INT, # iDefault : INT
Fiddle::TYPE_VOIDP, # pszRegVal : LPCWSTR
],
Fiddle::TYPE_INT)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"#[link(name = "shlwapi")]
extern "system" {
fn SHMessageBoxCheckW(
hwnd: *mut core::ffi::c_void, // HWND optional
pszText: *const u16, // LPCWSTR
pszCaption: *const u16, // LPCWSTR
uType: u32, // DWORD
iDefault: i32, // INT
pszRegVal: *const u16 // LPCWSTR
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("SHLWAPI.dll", CharSet = CharSet.Unicode)]
public static extern int SHMessageBoxCheckW(IntPtr hwnd, [MarshalAs(UnmanagedType.LPWStr)] string pszText, [MarshalAs(UnmanagedType.LPWStr)] string pszCaption, uint uType, int iDefault, [MarshalAs(UnmanagedType.LPWStr)] string pszRegVal);
"@
$api = Add-Type -MemberDefinition $sig -Name 'SHLWAPI_SHMessageBoxCheckW' -Namespace Win32 -PassThru
# $api::SHMessageBoxCheckW(hwnd, pszText, pszCaption, uType, iDefault, pszRegVal)#uselib "SHLWAPI.dll"
#func global SHMessageBoxCheckW "SHMessageBoxCheckW" wptr, wptr, wptr, wptr, wptr, wptr
; SHMessageBoxCheckW hwnd, pszText, pszCaption, uType, iDefault, pszRegVal ; 戻り値は stat
; hwnd : HWND optional -> "wptr"
; pszText : LPCWSTR -> "wptr"
; pszCaption : LPCWSTR -> "wptr"
; uType : DWORD -> "wptr"
; iDefault : INT -> "wptr"
; pszRegVal : LPCWSTR -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "SHLWAPI.dll"
#cfunc global SHMessageBoxCheckW "SHMessageBoxCheckW" sptr, wstr, wstr, int, int, wstr
; res = SHMessageBoxCheckW(hwnd, pszText, pszCaption, uType, iDefault, pszRegVal)
; hwnd : HWND optional -> "sptr"
; pszText : LPCWSTR -> "wstr"
; pszCaption : LPCWSTR -> "wstr"
; uType : DWORD -> "int"
; iDefault : INT -> "int"
; pszRegVal : LPCWSTR -> "wstr"; INT SHMessageBoxCheckW(HWND hwnd, LPCWSTR pszText, LPCWSTR pszCaption, DWORD uType, INT iDefault, LPCWSTR pszRegVal)
#uselib "SHLWAPI.dll"
#cfunc global SHMessageBoxCheckW "SHMessageBoxCheckW" intptr, wstr, wstr, int, int, wstr
; res = SHMessageBoxCheckW(hwnd, pszText, pszCaption, uType, iDefault, pszRegVal)
; hwnd : HWND optional -> "intptr"
; pszText : LPCWSTR -> "wstr"
; pszCaption : LPCWSTR -> "wstr"
; uType : DWORD -> "int"
; iDefault : INT -> "int"
; pszRegVal : LPCWSTR -> "wstr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
shlwapi = windows.NewLazySystemDLL("SHLWAPI.dll")
procSHMessageBoxCheckW = shlwapi.NewProc("SHMessageBoxCheckW")
)
// hwnd (HWND optional), pszText (LPCWSTR), pszCaption (LPCWSTR), uType (DWORD), iDefault (INT), pszRegVal (LPCWSTR)
r1, _, err := procSHMessageBoxCheckW.Call(
uintptr(hwnd),
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(pszText))),
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(pszCaption))),
uintptr(uType),
uintptr(iDefault),
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(pszRegVal))),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // INTfunction SHMessageBoxCheckW(
hwnd: THandle; // HWND optional
pszText: PWideChar; // LPCWSTR
pszCaption: PWideChar; // LPCWSTR
uType: DWORD; // DWORD
iDefault: Integer; // INT
pszRegVal: PWideChar // LPCWSTR
): Integer; stdcall;
external 'SHLWAPI.dll' name 'SHMessageBoxCheckW';result := DllCall("SHLWAPI\SHMessageBoxCheckW"
, "Ptr", hwnd ; HWND optional
, "WStr", pszText ; LPCWSTR
, "WStr", pszCaption ; LPCWSTR
, "UInt", uType ; DWORD
, "Int", iDefault ; INT
, "WStr", pszRegVal ; LPCWSTR
, "Int") ; return: INT●SHMessageBoxCheckW(hwnd, pszText, pszCaption, uType, iDefault, pszRegVal) = DLL("SHLWAPI.dll", "int SHMessageBoxCheckW(void*, char*, char*, dword, int, char*)")
# 呼び出し: SHMessageBoxCheckW(hwnd, pszText, pszCaption, uType, iDefault, pszRegVal)
# hwnd : HWND optional -> "void*"
# pszText : LPCWSTR -> "char*"
# pszCaption : LPCWSTR -> "char*"
# uType : DWORD -> "dword"
# iDefault : INT -> "int"
# pszRegVal : LPCWSTR -> "char*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※-W(Unicode)関数。なでしこ1はANSIのため -A 版の利用を推奨。