ホーム › UI.WindowsAndMessaging › CreateMDIWindowA
CreateMDIWindowA
関数MDI子ウィンドウを作成する(ANSI版)。
シグネチャ
// USER32.dll (ANSI / -A)
#include <windows.h>
HWND CreateMDIWindowA(
LPCSTR lpClassName,
LPCSTR lpWindowName,
WINDOW_STYLE dwStyle,
INT X,
INT Y,
INT nWidth,
INT nHeight,
HWND hWndParent, // optional
HINSTANCE hInstance, // optional
LPARAM lParam
);パラメーター
| 名前 | 型 | 方向 | 説明 | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| lpClassName | LPCSTR | in | MDI 子ウィンドウのウィンドウクラスです。クラス名は、RegisterClassEx 関数の呼び出しによって登録済みである必要があります。 | ||||||||||
| lpWindowName | LPCSTR | in | ウィンドウ名です。システムはこの名前を子ウィンドウのタイトルバーに表示します。 | ||||||||||
| dwStyle | WINDOW_STYLE | in | MDI 子ウィンドウのスタイルです。MDI クライアントウィンドウが MDIS_ALLCHILDSTYLES ウィンドウスタイルを指定して作成されている場合、このパラメーターには Window Styles ページに記載されているウィンドウスタイルの任意の組み合わせを指定できます。それ以外の場合、このパラメーターは次の値の 1 つ以上に限定されます。
| ||||||||||
| X | INT | in | MDI 子ウィンドウの初期の水平位置 (クライアント座標) です。このパラメーターが CW_USEDEFAULT ((int)0x80000000) の場合、MDI 子ウィンドウには既定の水平位置が割り当てられます。 | ||||||||||
| Y | INT | in | MDI 子ウィンドウの初期の垂直位置 (クライアント座標) です。このパラメーターが CW_USEDEFAULT の場合、MDI 子ウィンドウには既定の垂直位置が割り当てられます。 | ||||||||||
| nWidth | INT | in | MDI 子ウィンドウの初期の幅 (デバイス単位) です。このパラメーターが CW_USEDEFAULT の場合、MDI 子ウィンドウには既定の幅が割り当てられます。 | ||||||||||
| nHeight | INT | in | MDI 子ウィンドウの初期の高さ (デバイス単位) です。このパラメーターが CW_USEDEFAULT に設定されている場合、MDI 子ウィンドウには既定の高さが割り当てられます。 | ||||||||||
| hWndParent | HWND | inoptional | 新しい MDI 子ウィンドウの親となる MDI クライアントウィンドウへのハンドルです。 | ||||||||||
| hInstance | HINSTANCE | inoptional | MDI 子ウィンドウを作成するアプリケーションのインスタンスへのハンドルです。 | ||||||||||
| lParam | LPARAM | in | アプリケーション定義の値です。 |
戻り値の型: HWND
公式ドキュメント
マルチドキュメントインターフェイス (MDI) の子ウィンドウを作成します。(ANSI)
戻り値
型: HWND
関数が成功した場合、戻り値は作成されたウィンドウのハンドルです。
関数が失敗した場合、戻り値は NULL です。拡張エラー情報を取得するには、GetLastError を呼び出します。
解説(Remarks)
メモ
winuser.h ヘッダーは、UNICODE プリプロセッサ定数の定義に基づいてこの関数の ANSI 版または Unicode 版を自動的に選択するエイリアスとして CreateMDIWindow を定義しています。エンコーディング中立のエイリアスを、エンコーディング中立でないコードと混在させて使用すると、不一致が生じ、コンパイルエラーや実行時エラーを引き起こす可能性があります。詳細については、Conventions for Function Prototypes を参照してください。
出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
各言語での呼び出し定義
// USER32.dll (ANSI / -A)
#include <windows.h>
HWND CreateMDIWindowA(
LPCSTR lpClassName,
LPCSTR 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.Ansi, SetLastError = true, ExactSpelling = true)]
static extern IntPtr CreateMDIWindowA(
[MarshalAs(UnmanagedType.LPStr)] string lpClassName, // LPCSTR
[MarshalAs(UnmanagedType.LPStr)] string lpWindowName, // LPCSTR
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.Ansi, SetLastError:=True, ExactSpelling:=True)>
Public Shared Function CreateMDIWindowA(
<MarshalAs(UnmanagedType.LPStr)> lpClassName As String, ' LPCSTR
<MarshalAs(UnmanagedType.LPStr)> lpWindowName As String, ' LPCSTR
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 : LPCSTR
' lpWindowName : LPCSTR
' dwStyle : WINDOW_STYLE
' X : INT
' Y : INT
' nWidth : INT
' nHeight : INT
' hWndParent : HWND optional
' hInstance : HINSTANCE optional
' lParam : LPARAM
Declare PtrSafe Function CreateMDIWindowA Lib "user32" ( _
ByVal lpClassName As String, _
ByVal lpWindowName As String, _
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
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
CreateMDIWindowA = ctypes.windll.user32.CreateMDIWindowA
CreateMDIWindowA.restype = ctypes.c_void_p
CreateMDIWindowA.argtypes = [
wintypes.LPCSTR, # lpClassName : LPCSTR
wintypes.LPCSTR, # lpWindowName : LPCSTR
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')
CreateMDIWindowA = Fiddle::Function.new(
lib['CreateMDIWindowA'],
[
Fiddle::TYPE_VOIDP, # lpClassName : LPCSTR
Fiddle::TYPE_VOIDP, # lpWindowName : LPCSTR
-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)#[link(name = "user32")]
extern "system" {
fn CreateMDIWindowA(
lpClassName: *const u8, // LPCSTR
lpWindowName: *const u8, // LPCSTR
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.Ansi, SetLastError = true)]
public static extern IntPtr CreateMDIWindowA([MarshalAs(UnmanagedType.LPStr)] string lpClassName, [MarshalAs(UnmanagedType.LPStr)] 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_CreateMDIWindowA' -Namespace Win32 -PassThru
# $api::CreateMDIWindowA(lpClassName, lpWindowName, dwStyle, X, Y, nWidth, nHeight, hWndParent, hInstance, lParam)#uselib "USER32.dll"
#func global CreateMDIWindowA "CreateMDIWindowA" sptr, sptr, sptr, sptr, sptr, sptr, sptr, sptr, sptr, sptr
; CreateMDIWindowA lpClassName, lpWindowName, dwStyle, X, Y, nWidth, nHeight, hWndParent, hInstance, lParam ; 戻り値は stat
; lpClassName : LPCSTR -> "sptr"
; lpWindowName : LPCSTR -> "sptr"
; dwStyle : WINDOW_STYLE -> "sptr"
; X : INT -> "sptr"
; Y : INT -> "sptr"
; nWidth : INT -> "sptr"
; nHeight : INT -> "sptr"
; hWndParent : HWND optional -> "sptr"
; hInstance : HINSTANCE optional -> "sptr"
; lParam : LPARAM -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "USER32.dll"
#cfunc global CreateMDIWindowA "CreateMDIWindowA" str, str, int, int, int, int, int, sptr, sptr, sptr
; res = CreateMDIWindowA(lpClassName, lpWindowName, dwStyle, X, Y, nWidth, nHeight, hWndParent, hInstance, lParam)
; lpClassName : LPCSTR -> "str"
; lpWindowName : LPCSTR -> "str"
; 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 CreateMDIWindowA(LPCSTR lpClassName, LPCSTR lpWindowName, WINDOW_STYLE dwStyle, INT X, INT Y, INT nWidth, INT nHeight, HWND hWndParent, HINSTANCE hInstance, LPARAM lParam)
#uselib "USER32.dll"
#cfunc global CreateMDIWindowA "CreateMDIWindowA" str, str, int, int, int, int, int, intptr, intptr, intptr
; res = CreateMDIWindowA(lpClassName, lpWindowName, dwStyle, X, Y, nWidth, nHeight, hWndParent, hInstance, lParam)
; lpClassName : LPCSTR -> "str"
; lpWindowName : LPCSTR -> "str"
; 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")
procCreateMDIWindowA = user32.NewProc("CreateMDIWindowA")
)
// lpClassName (LPCSTR), lpWindowName (LPCSTR), dwStyle (WINDOW_STYLE), X (INT), Y (INT), nWidth (INT), nHeight (INT), hWndParent (HWND optional), hInstance (HINSTANCE optional), lParam (LPARAM)
r1, _, err := procCreateMDIWindowA.Call(
uintptr(unsafe.Pointer(windows.BytePtrFromString(lpClassName))),
uintptr(unsafe.Pointer(windows.BytePtrFromString(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 CreateMDIWindowA(
lpClassName: PAnsiChar; // LPCSTR
lpWindowName: PAnsiChar; // LPCSTR
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 'CreateMDIWindowA';result := DllCall("USER32\CreateMDIWindowA"
, "AStr", lpClassName ; LPCSTR
, "AStr", lpWindowName ; LPCSTR
, "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●CreateMDIWindowA(lpClassName, lpWindowName, dwStyle, X, Y, nWidth, nHeight, hWndParent, hInstance, lParam) = DLL("USER32.dll", "void* CreateMDIWindowA(char*, char*, dword, int, int, int, int, void*, void*, int)")
# 呼び出し: CreateMDIWindowA(lpClassName, lpWindowName, dwStyle, X, Y, nWidth, nHeight, hWndParent, hInstance, lParam)
# lpClassName : LPCSTR -> "char*"
# lpWindowName : LPCSTR -> "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)。const std = @import("std");
extern "user32" fn CreateMDIWindowA(
lpClassName: [*c]const u8, // LPCSTR
lpWindowName: [*c]const u8, // LPCSTR
dwStyle: u32, // WINDOW_STYLE
X: i32, // INT
Y: i32, // INT
nWidth: i32, // INT
nHeight: i32, // INT
hWndParent: ?*anyopaque, // HWND optional
hInstance: ?*anyopaque, // HINSTANCE optional
lParam: isize // LPARAM
) callconv(std.os.windows.WINAPI) ?*anyopaque;proc CreateMDIWindowA(
lpClassName: cstring, # LPCSTR
lpWindowName: cstring, # LPCSTR
dwStyle: uint32, # WINDOW_STYLE
X: int32, # INT
Y: int32, # INT
nWidth: int32, # INT
nHeight: int32, # INT
hWndParent: pointer, # HWND optional
hInstance: pointer, # HINSTANCE optional
lParam: int # LPARAM
): pointer {.importc: "CreateMDIWindowA", stdcall, dynlib: "USER32.dll".}pragma(lib, "user32");
extern(Windows)
void* CreateMDIWindowA(
const(char)* lpClassName, // LPCSTR
const(char)* lpWindowName, // LPCSTR
uint dwStyle, // WINDOW_STYLE
int X, // INT
int Y, // INT
int nWidth, // INT
int nHeight, // INT
void* hWndParent, // HWND optional
void* hInstance, // HINSTANCE optional
ptrdiff_t lParam // LPARAM
);ccall((:CreateMDIWindowA, "USER32.dll"), stdcall, Ptr{Cvoid},
(Cstring, Cstring, UInt32, Int32, Int32, Int32, Int32, Ptr{Cvoid}, Ptr{Cvoid}, Int),
lpClassName, lpWindowName, dwStyle, X, Y, nWidth, nHeight, hWndParent, hInstance, lParam)
# lpClassName : LPCSTR -> Cstring
# lpWindowName : LPCSTR -> Cstring
# dwStyle : WINDOW_STYLE -> UInt32
# X : INT -> Int32
# Y : INT -> Int32
# nWidth : INT -> Int32
# nHeight : INT -> Int32
# hWndParent : HWND optional -> Ptr{Cvoid}
# hInstance : HINSTANCE optional -> Ptr{Cvoid}
# lParam : LPARAM -> Int
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
void* CreateMDIWindowA(
const char* lpClassName,
const char* lpWindowName,
uint32_t dwStyle,
int32_t X,
int32_t Y,
int32_t nWidth,
int32_t nHeight,
void* hWndParent,
void* hInstance,
intptr_t lParam);
]]
local user32 = ffi.load("user32")
-- user32.CreateMDIWindowA(lpClassName, lpWindowName, dwStyle, X, Y, nWidth, nHeight, hWndParent, hInstance, lParam)
-- lpClassName : LPCSTR
-- lpWindowName : LPCSTR
-- dwStyle : WINDOW_STYLE
-- X : INT
-- Y : INT
-- nWidth : INT
-- nHeight : INT
-- hWndParent : HWND optional
-- hInstance : HINSTANCE optional
-- lParam : LPARAM
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('USER32.dll');
const CreateMDIWindowA = lib.func('__stdcall', 'CreateMDIWindowA', 'void *', ['str', 'str', 'uint32_t', 'int32_t', 'int32_t', 'int32_t', 'int32_t', 'void *', 'void *', 'intptr_t']);
// CreateMDIWindowA(lpClassName, lpWindowName, dwStyle, X, Y, nWidth, nHeight, hWndParent, hInstance, lParam)
// lpClassName : LPCSTR -> 'str'
// lpWindowName : LPCSTR -> 'str'
// dwStyle : WINDOW_STYLE -> 'uint32_t'
// X : INT -> 'int32_t'
// Y : INT -> 'int32_t'
// nWidth : INT -> 'int32_t'
// nHeight : INT -> 'int32_t'
// hWndParent : HWND optional -> 'void *'
// hInstance : HINSTANCE optional -> 'void *'
// lParam : LPARAM -> 'intptr_t'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("USER32.dll", {
CreateMDIWindowA: { parameters: ["buffer", "buffer", "u32", "i32", "i32", "i32", "i32", "pointer", "pointer", "isize"], result: "pointer" },
});
// lib.symbols.CreateMDIWindowA(lpClassName, lpWindowName, dwStyle, X, Y, nWidth, nHeight, hWndParent, hInstance, lParam)
// lpClassName : LPCSTR -> "buffer"
// lpWindowName : LPCSTR -> "buffer"
// dwStyle : WINDOW_STYLE -> "u32"
// X : INT -> "i32"
// Y : INT -> "i32"
// nWidth : INT -> "i32"
// nHeight : INT -> "i32"
// hWndParent : HWND optional -> "pointer"
// hInstance : HINSTANCE optional -> "pointer"
// lParam : LPARAM -> "isize"
// 文字列は "buffer"。ANSI(-A) は new TextEncoder() で UTF-8/ANSI バイト列(末尾に \x00)を渡す。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
void* CreateMDIWindowA(
const char* lpClassName,
const char* lpWindowName,
uint32_t dwStyle,
int32_t X,
int32_t Y,
int32_t nWidth,
int32_t nHeight,
void* hWndParent,
void* hInstance,
intptr_t lParam);
C, "USER32.dll");
// $ffi->CreateMDIWindowA(lpClassName, lpWindowName, dwStyle, X, Y, nWidth, nHeight, hWndParent, hInstance, lParam);
// lpClassName : LPCSTR
// lpWindowName : LPCSTR
// dwStyle : WINDOW_STYLE
// X : INT
// Y : INT
// nWidth : INT
// nHeight : INT
// hWndParent : HWND optional
// hInstance : HINSTANCE optional
// lParam : LPARAM
// 構造体/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 User32 extends StdCallLibrary {
User32 INSTANCE = Native.load("user32", User32.class, W32APIOptions.ASCII_OPTIONS);
Pointer CreateMDIWindowA(
String lpClassName, // LPCSTR
String lpWindowName, // LPCSTR
int dwStyle, // WINDOW_STYLE
int X, // INT
int Y, // INT
int nWidth, // INT
int nHeight, // INT
Pointer hWndParent, // HWND optional
Pointer hInstance, // HINSTANCE optional
long lParam // LPARAM
);
}@[Link("user32")]
lib LibUSER32
fun CreateMDIWindowA = CreateMDIWindowA(
lpClassName : UInt8*, # LPCSTR
lpWindowName : UInt8*, # LPCSTR
dwStyle : UInt32, # WINDOW_STYLE
X : Int32, # INT
Y : Int32, # INT
nWidth : Int32, # INT
nHeight : Int32, # INT
hWndParent : Void*, # HWND optional
hInstance : Void*, # HINSTANCE optional
lParam : LibC::SSizeT # LPARAM
) : Void*
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef CreateMDIWindowANative = Pointer<Void> Function(Pointer<Utf8>, Pointer<Utf8>, Uint32, Int32, Int32, Int32, Int32, Pointer<Void>, Pointer<Void>, IntPtr);
typedef CreateMDIWindowADart = Pointer<Void> Function(Pointer<Utf8>, Pointer<Utf8>, int, int, int, int, int, Pointer<Void>, Pointer<Void>, int);
final CreateMDIWindowA = DynamicLibrary.open('USER32.dll')
.lookupFunction<CreateMDIWindowANative, CreateMDIWindowADart>('CreateMDIWindowA');
// lpClassName : LPCSTR -> Pointer<Utf8>
// lpWindowName : LPCSTR -> Pointer<Utf8>
// dwStyle : WINDOW_STYLE -> Uint32
// X : INT -> Int32
// Y : INT -> Int32
// nWidth : INT -> Int32
// nHeight : INT -> Int32
// hWndParent : HWND optional -> Pointer<Void>
// hInstance : HINSTANCE optional -> Pointer<Void>
// lParam : LPARAM -> IntPtr
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function CreateMDIWindowA(
lpClassName: PAnsiChar; // LPCSTR
lpWindowName: PAnsiChar; // LPCSTR
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 'CreateMDIWindowA';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "CreateMDIWindowA"
c_CreateMDIWindowA :: CString -> CString -> Word32 -> Int32 -> Int32 -> Int32 -> Int32 -> Ptr () -> Ptr () -> CIntPtr -> IO (Ptr ())
-- lpClassName : LPCSTR -> CString
-- lpWindowName : LPCSTR -> CString
-- dwStyle : WINDOW_STYLE -> Word32
-- X : INT -> Int32
-- Y : INT -> Int32
-- nWidth : INT -> Int32
-- nHeight : INT -> Int32
-- hWndParent : HWND optional -> Ptr ()
-- hInstance : HINSTANCE optional -> Ptr ()
-- lParam : LPARAM -> CIntPtr
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let createmdiwindowa =
foreign "CreateMDIWindowA"
(string @-> string @-> uint32_t @-> int32_t @-> int32_t @-> int32_t @-> int32_t @-> (ptr void) @-> (ptr void) @-> intptr_t @-> returning (ptr void))
(* lpClassName : LPCSTR -> string *)
(* lpWindowName : LPCSTR -> string *)
(* dwStyle : WINDOW_STYLE -> uint32_t *)
(* X : INT -> int32_t *)
(* Y : INT -> int32_t *)
(* nWidth : INT -> int32_t *)
(* nHeight : INT -> int32_t *)
(* hWndParent : HWND optional -> (ptr void) *)
(* hInstance : HINSTANCE optional -> (ptr void) *)
(* lParam : LPARAM -> intptr_t *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library user32 (t "USER32.dll"))
(cffi:use-foreign-library user32)
(cffi:defcfun ("CreateMDIWindowA" create-mdiwindow-a :convention :stdcall) :pointer
(lp-class-name :string) ; LPCSTR
(lp-window-name :string) ; LPCSTR
(dw-style :uint32) ; WINDOW_STYLE
(x :int32) ; INT
(y :int32) ; INT
(n-width :int32) ; INT
(n-height :int32) ; INT
(h-wnd-parent :pointer) ; HWND optional
(h-instance :pointer) ; HINSTANCE optional
(l-param :int64)) ; LPARAM
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $CreateMDIWindowA = Win32::API::More->new('USER32',
'HANDLE CreateMDIWindowA(LPCSTR lpClassName, LPCSTR lpWindowName, DWORD dwStyle, int X, int Y, int nWidth, int nHeight, HANDLE hWndParent, HANDLE hInstance, LPARAM lParam)');
# my $ret = $CreateMDIWindowA->Call($lpClassName, $lpWindowName, $dwStyle, $X, $Y, $nWidth, $nHeight, $hWndParent, $hInstance, $lParam);
# lpClassName : LPCSTR -> LPCSTR
# lpWindowName : LPCSTR -> LPCSTR
# dwStyle : WINDOW_STYLE -> DWORD
# X : INT -> int
# Y : INT -> int
# nWidth : INT -> int
# nHeight : INT -> int
# hWndParent : HWND optional -> HANDLE
# hInstance : HINSTANCE optional -> HANDLE
# lParam : LPARAM -> LPARAM
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。関連項目
文字セット違い
- f CreateMDIWindowW (Unicode版) — MDI子ウィンドウを作成する(Unicode版)。
公式の関連項目
- f RegisterClassExA — 拡張属性付きでウィンドウクラスを登録する(ANSI)。
使用する型