ShellAboutW
関数シグネチャ
// SHELL32.dll (Unicode / -W)
#include <windows.h>
INT ShellAboutW(
HWND hWnd, // optional
LPCWSTR szApp,
LPCWSTR szOtherStuff, // optional
HICON hIcon // optional
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| hWnd | HWND | inoptional | 親ウィンドウのウィンドウ ハンドルです。このパラメーターには NULL を指定できます。 |
| szApp | LPCWSTR | in | ShellAbout ダイアログ ボックスのタイトル バー、およびダイアログ ボックスの 1 行目の "Microsoft" というテキストの後に表示するテキストを格納した、null 終端文字列へのポインターです。テキストにそれを 2 つの部分に分割する区切り記号 (#) が含まれている場合、この関数は前半部分をタイトル バーに、後半部分を "Microsoft" というテキストの後の 1 行目に表示します。 Windows 2000、Windows XP、Windows Server 2003: このパラメーターが指す文字列に区切り記号 (#) が含まれている場合、その文字列は書き込み可能でなければなりません。 Windows Vista、Windows Server 2008: この文字列の長さは 200 文字を超えることはできません。szApp の内容は "Microsoft" の後には表示されなくなります。ただし # 区切り記号がある場合は例外で、その場合 # の後の部分が 1 行目を完全に置き換えます。 |
| szOtherStuff | LPCWSTR | inoptional | ダイアログ ボックスのバージョン情報と著作権情報の後に表示するテキストを格納した、null 終端文字列へのポインターです。このパラメーターには NULL を指定できます。 |
| hIcon | HICON | inoptional | 関数がダイアログ ボックスに表示するアイコンのハンドルです。このパラメーターには NULL を指定でき、その場合、関数は Windows アイコンを表示します。 |
戻り値の型: INT
公式ドキュメント
ShellAbout ダイアログ ボックスを表示します。(Unicode)
戻り値
型: int
成功した場合は TRUE、それ以外の場合は FALSE です。
解説(Remarks)
ShellAbout 関数のダイアログ ボックスでは、Windows に固有のテキストと既定のアイコンが使用されることに注意してください。
ShellAbout ダイアログ ボックスの例を確認するには、winver.exe コマンドを実行してください。
shellapi.h ヘッダーは ShellAbout を、UNICODE プリプロセッサ定数の定義に基づいてこの関数の ANSI 版または Unicode 版を自動的に選択するエイリアスとして定義します。エンコーディング ニュートラルなエイリアスの使用と、エンコーディング ニュートラルでないコードを混在させると、不一致が生じ、コンパイル エラーや実行時エラーを引き起こす可能性があります。詳細については、「Conventions for Function Prototypes」を参照してください。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
各言語での呼び出し定義
// SHELL32.dll (Unicode / -W)
#include <windows.h>
INT ShellAboutW(
HWND hWnd, // optional
LPCWSTR szApp,
LPCWSTR szOtherStuff, // optional
HICON hIcon // optional
);[DllImport("SHELL32.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
static extern int ShellAboutW(
IntPtr hWnd, // HWND optional
[MarshalAs(UnmanagedType.LPWStr)] string szApp, // LPCWSTR
[MarshalAs(UnmanagedType.LPWStr)] string szOtherStuff, // LPCWSTR optional
IntPtr hIcon // HICON optional
);<DllImport("SHELL32.dll", CharSet:=CharSet.Unicode, ExactSpelling:=True)>
Public Shared Function ShellAboutW(
hWnd As IntPtr, ' HWND optional
<MarshalAs(UnmanagedType.LPWStr)> szApp As String, ' LPCWSTR
<MarshalAs(UnmanagedType.LPWStr)> szOtherStuff As String, ' LPCWSTR optional
hIcon As IntPtr ' HICON optional
) As Integer
End Function' hWnd : HWND optional
' szApp : LPCWSTR
' szOtherStuff : LPCWSTR optional
' hIcon : HICON optional
Declare PtrSafe Function ShellAboutW Lib "shell32" ( _
ByVal hWnd As LongPtr, _
ByVal szApp As LongPtr, _
ByVal szOtherStuff As LongPtr, _
ByVal hIcon 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
ShellAboutW = ctypes.windll.shell32.ShellAboutW
ShellAboutW.restype = ctypes.c_int
ShellAboutW.argtypes = [
wintypes.HANDLE, # hWnd : HWND optional
wintypes.LPCWSTR, # szApp : LPCWSTR
wintypes.LPCWSTR, # szOtherStuff : LPCWSTR optional
wintypes.HANDLE, # hIcon : HICON optional
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('SHELL32.dll')
ShellAboutW = Fiddle::Function.new(
lib['ShellAboutW'],
[
Fiddle::TYPE_VOIDP, # hWnd : HWND optional
Fiddle::TYPE_VOIDP, # szApp : LPCWSTR
Fiddle::TYPE_VOIDP, # szOtherStuff : LPCWSTR optional
Fiddle::TYPE_VOIDP, # hIcon : HICON optional
],
Fiddle::TYPE_INT)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"#[link(name = "shell32")]
extern "system" {
fn ShellAboutW(
hWnd: *mut core::ffi::c_void, // HWND optional
szApp: *const u16, // LPCWSTR
szOtherStuff: *const u16, // LPCWSTR optional
hIcon: *mut core::ffi::c_void // HICON optional
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("SHELL32.dll", CharSet = CharSet.Unicode)]
public static extern int ShellAboutW(IntPtr hWnd, [MarshalAs(UnmanagedType.LPWStr)] string szApp, [MarshalAs(UnmanagedType.LPWStr)] string szOtherStuff, IntPtr hIcon);
"@
$api = Add-Type -MemberDefinition $sig -Name 'SHELL32_ShellAboutW' -Namespace Win32 -PassThru
# $api::ShellAboutW(hWnd, szApp, szOtherStuff, hIcon)#uselib "SHELL32.dll"
#func global ShellAboutW "ShellAboutW" wptr, wptr, wptr, wptr
; ShellAboutW hWnd, szApp, szOtherStuff, hIcon ; 戻り値は stat
; hWnd : HWND optional -> "wptr"
; szApp : LPCWSTR -> "wptr"
; szOtherStuff : LPCWSTR optional -> "wptr"
; hIcon : HICON optional -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "SHELL32.dll"
#cfunc global ShellAboutW "ShellAboutW" sptr, wstr, wstr, sptr
; res = ShellAboutW(hWnd, szApp, szOtherStuff, hIcon)
; hWnd : HWND optional -> "sptr"
; szApp : LPCWSTR -> "wstr"
; szOtherStuff : LPCWSTR optional -> "wstr"
; hIcon : HICON optional -> "sptr"; INT ShellAboutW(HWND hWnd, LPCWSTR szApp, LPCWSTR szOtherStuff, HICON hIcon)
#uselib "SHELL32.dll"
#cfunc global ShellAboutW "ShellAboutW" intptr, wstr, wstr, intptr
; res = ShellAboutW(hWnd, szApp, szOtherStuff, hIcon)
; hWnd : HWND optional -> "intptr"
; szApp : LPCWSTR -> "wstr"
; szOtherStuff : LPCWSTR optional -> "wstr"
; hIcon : HICON optional -> "intptr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
shell32 = windows.NewLazySystemDLL("SHELL32.dll")
procShellAboutW = shell32.NewProc("ShellAboutW")
)
// hWnd (HWND optional), szApp (LPCWSTR), szOtherStuff (LPCWSTR optional), hIcon (HICON optional)
r1, _, err := procShellAboutW.Call(
uintptr(hWnd),
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(szApp))),
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(szOtherStuff))),
uintptr(hIcon),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // INTfunction ShellAboutW(
hWnd: THandle; // HWND optional
szApp: PWideChar; // LPCWSTR
szOtherStuff: PWideChar; // LPCWSTR optional
hIcon: THandle // HICON optional
): Integer; stdcall;
external 'SHELL32.dll' name 'ShellAboutW';result := DllCall("SHELL32\ShellAboutW"
, "Ptr", hWnd ; HWND optional
, "WStr", szApp ; LPCWSTR
, "WStr", szOtherStuff ; LPCWSTR optional
, "Ptr", hIcon ; HICON optional
, "Int") ; return: INT●ShellAboutW(hWnd, szApp, szOtherStuff, hIcon) = DLL("SHELL32.dll", "int ShellAboutW(void*, char*, char*, void*)")
# 呼び出し: ShellAboutW(hWnd, szApp, szOtherStuff, hIcon)
# hWnd : HWND optional -> "void*"
# szApp : LPCWSTR -> "char*"
# szOtherStuff : LPCWSTR optional -> "char*"
# hIcon : HICON optional -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※-W(Unicode)関数。なでしこ1はANSIのため -A 版の利用を推奨。const std = @import("std");
extern "shell32" fn ShellAboutW(
hWnd: ?*anyopaque, // HWND optional
szApp: [*c]const u16, // LPCWSTR
szOtherStuff: [*c]const u16, // LPCWSTR optional
hIcon: ?*anyopaque // HICON optional
) callconv(std.os.windows.WINAPI) i32;
// Unicode(-W): UTF-16LE のヌル終端バッファ([*c]const u16)を渡す。proc ShellAboutW(
hWnd: pointer, # HWND optional
szApp: WideCString, # LPCWSTR
szOtherStuff: WideCString, # LPCWSTR optional
hIcon: pointer # HICON optional
): int32 {.importc: "ShellAboutW", stdcall, dynlib: "SHELL32.dll".}
# Unicode(-W): WideCString は newWideCString("...") で生成。pragma(lib, "shell32");
extern(Windows)
int ShellAboutW(
void* hWnd, // HWND optional
const(wchar)* szApp, // LPCWSTR
const(wchar)* szOtherStuff, // LPCWSTR optional
void* hIcon // HICON optional
);ccall((:ShellAboutW, "SHELL32.dll"), stdcall, Int32,
(Ptr{Cvoid}, Cwstring, Cwstring, Ptr{Cvoid}),
hWnd, szApp, szOtherStuff, hIcon)
# hWnd : HWND optional -> Ptr{Cvoid}
# szApp : LPCWSTR -> Cwstring
# szOtherStuff : LPCWSTR optional -> Cwstring
# hIcon : HICON optional -> Ptr{Cvoid}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
# Unicode(-W): Cwstring には transcode(UInt16, "...") 等で UTF-16 を渡す。local ffi = require("ffi")
ffi.cdef[[
int32_t ShellAboutW(
void* hWnd,
const uint16_t* szApp,
const uint16_t* szOtherStuff,
void* hIcon);
]]
local shell32 = ffi.load("shell32")
-- shell32.ShellAboutW(hWnd, szApp, szOtherStuff, hIcon)
-- hWnd : HWND optional
-- szApp : LPCWSTR
-- szOtherStuff : LPCWSTR optional
-- hIcon : HICON optional
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
-- Unicode(-W): uint16_t* には UTF-16LE のバッファ(ffi.new("uint16_t[?]", ...))を渡す。const koffi = require('koffi');
const lib = koffi.load('SHELL32.dll');
const ShellAboutW = lib.func('__stdcall', 'ShellAboutW', 'int32_t', ['void *', 'str16', 'str16', 'void *']);
// ShellAboutW(hWnd, szApp, szOtherStuff, hIcon)
// hWnd : HWND optional -> 'void *'
// szApp : LPCWSTR -> 'str16'
// szOtherStuff : LPCWSTR optional -> 'str16'
// hIcon : HICON optional -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("SHELL32.dll", {
ShellAboutW: { parameters: ["pointer", "buffer", "buffer", "pointer"], result: "i32" },
});
// lib.symbols.ShellAboutW(hWnd, szApp, szOtherStuff, hIcon)
// hWnd : HWND optional -> "pointer"
// szApp : LPCWSTR -> "buffer"
// szOtherStuff : LPCWSTR optional -> "buffer"
// hIcon : HICON optional -> "pointer"
// 文字列は "buffer"。Unicode(-W) は new TextEncoder() ではなく UTF-16LE のバイト列(末尾に \x00\x00)を Uint8Array で渡す。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t ShellAboutW(
void* hWnd,
const uint16_t* szApp,
const uint16_t* szOtherStuff,
void* hIcon);
C, "SHELL32.dll");
// $ffi->ShellAboutW(hWnd, szApp, szOtherStuff, hIcon);
// hWnd : HWND optional
// szApp : LPCWSTR
// szOtherStuff : LPCWSTR optional
// hIcon : HICON optional
// 構造体/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 Shell32 extends StdCallLibrary {
Shell32 INSTANCE = Native.load("shell32", Shell32.class, W32APIOptions.UNICODE_OPTIONS);
int ShellAboutW(
Pointer hWnd, // HWND optional
WString szApp, // LPCWSTR
WString szOtherStuff, // LPCWSTR optional
Pointer hIcon // HICON optional
);
}
// Unicode(-W): WString(入力)/char[](出力)で UTF-16 をマーシャリング。@[Link("shell32")]
lib LibSHELL32
fun ShellAboutW = ShellAboutW(
hWnd : Void*, # HWND optional
szApp : UInt16*, # LPCWSTR
szOtherStuff : UInt16*, # LPCWSTR optional
hIcon : Void* # HICON optional
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef ShellAboutWNative = Int32 Function(Pointer<Void>, Pointer<Utf16>, Pointer<Utf16>, Pointer<Void>);
typedef ShellAboutWDart = int Function(Pointer<Void>, Pointer<Utf16>, Pointer<Utf16>, Pointer<Void>);
final ShellAboutW = DynamicLibrary.open('SHELL32.dll')
.lookupFunction<ShellAboutWNative, ShellAboutWDart>('ShellAboutW');
// hWnd : HWND optional -> Pointer<Void>
// szApp : LPCWSTR -> Pointer<Utf16>
// szOtherStuff : LPCWSTR optional -> Pointer<Utf16>
// hIcon : HICON optional -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function ShellAboutW(
hWnd: THandle; // HWND optional
szApp: PWideChar; // LPCWSTR
szOtherStuff: PWideChar; // LPCWSTR optional
hIcon: THandle // HICON optional
): Integer; stdcall;
external 'SHELL32.dll' name 'ShellAboutW';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "ShellAboutW"
c_ShellAboutW :: Ptr () -> CWString -> CWString -> Ptr () -> IO Int32
-- hWnd : HWND optional -> Ptr ()
-- szApp : LPCWSTR -> CWString
-- szOtherStuff : LPCWSTR optional -> CWString
-- hIcon : HICON optional -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let shellaboutw =
foreign "ShellAboutW"
((ptr void) @-> (ptr uint16_t) @-> (ptr uint16_t) @-> (ptr void) @-> returning int32_t)
(* hWnd : HWND optional -> (ptr void) *)
(* szApp : LPCWSTR -> (ptr uint16_t) *)
(* szOtherStuff : LPCWSTR optional -> (ptr uint16_t) *)
(* hIcon : HICON optional -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library shell32 (t "SHELL32.dll"))
(cffi:use-foreign-library shell32)
(cffi:defcfun ("ShellAboutW" shell-about-w :convention :stdcall) :int32
(h-wnd :pointer) ; HWND optional
(sz-app (:string :encoding :utf-16le)) ; LPCWSTR
(sz-other-stuff (:string :encoding :utf-16le)) ; LPCWSTR optional
(h-icon :pointer)) ; HICON optional
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $ShellAboutW = Win32::API::More->new('SHELL32',
'int ShellAboutW(HANDLE hWnd, LPCWSTR szApp, LPCWSTR szOtherStuff, HANDLE hIcon)');
# my $ret = $ShellAboutW->Call($hWnd, $szApp, $szOtherStuff, $hIcon);
# hWnd : HWND optional -> HANDLE
# szApp : LPCWSTR -> LPCWSTR
# szOtherStuff : LPCWSTR optional -> LPCWSTR
# hIcon : HICON optional -> HANDLE
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。
# Unicode(-W): LPCWSTR/LPWSTR は Win32::API が UTF-16 変換を行う。関連項目
- f ShellAboutA (ANSI版) — 標準のバージョン情報ダイアログ(ANSI)を表示する。