Win32 API 日本語リファレンス
ホームUI.Controls › CreateStatusWindowA

CreateStatusWindowA

関数
ステータスウィンドウを作成する(ANSI版)。
DLLCOMCTL32.dll文字セットANSI (-A)呼出規約winapiSetLastErrorあり対応OSWindows Vista 以降

シグネチャ

// COMCTL32.dll  (ANSI / -A)
#include <windows.h>

HWND CreateStatusWindowA(
    INT style,
    LPCSTR lpszText,
    HWND hwndParent,
    DWORD wID
);

パラメーター

名前方向
styleINTin
lpszTextLPCSTRin
hwndParentHWNDin
wIDDWORDin

戻り値の型: HWND

各言語での呼び出し定義

// COMCTL32.dll  (ANSI / -A)
#include <windows.h>

HWND CreateStatusWindowA(
    INT style,
    LPCSTR lpszText,
    HWND hwndParent,
    DWORD wID
);
[DllImport("COMCTL32.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
static extern IntPtr CreateStatusWindowA(
    int style,   // INT
    [MarshalAs(UnmanagedType.LPStr)] string lpszText,   // LPCSTR
    IntPtr hwndParent,   // HWND
    uint wID   // DWORD
);
<DllImport("COMCTL32.dll", CharSet:=CharSet.Ansi, SetLastError:=True, ExactSpelling:=True)>
Public Shared Function CreateStatusWindowA(
    style As Integer,   ' INT
    <MarshalAs(UnmanagedType.LPStr)> lpszText As String,   ' LPCSTR
    hwndParent As IntPtr,   ' HWND
    wID As UInteger   ' DWORD
) As IntPtr
End Function
' style : INT
' lpszText : LPCSTR
' hwndParent : HWND
' wID : DWORD
Declare PtrSafe Function CreateStatusWindowA Lib "comctl32" ( _
    ByVal style As Long, _
    ByVal lpszText As String, _
    ByVal hwndParent As LongPtr, _
    ByVal wID As Long) As LongPtr
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

CreateStatusWindowA = ctypes.windll.comctl32.CreateStatusWindowA
CreateStatusWindowA.restype = ctypes.c_void_p
CreateStatusWindowA.argtypes = [
    ctypes.c_int,  # style : INT
    wintypes.LPCSTR,  # lpszText : LPCSTR
    wintypes.HANDLE,  # hwndParent : HWND
    wintypes.DWORD,  # wID : DWORD
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('COMCTL32.dll')
CreateStatusWindowA = Fiddle::Function.new(
  lib['CreateStatusWindowA'],
  [
    Fiddle::TYPE_INT,  # style : INT
    Fiddle::TYPE_VOIDP,  # lpszText : LPCSTR
    Fiddle::TYPE_VOIDP,  # hwndParent : HWND
    -Fiddle::TYPE_INT,  # wID : DWORD
  ],
  Fiddle::TYPE_VOIDP)
#[link(name = "comctl32")]
extern "system" {
    fn CreateStatusWindowA(
        style: i32,  // INT
        lpszText: *const u8,  // LPCSTR
        hwndParent: *mut core::ffi::c_void,  // HWND
        wID: u32  // DWORD
    ) -> *mut core::ffi::c_void;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("COMCTL32.dll", CharSet = CharSet.Ansi, SetLastError = true)]
public static extern IntPtr CreateStatusWindowA(int style, [MarshalAs(UnmanagedType.LPStr)] string lpszText, IntPtr hwndParent, uint wID);
"@
$api = Add-Type -MemberDefinition $sig -Name 'COMCTL32_CreateStatusWindowA' -Namespace Win32 -PassThru
# $api::CreateStatusWindowA(style, lpszText, hwndParent, wID)
#uselib "COMCTL32.dll"
#func global CreateStatusWindowA "CreateStatusWindowA" sptr, sptr, sptr, sptr
; CreateStatusWindowA style, lpszText, hwndParent, wID   ; 戻り値は stat
; style : INT -> "sptr"
; lpszText : LPCSTR -> "sptr"
; hwndParent : HWND -> "sptr"
; wID : DWORD -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "COMCTL32.dll"
#cfunc global CreateStatusWindowA "CreateStatusWindowA" int, str, sptr, int
; res = CreateStatusWindowA(style, lpszText, hwndParent, wID)
; style : INT -> "int"
; lpszText : LPCSTR -> "str"
; hwndParent : HWND -> "sptr"
; wID : DWORD -> "int"
; HWND CreateStatusWindowA(INT style, LPCSTR lpszText, HWND hwndParent, DWORD wID)
#uselib "COMCTL32.dll"
#cfunc global CreateStatusWindowA "CreateStatusWindowA" int, str, intptr, int
; res = CreateStatusWindowA(style, lpszText, hwndParent, wID)
; style : INT -> "int"
; lpszText : LPCSTR -> "str"
; hwndParent : HWND -> "intptr"
; wID : DWORD -> "int"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	comctl32 = windows.NewLazySystemDLL("COMCTL32.dll")
	procCreateStatusWindowA = comctl32.NewProc("CreateStatusWindowA")
)

// style (INT), lpszText (LPCSTR), hwndParent (HWND), wID (DWORD)
r1, _, err := procCreateStatusWindowA.Call(
	uintptr(style),
	uintptr(unsafe.Pointer(windows.BytePtrFromString(lpszText))),
	uintptr(hwndParent),
	uintptr(wID),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // HWND
function CreateStatusWindowA(
  style: Integer;   // INT
  lpszText: PAnsiChar;   // LPCSTR
  hwndParent: THandle;   // HWND
  wID: DWORD   // DWORD
): THandle; stdcall;
  external 'COMCTL32.dll' name 'CreateStatusWindowA';
result := DllCall("COMCTL32\CreateStatusWindowA"
    , "Int", style   ; INT
    , "AStr", lpszText   ; LPCSTR
    , "Ptr", hwndParent   ; HWND
    , "UInt", wID   ; DWORD
    , "Ptr")   ; return: HWND
●CreateStatusWindowA(style, lpszText, hwndParent, wID) = DLL("COMCTL32.dll", "void* CreateStatusWindowA(int, char*, void*, dword)")
# 呼び出し: CreateStatusWindowA(style, lpszText, hwndParent, wID)
# style : INT -> "int"
# lpszText : LPCSTR -> "char*"
# hwndParent : HWND -> "void*"
# wID : DWORD -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。