SoftwareUpdateMessageBox
関数ソフトウェア更新を通知するメッセージボックスを表示する。
シグネチャ
// SHDOCVW.dll
#include <windows.h>
DWORD SoftwareUpdateMessageBox(
HWND hWnd, // optional
LPCWSTR pszDistUnit,
DWORD dwFlags,
SOFTDISTINFO* psdi // optional
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hWnd | HWND | inoptional |
| pszDistUnit | LPCWSTR | in |
| dwFlags | DWORD | in |
| psdi | SOFTDISTINFO* | outoptional |
戻り値の型: DWORD
各言語での呼び出し定義
// SHDOCVW.dll
#include <windows.h>
DWORD SoftwareUpdateMessageBox(
HWND hWnd, // optional
LPCWSTR pszDistUnit,
DWORD dwFlags,
SOFTDISTINFO* psdi // optional
);[DllImport("SHDOCVW.dll", ExactSpelling = true)]
static extern uint SoftwareUpdateMessageBox(
IntPtr hWnd, // HWND optional
[MarshalAs(UnmanagedType.LPWStr)] string pszDistUnit, // LPCWSTR
uint dwFlags, // DWORD
IntPtr psdi // SOFTDISTINFO* optional, out
);<DllImport("SHDOCVW.dll", ExactSpelling:=True)>
Public Shared Function SoftwareUpdateMessageBox(
hWnd As IntPtr, ' HWND optional
<MarshalAs(UnmanagedType.LPWStr)> pszDistUnit As String, ' LPCWSTR
dwFlags As UInteger, ' DWORD
psdi As IntPtr ' SOFTDISTINFO* optional, out
) As UInteger
End Function' hWnd : HWND optional
' pszDistUnit : LPCWSTR
' dwFlags : DWORD
' psdi : SOFTDISTINFO* optional, out
Declare PtrSafe Function SoftwareUpdateMessageBox Lib "shdocvw" ( _
ByVal hWnd As LongPtr, _
ByVal pszDistUnit As LongPtr, _
ByVal dwFlags As Long, _
ByVal psdi As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
SoftwareUpdateMessageBox = ctypes.windll.shdocvw.SoftwareUpdateMessageBox
SoftwareUpdateMessageBox.restype = wintypes.DWORD
SoftwareUpdateMessageBox.argtypes = [
wintypes.HANDLE, # hWnd : HWND optional
wintypes.LPCWSTR, # pszDistUnit : LPCWSTR
wintypes.DWORD, # dwFlags : DWORD
ctypes.c_void_p, # psdi : SOFTDISTINFO* optional, out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('SHDOCVW.dll')
SoftwareUpdateMessageBox = Fiddle::Function.new(
lib['SoftwareUpdateMessageBox'],
[
Fiddle::TYPE_VOIDP, # hWnd : HWND optional
Fiddle::TYPE_VOIDP, # pszDistUnit : LPCWSTR
-Fiddle::TYPE_INT, # dwFlags : DWORD
Fiddle::TYPE_VOIDP, # psdi : SOFTDISTINFO* optional, out
],
-Fiddle::TYPE_INT)#[link(name = "shdocvw")]
extern "system" {
fn SoftwareUpdateMessageBox(
hWnd: *mut core::ffi::c_void, // HWND optional
pszDistUnit: *const u16, // LPCWSTR
dwFlags: u32, // DWORD
psdi: *mut SOFTDISTINFO // SOFTDISTINFO* optional, out
) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("SHDOCVW.dll")]
public static extern uint SoftwareUpdateMessageBox(IntPtr hWnd, [MarshalAs(UnmanagedType.LPWStr)] string pszDistUnit, uint dwFlags, IntPtr psdi);
"@
$api = Add-Type -MemberDefinition $sig -Name 'SHDOCVW_SoftwareUpdateMessageBox' -Namespace Win32 -PassThru
# $api::SoftwareUpdateMessageBox(hWnd, pszDistUnit, dwFlags, psdi)#uselib "SHDOCVW.dll"
#func global SoftwareUpdateMessageBox "SoftwareUpdateMessageBox" sptr, sptr, sptr, sptr
; SoftwareUpdateMessageBox hWnd, pszDistUnit, dwFlags, varptr(psdi) ; 戻り値は stat
; hWnd : HWND optional -> "sptr"
; pszDistUnit : LPCWSTR -> "sptr"
; dwFlags : DWORD -> "sptr"
; psdi : SOFTDISTINFO* optional, out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "SHDOCVW.dll" #cfunc global SoftwareUpdateMessageBox "SoftwareUpdateMessageBox" sptr, wstr, int, var ; res = SoftwareUpdateMessageBox(hWnd, pszDistUnit, dwFlags, psdi) ; hWnd : HWND optional -> "sptr" ; pszDistUnit : LPCWSTR -> "wstr" ; dwFlags : DWORD -> "int" ; psdi : SOFTDISTINFO* optional, out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "SHDOCVW.dll" #cfunc global SoftwareUpdateMessageBox "SoftwareUpdateMessageBox" sptr, wstr, int, sptr ; res = SoftwareUpdateMessageBox(hWnd, pszDistUnit, dwFlags, varptr(psdi)) ; hWnd : HWND optional -> "sptr" ; pszDistUnit : LPCWSTR -> "wstr" ; dwFlags : DWORD -> "int" ; psdi : SOFTDISTINFO* optional, out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; DWORD SoftwareUpdateMessageBox(HWND hWnd, LPCWSTR pszDistUnit, DWORD dwFlags, SOFTDISTINFO* psdi) #uselib "SHDOCVW.dll" #cfunc global SoftwareUpdateMessageBox "SoftwareUpdateMessageBox" intptr, wstr, int, var ; res = SoftwareUpdateMessageBox(hWnd, pszDistUnit, dwFlags, psdi) ; hWnd : HWND optional -> "intptr" ; pszDistUnit : LPCWSTR -> "wstr" ; dwFlags : DWORD -> "int" ; psdi : SOFTDISTINFO* optional, out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; DWORD SoftwareUpdateMessageBox(HWND hWnd, LPCWSTR pszDistUnit, DWORD dwFlags, SOFTDISTINFO* psdi) #uselib "SHDOCVW.dll" #cfunc global SoftwareUpdateMessageBox "SoftwareUpdateMessageBox" intptr, wstr, int, intptr ; res = SoftwareUpdateMessageBox(hWnd, pszDistUnit, dwFlags, varptr(psdi)) ; hWnd : HWND optional -> "intptr" ; pszDistUnit : LPCWSTR -> "wstr" ; dwFlags : DWORD -> "int" ; psdi : SOFTDISTINFO* optional, out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
shdocvw = windows.NewLazySystemDLL("SHDOCVW.dll")
procSoftwareUpdateMessageBox = shdocvw.NewProc("SoftwareUpdateMessageBox")
)
// hWnd (HWND optional), pszDistUnit (LPCWSTR), dwFlags (DWORD), psdi (SOFTDISTINFO* optional, out)
r1, _, err := procSoftwareUpdateMessageBox.Call(
uintptr(hWnd),
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(pszDistUnit))),
uintptr(dwFlags),
uintptr(psdi),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // DWORDfunction SoftwareUpdateMessageBox(
hWnd: THandle; // HWND optional
pszDistUnit: PWideChar; // LPCWSTR
dwFlags: DWORD; // DWORD
psdi: Pointer // SOFTDISTINFO* optional, out
): DWORD; stdcall;
external 'SHDOCVW.dll' name 'SoftwareUpdateMessageBox';result := DllCall("SHDOCVW\SoftwareUpdateMessageBox"
, "Ptr", hWnd ; HWND optional
, "WStr", pszDistUnit ; LPCWSTR
, "UInt", dwFlags ; DWORD
, "Ptr", psdi ; SOFTDISTINFO* optional, out
, "UInt") ; return: DWORD●SoftwareUpdateMessageBox(hWnd, pszDistUnit, dwFlags, psdi) = DLL("SHDOCVW.dll", "dword SoftwareUpdateMessageBox(void*, char*, dword, void*)")
# 呼び出し: SoftwareUpdateMessageBox(hWnd, pszDistUnit, dwFlags, psdi)
# hWnd : HWND optional -> "void*"
# pszDistUnit : LPCWSTR -> "char*"
# dwFlags : DWORD -> "dword"
# psdi : SOFTDISTINFO* optional, out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。