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

CreateStatusWindowW

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

シグネチャ

// COMCTL32.dll  (Unicode / -W)
#include <windows.h>

HWND CreateStatusWindowW(
    INT style,
    LPCWSTR lpszText,
    HWND hwndParent,
    DWORD wID
);

パラメーター

名前方向
styleINTin
lpszTextLPCWSTRin
hwndParentHWNDin
wIDDWORDin

戻り値の型: HWND

各言語での呼び出し定義

// COMCTL32.dll  (Unicode / -W)
#include <windows.h>

HWND CreateStatusWindowW(
    INT style,
    LPCWSTR lpszText,
    HWND hwndParent,
    DWORD wID
);
[DllImport("COMCTL32.dll", CharSet = CharSet.Unicode, SetLastError = true, ExactSpelling = true)]
static extern IntPtr CreateStatusWindowW(
    int style,   // INT
    [MarshalAs(UnmanagedType.LPWStr)] string lpszText,   // LPCWSTR
    IntPtr hwndParent,   // HWND
    uint wID   // DWORD
);
<DllImport("COMCTL32.dll", CharSet:=CharSet.Unicode, SetLastError:=True, ExactSpelling:=True)>
Public Shared Function CreateStatusWindowW(
    style As Integer,   ' INT
    <MarshalAs(UnmanagedType.LPWStr)> lpszText As String,   ' LPCWSTR
    hwndParent As IntPtr,   ' HWND
    wID As UInteger   ' DWORD
) As IntPtr
End Function
' style : INT
' lpszText : LPCWSTR
' hwndParent : HWND
' wID : DWORD
Declare PtrSafe Function CreateStatusWindowW Lib "comctl32" ( _
    ByVal style As Long, _
    ByVal lpszText As LongPtr, _
    ByVal hwndParent As LongPtr, _
    ByVal wID As Long) As LongPtr
' 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

CreateStatusWindowW = ctypes.windll.comctl32.CreateStatusWindowW
CreateStatusWindowW.restype = ctypes.c_void_p
CreateStatusWindowW.argtypes = [
    ctypes.c_int,  # style : INT
    wintypes.LPCWSTR,  # lpszText : LPCWSTR
    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')
CreateStatusWindowW = Fiddle::Function.new(
  lib['CreateStatusWindowW'],
  [
    Fiddle::TYPE_INT,  # style : INT
    Fiddle::TYPE_VOIDP,  # lpszText : LPCWSTR
    Fiddle::TYPE_VOIDP,  # hwndParent : HWND
    -Fiddle::TYPE_INT,  # wID : DWORD
  ],
  Fiddle::TYPE_VOIDP)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"
#[link(name = "comctl32")]
extern "system" {
    fn CreateStatusWindowW(
        style: i32,  // INT
        lpszText: *const u16,  // LPCWSTR
        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.Unicode, SetLastError = true)]
public static extern IntPtr CreateStatusWindowW(int style, [MarshalAs(UnmanagedType.LPWStr)] string lpszText, IntPtr hwndParent, uint wID);
"@
$api = Add-Type -MemberDefinition $sig -Name 'COMCTL32_CreateStatusWindowW' -Namespace Win32 -PassThru
# $api::CreateStatusWindowW(style, lpszText, hwndParent, wID)
#uselib "COMCTL32.dll"
#func global CreateStatusWindowW "CreateStatusWindowW" wptr, wptr, wptr, wptr
; CreateStatusWindowW style, lpszText, hwndParent, wID   ; 戻り値は stat
; style : INT -> "wptr"
; lpszText : LPCWSTR -> "wptr"
; hwndParent : HWND -> "wptr"
; wID : DWORD -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "COMCTL32.dll"
#cfunc global CreateStatusWindowW "CreateStatusWindowW" int, wstr, sptr, int
; res = CreateStatusWindowW(style, lpszText, hwndParent, wID)
; style : INT -> "int"
; lpszText : LPCWSTR -> "wstr"
; hwndParent : HWND -> "sptr"
; wID : DWORD -> "int"
; HWND CreateStatusWindowW(INT style, LPCWSTR lpszText, HWND hwndParent, DWORD wID)
#uselib "COMCTL32.dll"
#cfunc global CreateStatusWindowW "CreateStatusWindowW" int, wstr, intptr, int
; res = CreateStatusWindowW(style, lpszText, hwndParent, wID)
; style : INT -> "int"
; lpszText : LPCWSTR -> "wstr"
; hwndParent : HWND -> "intptr"
; wID : DWORD -> "int"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	comctl32 = windows.NewLazySystemDLL("COMCTL32.dll")
	procCreateStatusWindowW = comctl32.NewProc("CreateStatusWindowW")
)

// style (INT), lpszText (LPCWSTR), hwndParent (HWND), wID (DWORD)
r1, _, err := procCreateStatusWindowW.Call(
	uintptr(style),
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(lpszText))),
	uintptr(hwndParent),
	uintptr(wID),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // HWND
function CreateStatusWindowW(
  style: Integer;   // INT
  lpszText: PWideChar;   // LPCWSTR
  hwndParent: THandle;   // HWND
  wID: DWORD   // DWORD
): THandle; stdcall;
  external 'COMCTL32.dll' name 'CreateStatusWindowW';
result := DllCall("COMCTL32\CreateStatusWindowW"
    , "Int", style   ; INT
    , "WStr", lpszText   ; LPCWSTR
    , "Ptr", hwndParent   ; HWND
    , "UInt", wID   ; DWORD
    , "Ptr")   ; return: HWND
●CreateStatusWindowW(style, lpszText, hwndParent, wID) = DLL("COMCTL32.dll", "void* CreateStatusWindowW(int, char*, void*, dword)")
# 呼び出し: CreateStatusWindowW(style, lpszText, hwndParent, wID)
# style : INT -> "int"
# lpszText : LPCWSTR -> "char*"
# hwndParent : HWND -> "void*"
# wID : DWORD -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※-W(Unicode)関数。なでしこ1はANSIのため -A 版の利用を推奨。