ShellAboutA
関数シグネチャ
// SHELL32.dll (ANSI / -A)
#include <windows.h>
INT ShellAboutA(
HWND hWnd, // optional
LPCSTR szApp,
LPCSTR szOtherStuff, // optional
HICON hIcon // optional
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| hWnd | HWND | inoptional | 親ウィンドウのウィンドウハンドルです。このパラメーターは NULL にできます。 |
| szApp | LPCSTR | in | ShellAbout ダイアログボックスのタイトルバーと、ダイアログボックス内の "Microsoft" というテキストに続く 1 行目に表示されるテキストを格納する、null 終端文字列へのポインターです。テキストにセパレーター (#) が含まれていて 2 つの部分に分割される場合、この関数は前半部分をタイトルバーに、後半部分を "Microsoft" の後の 1 行目に表示します。 Windows 2000, Windows XP, Windows Server 2003: このパラメーターが指す文字列にセパレーター (#) が含まれている場合、その文字列は書き込み可能でなければなりません。 Windows Vista, Windows Server 2008: この文字列の長さは 200 文字を超えることはできません。szApp の内容は "Microsoft" の後には表示されなくなります。ただし # セパレーターがある場合は別で、その場合 # 以降の部分が 1 行目を完全に置き換えます。 |
| szOtherStuff | LPCSTR | inoptional | バージョンおよび著作権情報の後にダイアログボックスへ表示されるテキストを格納する、null 終端文字列へのポインターです。このパラメーターは NULL にできます。 |
| hIcon | HICON | inoptional | この関数がダイアログボックスに表示するアイコンのハンドルです。このパラメーターは NULL にでき、その場合この関数は Windows アイコンを表示します。 |
戻り値の型: INT
公式ドキュメント
ShellAbout ダイアログボックスを表示します。(ANSI)
戻り値
型: 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 (ANSI / -A)
#include <windows.h>
INT ShellAboutA(
HWND hWnd, // optional
LPCSTR szApp,
LPCSTR szOtherStuff, // optional
HICON hIcon // optional
);[DllImport("SHELL32.dll", CharSet = CharSet.Ansi, ExactSpelling = true)]
static extern int ShellAboutA(
IntPtr hWnd, // HWND optional
[MarshalAs(UnmanagedType.LPStr)] string szApp, // LPCSTR
[MarshalAs(UnmanagedType.LPStr)] string szOtherStuff, // LPCSTR optional
IntPtr hIcon // HICON optional
);<DllImport("SHELL32.dll", CharSet:=CharSet.Ansi, ExactSpelling:=True)>
Public Shared Function ShellAboutA(
hWnd As IntPtr, ' HWND optional
<MarshalAs(UnmanagedType.LPStr)> szApp As String, ' LPCSTR
<MarshalAs(UnmanagedType.LPStr)> szOtherStuff As String, ' LPCSTR optional
hIcon As IntPtr ' HICON optional
) As Integer
End Function' hWnd : HWND optional
' szApp : LPCSTR
' szOtherStuff : LPCSTR optional
' hIcon : HICON optional
Declare PtrSafe Function ShellAboutA Lib "shell32" ( _
ByVal hWnd As LongPtr, _
ByVal szApp As String, _
ByVal szOtherStuff As String, _
ByVal hIcon As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
ShellAboutA = ctypes.windll.shell32.ShellAboutA
ShellAboutA.restype = ctypes.c_int
ShellAboutA.argtypes = [
wintypes.HANDLE, # hWnd : HWND optional
wintypes.LPCSTR, # szApp : LPCSTR
wintypes.LPCSTR, # szOtherStuff : LPCSTR optional
wintypes.HANDLE, # hIcon : HICON optional
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('SHELL32.dll')
ShellAboutA = Fiddle::Function.new(
lib['ShellAboutA'],
[
Fiddle::TYPE_VOIDP, # hWnd : HWND optional
Fiddle::TYPE_VOIDP, # szApp : LPCSTR
Fiddle::TYPE_VOIDP, # szOtherStuff : LPCSTR optional
Fiddle::TYPE_VOIDP, # hIcon : HICON optional
],
Fiddle::TYPE_INT)#[link(name = "shell32")]
extern "system" {
fn ShellAboutA(
hWnd: *mut core::ffi::c_void, // HWND optional
szApp: *const u8, // LPCSTR
szOtherStuff: *const u8, // LPCSTR 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.Ansi)]
public static extern int ShellAboutA(IntPtr hWnd, [MarshalAs(UnmanagedType.LPStr)] string szApp, [MarshalAs(UnmanagedType.LPStr)] string szOtherStuff, IntPtr hIcon);
"@
$api = Add-Type -MemberDefinition $sig -Name 'SHELL32_ShellAboutA' -Namespace Win32 -PassThru
# $api::ShellAboutA(hWnd, szApp, szOtherStuff, hIcon)#uselib "SHELL32.dll"
#func global ShellAboutA "ShellAboutA" sptr, sptr, sptr, sptr
; ShellAboutA hWnd, szApp, szOtherStuff, hIcon ; 戻り値は stat
; hWnd : HWND optional -> "sptr"
; szApp : LPCSTR -> "sptr"
; szOtherStuff : LPCSTR optional -> "sptr"
; hIcon : HICON optional -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "SHELL32.dll"
#cfunc global ShellAboutA "ShellAboutA" sptr, str, str, sptr
; res = ShellAboutA(hWnd, szApp, szOtherStuff, hIcon)
; hWnd : HWND optional -> "sptr"
; szApp : LPCSTR -> "str"
; szOtherStuff : LPCSTR optional -> "str"
; hIcon : HICON optional -> "sptr"; INT ShellAboutA(HWND hWnd, LPCSTR szApp, LPCSTR szOtherStuff, HICON hIcon)
#uselib "SHELL32.dll"
#cfunc global ShellAboutA "ShellAboutA" intptr, str, str, intptr
; res = ShellAboutA(hWnd, szApp, szOtherStuff, hIcon)
; hWnd : HWND optional -> "intptr"
; szApp : LPCSTR -> "str"
; szOtherStuff : LPCSTR optional -> "str"
; hIcon : HICON optional -> "intptr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
shell32 = windows.NewLazySystemDLL("SHELL32.dll")
procShellAboutA = shell32.NewProc("ShellAboutA")
)
// hWnd (HWND optional), szApp (LPCSTR), szOtherStuff (LPCSTR optional), hIcon (HICON optional)
r1, _, err := procShellAboutA.Call(
uintptr(hWnd),
uintptr(unsafe.Pointer(windows.BytePtrFromString(szApp))),
uintptr(unsafe.Pointer(windows.BytePtrFromString(szOtherStuff))),
uintptr(hIcon),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // INTfunction ShellAboutA(
hWnd: THandle; // HWND optional
szApp: PAnsiChar; // LPCSTR
szOtherStuff: PAnsiChar; // LPCSTR optional
hIcon: THandle // HICON optional
): Integer; stdcall;
external 'SHELL32.dll' name 'ShellAboutA';result := DllCall("SHELL32\ShellAboutA"
, "Ptr", hWnd ; HWND optional
, "AStr", szApp ; LPCSTR
, "AStr", szOtherStuff ; LPCSTR optional
, "Ptr", hIcon ; HICON optional
, "Int") ; return: INT●ShellAboutA(hWnd, szApp, szOtherStuff, hIcon) = DLL("SHELL32.dll", "int ShellAboutA(void*, char*, char*, void*)")
# 呼び出し: ShellAboutA(hWnd, szApp, szOtherStuff, hIcon)
# hWnd : HWND optional -> "void*"
# szApp : LPCSTR -> "char*"
# szOtherStuff : LPCSTR optional -> "char*"
# hIcon : HICON optional -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "shell32" fn ShellAboutA(
hWnd: ?*anyopaque, // HWND optional
szApp: [*c]const u8, // LPCSTR
szOtherStuff: [*c]const u8, // LPCSTR optional
hIcon: ?*anyopaque // HICON optional
) callconv(std.os.windows.WINAPI) i32;proc ShellAboutA(
hWnd: pointer, # HWND optional
szApp: cstring, # LPCSTR
szOtherStuff: cstring, # LPCSTR optional
hIcon: pointer # HICON optional
): int32 {.importc: "ShellAboutA", stdcall, dynlib: "SHELL32.dll".}pragma(lib, "shell32");
extern(Windows)
int ShellAboutA(
void* hWnd, // HWND optional
const(char)* szApp, // LPCSTR
const(char)* szOtherStuff, // LPCSTR optional
void* hIcon // HICON optional
);ccall((:ShellAboutA, "SHELL32.dll"), stdcall, Int32,
(Ptr{Cvoid}, Cstring, Cstring, Ptr{Cvoid}),
hWnd, szApp, szOtherStuff, hIcon)
# hWnd : HWND optional -> Ptr{Cvoid}
# szApp : LPCSTR -> Cstring
# szOtherStuff : LPCSTR optional -> Cstring
# hIcon : HICON optional -> Ptr{Cvoid}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t ShellAboutA(
void* hWnd,
const char* szApp,
const char* szOtherStuff,
void* hIcon);
]]
local shell32 = ffi.load("shell32")
-- shell32.ShellAboutA(hWnd, szApp, szOtherStuff, hIcon)
-- hWnd : HWND optional
-- szApp : LPCSTR
-- szOtherStuff : LPCSTR optional
-- hIcon : HICON optional
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('SHELL32.dll');
const ShellAboutA = lib.func('__stdcall', 'ShellAboutA', 'int32_t', ['void *', 'str', 'str', 'void *']);
// ShellAboutA(hWnd, szApp, szOtherStuff, hIcon)
// hWnd : HWND optional -> 'void *'
// szApp : LPCSTR -> 'str'
// szOtherStuff : LPCSTR optional -> 'str'
// hIcon : HICON optional -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("SHELL32.dll", {
ShellAboutA: { parameters: ["pointer", "buffer", "buffer", "pointer"], result: "i32" },
});
// lib.symbols.ShellAboutA(hWnd, szApp, szOtherStuff, hIcon)
// hWnd : HWND optional -> "pointer"
// szApp : LPCSTR -> "buffer"
// szOtherStuff : LPCSTR optional -> "buffer"
// hIcon : HICON optional -> "pointer"
// 文字列は "buffer"。ANSI(-A) は new TextEncoder() で UTF-8/ANSI バイト列(末尾に \x00)を渡す。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t ShellAboutA(
void* hWnd,
const char* szApp,
const char* szOtherStuff,
void* hIcon);
C, "SHELL32.dll");
// $ffi->ShellAboutA(hWnd, szApp, szOtherStuff, hIcon);
// hWnd : HWND optional
// szApp : LPCSTR
// szOtherStuff : LPCSTR 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.ASCII_OPTIONS);
int ShellAboutA(
Pointer hWnd, // HWND optional
String szApp, // LPCSTR
String szOtherStuff, // LPCSTR optional
Pointer hIcon // HICON optional
);
}@[Link("shell32")]
lib LibSHELL32
fun ShellAboutA = ShellAboutA(
hWnd : Void*, # HWND optional
szApp : UInt8*, # LPCSTR
szOtherStuff : UInt8*, # LPCSTR 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 ShellAboutANative = Int32 Function(Pointer<Void>, Pointer<Utf8>, Pointer<Utf8>, Pointer<Void>);
typedef ShellAboutADart = int Function(Pointer<Void>, Pointer<Utf8>, Pointer<Utf8>, Pointer<Void>);
final ShellAboutA = DynamicLibrary.open('SHELL32.dll')
.lookupFunction<ShellAboutANative, ShellAboutADart>('ShellAboutA');
// hWnd : HWND optional -> Pointer<Void>
// szApp : LPCSTR -> Pointer<Utf8>
// szOtherStuff : LPCSTR optional -> Pointer<Utf8>
// hIcon : HICON optional -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function ShellAboutA(
hWnd: THandle; // HWND optional
szApp: PAnsiChar; // LPCSTR
szOtherStuff: PAnsiChar; // LPCSTR optional
hIcon: THandle // HICON optional
): Integer; stdcall;
external 'SHELL32.dll' name 'ShellAboutA';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "ShellAboutA"
c_ShellAboutA :: Ptr () -> CString -> CString -> Ptr () -> IO Int32
-- hWnd : HWND optional -> Ptr ()
-- szApp : LPCSTR -> CString
-- szOtherStuff : LPCSTR optional -> CString
-- hIcon : HICON optional -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let shellabouta =
foreign "ShellAboutA"
((ptr void) @-> string @-> string @-> (ptr void) @-> returning int32_t)
(* hWnd : HWND optional -> (ptr void) *)
(* szApp : LPCSTR -> string *)
(* szOtherStuff : LPCSTR optional -> string *)
(* 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 ("ShellAboutA" shell-about-a :convention :stdcall) :int32
(h-wnd :pointer) ; HWND optional
(sz-app :string) ; LPCSTR
(sz-other-stuff :string) ; LPCSTR optional
(h-icon :pointer)) ; HICON optional
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $ShellAboutA = Win32::API::More->new('SHELL32',
'int ShellAboutA(HANDLE hWnd, LPCSTR szApp, LPCSTR szOtherStuff, HANDLE hIcon)');
# my $ret = $ShellAboutA->Call($hWnd, $szApp, $szOtherStuff, $hIcon);
# hWnd : HWND optional -> HANDLE
# szApp : LPCSTR -> LPCSTR
# szOtherStuff : LPCSTR optional -> LPCSTR
# hIcon : HICON optional -> HANDLE
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。関連項目
- f ShellAboutW (Unicode版) — 標準のバージョン情報ダイアログ(Unicode)を表示する。