ホーム › UI.WindowsAndMessaging › CreateDialogIndirectParamA
CreateDialogIndirectParamA
関数メモリ上のテンプレートからモードレスダイアログを生成する(ANSI)。
シグネチャ
// USER32.dll (ANSI / -A)
#include <windows.h>
HWND CreateDialogIndirectParamA(
HINSTANCE hInstance, // optional
DLGTEMPLATE* lpTemplate,
HWND hWndParent, // optional
DLGPROC lpDialogFunc, // optional
LPARAM dwInitParam
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hInstance | HINSTANCE | inoptional |
| lpTemplate | DLGTEMPLATE* | in |
| hWndParent | HWND | inoptional |
| lpDialogFunc | DLGPROC | inoptional |
| dwInitParam | LPARAM | in |
戻り値の型: HWND
各言語での呼び出し定義
// USER32.dll (ANSI / -A)
#include <windows.h>
HWND CreateDialogIndirectParamA(
HINSTANCE hInstance, // optional
DLGTEMPLATE* lpTemplate,
HWND hWndParent, // optional
DLGPROC lpDialogFunc, // optional
LPARAM dwInitParam
);[DllImport("USER32.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
static extern IntPtr CreateDialogIndirectParamA(
IntPtr hInstance, // HINSTANCE optional
IntPtr lpTemplate, // DLGTEMPLATE*
IntPtr hWndParent, // HWND optional
IntPtr lpDialogFunc, // DLGPROC optional
IntPtr dwInitParam // LPARAM
);<DllImport("USER32.dll", CharSet:=CharSet.Ansi, SetLastError:=True, ExactSpelling:=True)>
Public Shared Function CreateDialogIndirectParamA(
hInstance As IntPtr, ' HINSTANCE optional
lpTemplate As IntPtr, ' DLGTEMPLATE*
hWndParent As IntPtr, ' HWND optional
lpDialogFunc As IntPtr, ' DLGPROC optional
dwInitParam As IntPtr ' LPARAM
) As IntPtr
End Function' hInstance : HINSTANCE optional
' lpTemplate : DLGTEMPLATE*
' hWndParent : HWND optional
' lpDialogFunc : DLGPROC optional
' dwInitParam : LPARAM
Declare PtrSafe Function CreateDialogIndirectParamA Lib "user32" ( _
ByVal hInstance As LongPtr, _
ByVal lpTemplate As LongPtr, _
ByVal hWndParent As LongPtr, _
ByVal lpDialogFunc As LongPtr, _
ByVal dwInitParam As LongPtr) As LongPtr
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
CreateDialogIndirectParamA = ctypes.windll.user32.CreateDialogIndirectParamA
CreateDialogIndirectParamA.restype = ctypes.c_void_p
CreateDialogIndirectParamA.argtypes = [
wintypes.HANDLE, # hInstance : HINSTANCE optional
ctypes.c_void_p, # lpTemplate : DLGTEMPLATE*
wintypes.HANDLE, # hWndParent : HWND optional
ctypes.c_void_p, # lpDialogFunc : DLGPROC optional
ctypes.c_ssize_t, # dwInitParam : LPARAM
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('USER32.dll')
CreateDialogIndirectParamA = Fiddle::Function.new(
lib['CreateDialogIndirectParamA'],
[
Fiddle::TYPE_VOIDP, # hInstance : HINSTANCE optional
Fiddle::TYPE_VOIDP, # lpTemplate : DLGTEMPLATE*
Fiddle::TYPE_VOIDP, # hWndParent : HWND optional
Fiddle::TYPE_VOIDP, # lpDialogFunc : DLGPROC optional
Fiddle::TYPE_INTPTR_T, # dwInitParam : LPARAM
],
Fiddle::TYPE_VOIDP)#[link(name = "user32")]
extern "system" {
fn CreateDialogIndirectParamA(
hInstance: *mut core::ffi::c_void, // HINSTANCE optional
lpTemplate: *mut DLGTEMPLATE, // DLGTEMPLATE*
hWndParent: *mut core::ffi::c_void, // HWND optional
lpDialogFunc: *const core::ffi::c_void, // DLGPROC optional
dwInitParam: 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 CreateDialogIndirectParamA(IntPtr hInstance, IntPtr lpTemplate, IntPtr hWndParent, IntPtr lpDialogFunc, IntPtr dwInitParam);
"@
$api = Add-Type -MemberDefinition $sig -Name 'USER32_CreateDialogIndirectParamA' -Namespace Win32 -PassThru
# $api::CreateDialogIndirectParamA(hInstance, lpTemplate, hWndParent, lpDialogFunc, dwInitParam)#uselib "USER32.dll"
#func global CreateDialogIndirectParamA "CreateDialogIndirectParamA" sptr, sptr, sptr, sptr, sptr
; CreateDialogIndirectParamA hInstance, varptr(lpTemplate), hWndParent, lpDialogFunc, dwInitParam ; 戻り値は stat
; hInstance : HINSTANCE optional -> "sptr"
; lpTemplate : DLGTEMPLATE* -> "sptr"
; hWndParent : HWND optional -> "sptr"
; lpDialogFunc : DLGPROC optional -> "sptr"
; dwInitParam : LPARAM -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "USER32.dll" #cfunc global CreateDialogIndirectParamA "CreateDialogIndirectParamA" sptr, var, sptr, sptr, sptr ; res = CreateDialogIndirectParamA(hInstance, lpTemplate, hWndParent, lpDialogFunc, dwInitParam) ; hInstance : HINSTANCE optional -> "sptr" ; lpTemplate : DLGTEMPLATE* -> "var" ; hWndParent : HWND optional -> "sptr" ; lpDialogFunc : DLGPROC optional -> "sptr" ; dwInitParam : LPARAM -> "sptr" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "USER32.dll" #cfunc global CreateDialogIndirectParamA "CreateDialogIndirectParamA" sptr, sptr, sptr, sptr, sptr ; res = CreateDialogIndirectParamA(hInstance, varptr(lpTemplate), hWndParent, lpDialogFunc, dwInitParam) ; hInstance : HINSTANCE optional -> "sptr" ; lpTemplate : DLGTEMPLATE* -> "sptr" ; hWndParent : HWND optional -> "sptr" ; lpDialogFunc : DLGPROC optional -> "sptr" ; dwInitParam : LPARAM -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; HWND CreateDialogIndirectParamA(HINSTANCE hInstance, DLGTEMPLATE* lpTemplate, HWND hWndParent, DLGPROC lpDialogFunc, LPARAM dwInitParam) #uselib "USER32.dll" #cfunc global CreateDialogIndirectParamA "CreateDialogIndirectParamA" intptr, var, intptr, intptr, intptr ; res = CreateDialogIndirectParamA(hInstance, lpTemplate, hWndParent, lpDialogFunc, dwInitParam) ; hInstance : HINSTANCE optional -> "intptr" ; lpTemplate : DLGTEMPLATE* -> "var" ; hWndParent : HWND optional -> "intptr" ; lpDialogFunc : DLGPROC optional -> "intptr" ; dwInitParam : LPARAM -> "intptr" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; HWND CreateDialogIndirectParamA(HINSTANCE hInstance, DLGTEMPLATE* lpTemplate, HWND hWndParent, DLGPROC lpDialogFunc, LPARAM dwInitParam) #uselib "USER32.dll" #cfunc global CreateDialogIndirectParamA "CreateDialogIndirectParamA" intptr, intptr, intptr, intptr, intptr ; res = CreateDialogIndirectParamA(hInstance, varptr(lpTemplate), hWndParent, lpDialogFunc, dwInitParam) ; hInstance : HINSTANCE optional -> "intptr" ; lpTemplate : DLGTEMPLATE* -> "intptr" ; hWndParent : HWND optional -> "intptr" ; lpDialogFunc : DLGPROC optional -> "intptr" ; dwInitParam : LPARAM -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
user32 = windows.NewLazySystemDLL("USER32.dll")
procCreateDialogIndirectParamA = user32.NewProc("CreateDialogIndirectParamA")
)
// hInstance (HINSTANCE optional), lpTemplate (DLGTEMPLATE*), hWndParent (HWND optional), lpDialogFunc (DLGPROC optional), dwInitParam (LPARAM)
r1, _, err := procCreateDialogIndirectParamA.Call(
uintptr(hInstance),
uintptr(lpTemplate),
uintptr(hWndParent),
uintptr(lpDialogFunc),
uintptr(dwInitParam),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HWNDfunction CreateDialogIndirectParamA(
hInstance: THandle; // HINSTANCE optional
lpTemplate: Pointer; // DLGTEMPLATE*
hWndParent: THandle; // HWND optional
lpDialogFunc: Pointer; // DLGPROC optional
dwInitParam: NativeInt // LPARAM
): THandle; stdcall;
external 'USER32.dll' name 'CreateDialogIndirectParamA';result := DllCall("USER32\CreateDialogIndirectParamA"
, "Ptr", hInstance ; HINSTANCE optional
, "Ptr", lpTemplate ; DLGTEMPLATE*
, "Ptr", hWndParent ; HWND optional
, "Ptr", lpDialogFunc ; DLGPROC optional
, "Ptr", dwInitParam ; LPARAM
, "Ptr") ; return: HWND●CreateDialogIndirectParamA(hInstance, lpTemplate, hWndParent, lpDialogFunc, dwInitParam) = DLL("USER32.dll", "void* CreateDialogIndirectParamA(void*, void*, void*, void*, int)")
# 呼び出し: CreateDialogIndirectParamA(hInstance, lpTemplate, hWndParent, lpDialogFunc, dwInitParam)
# hInstance : HINSTANCE optional -> "void*"
# lpTemplate : DLGTEMPLATE* -> "void*"
# hWndParent : HWND optional -> "void*"
# lpDialogFunc : DLGPROC optional -> "void*"
# dwInitParam : LPARAM -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。