ホーム › UI.WindowsAndMessaging › CreateMDIWindowW
CreateMDIWindowW
関数MDI子ウィンドウを作成する(Unicode版)。
シグネチャ
// USER32.dll (Unicode / -W)
#include <windows.h>
HWND CreateMDIWindowW(
LPCWSTR lpClassName,
LPCWSTR lpWindowName,
WINDOW_STYLE dwStyle,
INT X,
INT Y,
INT nWidth,
INT nHeight,
HWND hWndParent, // optional
HINSTANCE hInstance, // optional
LPARAM lParam
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| lpClassName | LPCWSTR | in |
| lpWindowName | LPCWSTR | in |
| dwStyle | WINDOW_STYLE | in |
| X | INT | in |
| Y | INT | in |
| nWidth | INT | in |
| nHeight | INT | in |
| hWndParent | HWND | inoptional |
| hInstance | HINSTANCE | inoptional |
| lParam | LPARAM | in |
戻り値の型: HWND
各言語での呼び出し定義
// USER32.dll (Unicode / -W)
#include <windows.h>
HWND CreateMDIWindowW(
LPCWSTR lpClassName,
LPCWSTR lpWindowName,
WINDOW_STYLE dwStyle,
INT X,
INT Y,
INT nWidth,
INT nHeight,
HWND hWndParent, // optional
HINSTANCE hInstance, // optional
LPARAM lParam
);[DllImport("USER32.dll", CharSet = CharSet.Unicode, SetLastError = true, ExactSpelling = true)]
static extern IntPtr CreateMDIWindowW(
[MarshalAs(UnmanagedType.LPWStr)] string lpClassName, // LPCWSTR
[MarshalAs(UnmanagedType.LPWStr)] string lpWindowName, // LPCWSTR
uint dwStyle, // WINDOW_STYLE
int X, // INT
int Y, // INT
int nWidth, // INT
int nHeight, // INT
IntPtr hWndParent, // HWND optional
IntPtr hInstance, // HINSTANCE optional
IntPtr lParam // LPARAM
);<DllImport("USER32.dll", CharSet:=CharSet.Unicode, SetLastError:=True, ExactSpelling:=True)>
Public Shared Function CreateMDIWindowW(
<MarshalAs(UnmanagedType.LPWStr)> lpClassName As String, ' LPCWSTR
<MarshalAs(UnmanagedType.LPWStr)> lpWindowName As String, ' LPCWSTR
dwStyle As UInteger, ' WINDOW_STYLE
X As Integer, ' INT
Y As Integer, ' INT
nWidth As Integer, ' INT
nHeight As Integer, ' INT
hWndParent As IntPtr, ' HWND optional
hInstance As IntPtr, ' HINSTANCE optional
lParam As IntPtr ' LPARAM
) As IntPtr
End Function' lpClassName : LPCWSTR
' lpWindowName : LPCWSTR
' dwStyle : WINDOW_STYLE
' X : INT
' Y : INT
' nWidth : INT
' nHeight : INT
' hWndParent : HWND optional
' hInstance : HINSTANCE optional
' lParam : LPARAM
Declare PtrSafe Function CreateMDIWindowW Lib "user32" ( _
ByVal lpClassName As LongPtr, _
ByVal lpWindowName As LongPtr, _
ByVal dwStyle As Long, _
ByVal X As Long, _
ByVal Y As Long, _
ByVal nWidth As Long, _
ByVal nHeight As Long, _
ByVal hWndParent As LongPtr, _
ByVal hInstance As LongPtr, _
ByVal lParam As LongPtr) 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
CreateMDIWindowW = ctypes.windll.user32.CreateMDIWindowW
CreateMDIWindowW.restype = ctypes.c_void_p
CreateMDIWindowW.argtypes = [
wintypes.LPCWSTR, # lpClassName : LPCWSTR
wintypes.LPCWSTR, # lpWindowName : LPCWSTR
wintypes.DWORD, # dwStyle : WINDOW_STYLE
ctypes.c_int, # X : INT
ctypes.c_int, # Y : INT
ctypes.c_int, # nWidth : INT
ctypes.c_int, # nHeight : INT
wintypes.HANDLE, # hWndParent : HWND optional
wintypes.HANDLE, # hInstance : HINSTANCE optional
ctypes.c_ssize_t, # lParam : LPARAM
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('USER32.dll')
CreateMDIWindowW = Fiddle::Function.new(
lib['CreateMDIWindowW'],
[
Fiddle::TYPE_VOIDP, # lpClassName : LPCWSTR
Fiddle::TYPE_VOIDP, # lpWindowName : LPCWSTR
-Fiddle::TYPE_INT, # dwStyle : WINDOW_STYLE
Fiddle::TYPE_INT, # X : INT
Fiddle::TYPE_INT, # Y : INT
Fiddle::TYPE_INT, # nWidth : INT
Fiddle::TYPE_INT, # nHeight : INT
Fiddle::TYPE_VOIDP, # hWndParent : HWND optional
Fiddle::TYPE_VOIDP, # hInstance : HINSTANCE optional
Fiddle::TYPE_INTPTR_T, # lParam : LPARAM
],
Fiddle::TYPE_VOIDP)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"#[link(name = "user32")]
extern "system" {
fn CreateMDIWindowW(
lpClassName: *const u16, // LPCWSTR
lpWindowName: *const u16, // LPCWSTR
dwStyle: u32, // WINDOW_STYLE
X: i32, // INT
Y: i32, // INT
nWidth: i32, // INT
nHeight: i32, // INT
hWndParent: *mut core::ffi::c_void, // HWND optional
hInstance: *mut core::ffi::c_void, // HINSTANCE optional
lParam: isize // LPARAM
) -> *mut core::ffi::c_void;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("USER32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
public static extern IntPtr CreateMDIWindowW([MarshalAs(UnmanagedType.LPWStr)] string lpClassName, [MarshalAs(UnmanagedType.LPWStr)] string lpWindowName, uint dwStyle, int X, int Y, int nWidth, int nHeight, IntPtr hWndParent, IntPtr hInstance, IntPtr lParam);
"@
$api = Add-Type -MemberDefinition $sig -Name 'USER32_CreateMDIWindowW' -Namespace Win32 -PassThru
# $api::CreateMDIWindowW(lpClassName, lpWindowName, dwStyle, X, Y, nWidth, nHeight, hWndParent, hInstance, lParam)#uselib "USER32.dll"
#func global CreateMDIWindowW "CreateMDIWindowW" wptr, wptr, wptr, wptr, wptr, wptr, wptr, wptr, wptr, wptr
; CreateMDIWindowW lpClassName, lpWindowName, dwStyle, X, Y, nWidth, nHeight, hWndParent, hInstance, lParam ; 戻り値は stat
; lpClassName : LPCWSTR -> "wptr"
; lpWindowName : LPCWSTR -> "wptr"
; dwStyle : WINDOW_STYLE -> "wptr"
; X : INT -> "wptr"
; Y : INT -> "wptr"
; nWidth : INT -> "wptr"
; nHeight : INT -> "wptr"
; hWndParent : HWND optional -> "wptr"
; hInstance : HINSTANCE optional -> "wptr"
; lParam : LPARAM -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "USER32.dll"
#cfunc global CreateMDIWindowW "CreateMDIWindowW" wstr, wstr, int, int, int, int, int, sptr, sptr, sptr
; res = CreateMDIWindowW(lpClassName, lpWindowName, dwStyle, X, Y, nWidth, nHeight, hWndParent, hInstance, lParam)
; lpClassName : LPCWSTR -> "wstr"
; lpWindowName : LPCWSTR -> "wstr"
; dwStyle : WINDOW_STYLE -> "int"
; X : INT -> "int"
; Y : INT -> "int"
; nWidth : INT -> "int"
; nHeight : INT -> "int"
; hWndParent : HWND optional -> "sptr"
; hInstance : HINSTANCE optional -> "sptr"
; lParam : LPARAM -> "sptr"; HWND CreateMDIWindowW(LPCWSTR lpClassName, LPCWSTR lpWindowName, WINDOW_STYLE dwStyle, INT X, INT Y, INT nWidth, INT nHeight, HWND hWndParent, HINSTANCE hInstance, LPARAM lParam)
#uselib "USER32.dll"
#cfunc global CreateMDIWindowW "CreateMDIWindowW" wstr, wstr, int, int, int, int, int, intptr, intptr, intptr
; res = CreateMDIWindowW(lpClassName, lpWindowName, dwStyle, X, Y, nWidth, nHeight, hWndParent, hInstance, lParam)
; lpClassName : LPCWSTR -> "wstr"
; lpWindowName : LPCWSTR -> "wstr"
; dwStyle : WINDOW_STYLE -> "int"
; X : INT -> "int"
; Y : INT -> "int"
; nWidth : INT -> "int"
; nHeight : INT -> "int"
; hWndParent : HWND optional -> "intptr"
; hInstance : HINSTANCE optional -> "intptr"
; lParam : LPARAM -> "intptr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
user32 = windows.NewLazySystemDLL("USER32.dll")
procCreateMDIWindowW = user32.NewProc("CreateMDIWindowW")
)
// lpClassName (LPCWSTR), lpWindowName (LPCWSTR), dwStyle (WINDOW_STYLE), X (INT), Y (INT), nWidth (INT), nHeight (INT), hWndParent (HWND optional), hInstance (HINSTANCE optional), lParam (LPARAM)
r1, _, err := procCreateMDIWindowW.Call(
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(lpClassName))),
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(lpWindowName))),
uintptr(dwStyle),
uintptr(X),
uintptr(Y),
uintptr(nWidth),
uintptr(nHeight),
uintptr(hWndParent),
uintptr(hInstance),
uintptr(lParam),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HWNDfunction CreateMDIWindowW(
lpClassName: PWideChar; // LPCWSTR
lpWindowName: PWideChar; // LPCWSTR
dwStyle: DWORD; // WINDOW_STYLE
X: Integer; // INT
Y: Integer; // INT
nWidth: Integer; // INT
nHeight: Integer; // INT
hWndParent: THandle; // HWND optional
hInstance: THandle; // HINSTANCE optional
lParam: NativeInt // LPARAM
): THandle; stdcall;
external 'USER32.dll' name 'CreateMDIWindowW';result := DllCall("USER32\CreateMDIWindowW"
, "WStr", lpClassName ; LPCWSTR
, "WStr", lpWindowName ; LPCWSTR
, "UInt", dwStyle ; WINDOW_STYLE
, "Int", X ; INT
, "Int", Y ; INT
, "Int", nWidth ; INT
, "Int", nHeight ; INT
, "Ptr", hWndParent ; HWND optional
, "Ptr", hInstance ; HINSTANCE optional
, "Ptr", lParam ; LPARAM
, "Ptr") ; return: HWND●CreateMDIWindowW(lpClassName, lpWindowName, dwStyle, X, Y, nWidth, nHeight, hWndParent, hInstance, lParam) = DLL("USER32.dll", "void* CreateMDIWindowW(char*, char*, dword, int, int, int, int, void*, void*, int)")
# 呼び出し: CreateMDIWindowW(lpClassName, lpWindowName, dwStyle, X, Y, nWidth, nHeight, hWndParent, hInstance, lParam)
# lpClassName : LPCWSTR -> "char*"
# lpWindowName : LPCWSTR -> "char*"
# dwStyle : WINDOW_STYLE -> "dword"
# X : INT -> "int"
# Y : INT -> "int"
# nWidth : INT -> "int"
# nHeight : INT -> "int"
# hWndParent : HWND optional -> "void*"
# hInstance : HINSTANCE optional -> "void*"
# lParam : LPARAM -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※-W(Unicode)関数。なでしこ1はANSIのため -A 版の利用を推奨。