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

MsiSetInternalUI

関数
インストーラの内部UIの表示レベルを設定する。
DLLmsi.dll呼出規約winapi対応OSwindows8.0

シグネチャ

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

INSTALLUILEVEL MsiSetInternalUI(
    INSTALLUILEVEL dwUILevel,
    HWND* phWnd   // optional
);

パラメーター

名前方向説明
dwUILevelINSTALLUILEVELin

ユーザーインターフェイスの複雑さのレベルを指定します。このパラメーターには、次のいずれかの値を指定できます。

意味
INSTALLUILEVEL_FULL
ウィザード、進行状況、エラー表示を備えた作成済みのユーザーインターフェイス。
INSTALLUILEVEL_REDUCED
ウィザードのダイアログボックスを抑制した、作成済みのユーザーインターフェイス。
INSTALLUILEVEL_BASIC
単純な進行状況とエラー処理。
INSTALLUILEVEL_DEFAULT
インストーラーが適切なユーザーインターフェイスレベルを選択します。
INSTALLUILEVEL_NONE
完全にサイレントなインストール。これには、必要な場合でも昇格プロンプトを抑制することが含まれます。ユーザーが昇格できるようにしたい場合は INSTALLUILEVEL_UACONLY を参照してください。
INSTALLUILEVEL_ENDDIALOG
上記のいずれかの値と組み合わせると、インストーラーはインストールが成功したときまたはエラーが発生したときに、最後にモーダルダイアログボックスを表示します。ユーザーがキャンセルした場合はダイアログボックスは表示されません。
INSTALLUILEVEL_PROGRESSONLY
INSTALLUILEVEL_BASIC 値と組み合わせると、インストーラーは単純な進行状況ダイアログボックスを表示しますが、モーダルダイアログボックスやエラーダイアログボックスは一切表示しません。
INSTALLUILEVEL_NOCHANGE
UI レベルを変更しません。ただし、phWnd が Null でない場合は、親ウィンドウを変更できます。
INSTALLUILEVEL_HIDECANCEL
INSTALLUILEVEL_BASIC 値と組み合わせると、インストーラーは単純な進行状況ダイアログボックスを表示しますが、ダイアログ上に キャンセル ボタンを表示しません。これにより、ユーザーがインストールをキャンセルできなくなります。
INSTALLUILEVEL_SOURCERESONLY
この値を INSTALLUILEVEL_NONE 値と組み合わせると、インストーラーはソース解決に使用するダイアログボックスのみを表示します。その他のダイアログボックスは表示されません。UI レベルが INSTALLUILEVEL_NONE でない場合、この値は効果がありません。これは、ソース解決を除くすべての UI を処理するように設計された外部ユーザーインターフェイスとともに使用されます。この場合、ソース解決はインストーラーが処理します。
INSTALLUILEVEL_UACONLY
INSTALLUILEVEL_NONE 値と組み合わせると、必要な場合の昇格プロンプトを除いて、インストールは完全にサイレントになります。
phWndHWND*inoutoptionalウィンドウへのポインター。このウィンドウが、作成されるユーザーインターフェイスの所有者になります。ユーザーインターフェイスの以前の所有者へのポインターが返されます。このパラメーターが null の場合、ユーザーインターフェイスの所有者は変更されません。

戻り値の型: INSTALLUILEVEL

公式ドキュメント

MsiSetInternalUI 関数は、インストーラーの内部ユーザーインターフェイスを有効にします。これにより、このプロセス内で以降に呼び出されるユーザーインターフェイス生成系のインストーラー関数すべてで、このユーザーインターフェイスが使用されます。詳細については、User Interface Levels を参照してください。

戻り値

以前のユーザーインターフェイスレベルが返されます。無効な dwUILevel が渡された場合は、INSTALLUILEVEL_NOCHANGE が返されます。

解説(Remarks)

MsiSetInternalUI 関数は、インストーラーがユーザーインターフェイスを表示する必要がある場合に便利です。たとえば、ある機能をインストールするが、そのソースが挿入する必要のあるコンパクトディスクである場合、インストーラーはユーザーにコンパクトディスクを要求します。インストールの性質に応じて、アプリケーションは進行状況インジケーターを表示したり、ユーザーに情報を問い合わせたりすることもあります。

Msi.dll が読み込まれると、ユーザーインターフェイスレベルは DEFAULT に設定され、ユーザーインターフェイスの所有者は 0 に設定されます(つまり、最初のユーザーインターフェイスの所有者はデスクトップです)。

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

各言語での呼び出し定義

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

INSTALLUILEVEL MsiSetInternalUI(
    INSTALLUILEVEL dwUILevel,
    HWND* phWnd   // optional
);
[DllImport("msi.dll", ExactSpelling = true)]
static extern int MsiSetInternalUI(
    int dwUILevel,   // INSTALLUILEVEL
    IntPtr phWnd   // HWND* optional, in/out
);
<DllImport("msi.dll", ExactSpelling:=True)>
Public Shared Function MsiSetInternalUI(
    dwUILevel As Integer,   ' INSTALLUILEVEL
    phWnd As IntPtr   ' HWND* optional, in/out
) As Integer
End Function
' dwUILevel : INSTALLUILEVEL
' phWnd : HWND* optional, in/out
Declare PtrSafe Function MsiSetInternalUI Lib "msi" ( _
    ByVal dwUILevel As Long, _
    ByVal phWnd As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

MsiSetInternalUI = ctypes.windll.msi.MsiSetInternalUI
MsiSetInternalUI.restype = ctypes.c_int
MsiSetInternalUI.argtypes = [
    ctypes.c_int,  # dwUILevel : INSTALLUILEVEL
    ctypes.c_void_p,  # phWnd : HWND* optional, in/out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('msi.dll')
MsiSetInternalUI = Fiddle::Function.new(
  lib['MsiSetInternalUI'],
  [
    Fiddle::TYPE_INT,  # dwUILevel : INSTALLUILEVEL
    Fiddle::TYPE_VOIDP,  # phWnd : HWND* optional, in/out
  ],
  Fiddle::TYPE_INT)
#[link(name = "msi")]
extern "system" {
    fn MsiSetInternalUI(
        dwUILevel: i32,  // INSTALLUILEVEL
        phWnd: *mut *mut core::ffi::c_void  // HWND* optional, in/out
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("msi.dll")]
public static extern int MsiSetInternalUI(int dwUILevel, IntPtr phWnd);
"@
$api = Add-Type -MemberDefinition $sig -Name 'msi_MsiSetInternalUI' -Namespace Win32 -PassThru
# $api::MsiSetInternalUI(dwUILevel, phWnd)
#uselib "msi.dll"
#func global MsiSetInternalUI "MsiSetInternalUI" sptr, sptr
; MsiSetInternalUI dwUILevel, phWnd   ; 戻り値は stat
; dwUILevel : INSTALLUILEVEL -> "sptr"
; phWnd : HWND* optional, in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "msi.dll"
#cfunc global MsiSetInternalUI "MsiSetInternalUI" int, sptr
; res = MsiSetInternalUI(dwUILevel, phWnd)
; dwUILevel : INSTALLUILEVEL -> "int"
; phWnd : HWND* optional, in/out -> "sptr"
; INSTALLUILEVEL MsiSetInternalUI(INSTALLUILEVEL dwUILevel, HWND* phWnd)
#uselib "msi.dll"
#cfunc global MsiSetInternalUI "MsiSetInternalUI" int, intptr
; res = MsiSetInternalUI(dwUILevel, phWnd)
; dwUILevel : INSTALLUILEVEL -> "int"
; phWnd : HWND* optional, in/out -> "intptr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	msi = windows.NewLazySystemDLL("msi.dll")
	procMsiSetInternalUI = msi.NewProc("MsiSetInternalUI")
)

// dwUILevel (INSTALLUILEVEL), phWnd (HWND* optional, in/out)
r1, _, err := procMsiSetInternalUI.Call(
	uintptr(dwUILevel),
	uintptr(phWnd),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // INSTALLUILEVEL
function MsiSetInternalUI(
  dwUILevel: Integer;   // INSTALLUILEVEL
  phWnd: Pointer   // HWND* optional, in/out
): Integer; stdcall;
  external 'msi.dll' name 'MsiSetInternalUI';
result := DllCall("msi\MsiSetInternalUI"
    , "Int", dwUILevel   ; INSTALLUILEVEL
    , "Ptr", phWnd   ; HWND* optional, in/out
    , "Int")   ; return: INSTALLUILEVEL
●MsiSetInternalUI(dwUILevel, phWnd) = DLL("msi.dll", "int MsiSetInternalUI(int, void*)")
# 呼び出し: MsiSetInternalUI(dwUILevel, phWnd)
# dwUILevel : INSTALLUILEVEL -> "int"
# phWnd : HWND* optional, in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
const std = @import("std");

extern "msi" fn MsiSetInternalUI(
    dwUILevel: i32, // INSTALLUILEVEL
    phWnd: ?*anyopaque // HWND* optional, in/out
) callconv(std.os.windows.WINAPI) i32;
proc MsiSetInternalUI(
    dwUILevel: int32,  # INSTALLUILEVEL
    phWnd: pointer  # HWND* optional, in/out
): int32 {.importc: "MsiSetInternalUI", stdcall, dynlib: "msi.dll".}
pragma(lib, "msi");
extern(Windows)
int MsiSetInternalUI(
    int dwUILevel,   // INSTALLUILEVEL
    void* phWnd   // HWND* optional, in/out
);
ccall((:MsiSetInternalUI, "msi.dll"), stdcall, Int32,
      (Int32, Ptr{Cvoid}),
      dwUILevel, phWnd)
# dwUILevel : INSTALLUILEVEL -> Int32
# phWnd : HWND* optional, in/out -> Ptr{Cvoid}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
int32_t MsiSetInternalUI(
    int32_t dwUILevel,
    void* phWnd);
]]
local msi = ffi.load("msi")
-- msi.MsiSetInternalUI(dwUILevel, phWnd)
-- dwUILevel : INSTALLUILEVEL
-- phWnd : HWND* optional, in/out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('msi.dll');
const MsiSetInternalUI = lib.func('__stdcall', 'MsiSetInternalUI', 'int32_t', ['int32_t', 'void *']);
// MsiSetInternalUI(dwUILevel, phWnd)
// dwUILevel : INSTALLUILEVEL -> 'int32_t'
// phWnd : HWND* optional, in/out -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("msi.dll", {
  MsiSetInternalUI: { parameters: ["i32", "pointer"], result: "i32" },
});
// lib.symbols.MsiSetInternalUI(dwUILevel, phWnd)
// dwUILevel : INSTALLUILEVEL -> "i32"
// phWnd : HWND* optional, in/out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
int32_t MsiSetInternalUI(
    int32_t dwUILevel,
    void* phWnd);
C, "msi.dll");
// $ffi->MsiSetInternalUI(dwUILevel, phWnd);
// dwUILevel : INSTALLUILEVEL
// phWnd : HWND* optional, in/out
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
// WINAPI(stdcall): x64 では呼出規約が統一されるため問題なし。x86 では __stdcall 対応のラッパが必要な場合あり。
import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;

public interface Msi extends StdCallLibrary {
    Msi INSTANCE = Native.load("msi", Msi.class);
    int MsiSetInternalUI(
        int dwUILevel,   // INSTALLUILEVEL
        Pointer phWnd   // HWND* optional, in/out
    );
}
@[Link("msi")]
lib Libmsi
  fun MsiSetInternalUI = MsiSetInternalUI(
    dwUILevel : Int32,   # INSTALLUILEVEL
    phWnd : Void*   # HWND* optional, in/out
  ) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef MsiSetInternalUINative = Int32 Function(Int32, Pointer<Void>);
typedef MsiSetInternalUIDart = int Function(int, Pointer<Void>);
final MsiSetInternalUI = DynamicLibrary.open('msi.dll')
    .lookupFunction<MsiSetInternalUINative, MsiSetInternalUIDart>('MsiSetInternalUI');
// dwUILevel : INSTALLUILEVEL -> Int32
// phWnd : HWND* optional, in/out -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function MsiSetInternalUI(
  dwUILevel: Integer;   // INSTALLUILEVEL
  phWnd: Pointer   // HWND* optional, in/out
): Integer; stdcall;
  external 'msi.dll' name 'MsiSetInternalUI';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "MsiSetInternalUI"
  c_MsiSetInternalUI :: Int32 -> Ptr () -> IO Int32
-- dwUILevel : INSTALLUILEVEL -> Int32
-- phWnd : HWND* optional, in/out -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let msisetinternalui =
  foreign "MsiSetInternalUI"
    (int32_t @-> (ptr void) @-> returning int32_t)
(* dwUILevel : INSTALLUILEVEL -> int32_t *)
(* phWnd : HWND* optional, in/out -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library msi (t "msi.dll"))
(cffi:use-foreign-library msi)

(cffi:defcfun ("MsiSetInternalUI" msi-set-internal-ui :convention :stdcall) :int32
  (dw-uilevel :int32)   ; INSTALLUILEVEL
  (ph-wnd :pointer))   ; HWND* optional, in/out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $MsiSetInternalUI = Win32::API::More->new('msi',
    'int MsiSetInternalUI(int dwUILevel, HANDLE phWnd)');
# my $ret = $MsiSetInternalUI->Call($dwUILevel, $phWnd);
# dwUILevel : INSTALLUILEVEL -> int
# phWnd : HWND* optional, in/out -> HANDLE
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。

関連項目

使用する型