ホーム › UI.WindowsAndMessaging › EndDialog
EndDialog
関数モーダルダイアログを終了し結果値を返す。
シグネチャ
// USER32.dll
#include <windows.h>
BOOL EndDialog(
HWND hDlg,
INT_PTR nResult
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hDlg | HWND | in |
| nResult | INT_PTR | in |
戻り値の型: BOOL
各言語での呼び出し定義
// USER32.dll
#include <windows.h>
BOOL EndDialog(
HWND hDlg,
INT_PTR nResult
);[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("USER32.dll", SetLastError = true, ExactSpelling = true)]
static extern bool EndDialog(
IntPtr hDlg, // HWND
IntPtr nResult // INT_PTR
);<DllImport("USER32.dll", SetLastError:=True, ExactSpelling:=True)>
Public Shared Function EndDialog(
hDlg As IntPtr, ' HWND
nResult As IntPtr ' INT_PTR
) As Boolean
End Function' hDlg : HWND
' nResult : INT_PTR
Declare PtrSafe Function EndDialog Lib "user32" ( _
ByVal hDlg As LongPtr, _
ByVal nResult As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
EndDialog = ctypes.windll.user32.EndDialog
EndDialog.restype = wintypes.BOOL
EndDialog.argtypes = [
wintypes.HANDLE, # hDlg : HWND
ctypes.c_ssize_t, # nResult : INT_PTR
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('USER32.dll')
EndDialog = Fiddle::Function.new(
lib['EndDialog'],
[
Fiddle::TYPE_VOIDP, # hDlg : HWND
Fiddle::TYPE_INTPTR_T, # nResult : INT_PTR
],
Fiddle::TYPE_INT)#[link(name = "user32")]
extern "system" {
fn EndDialog(
hDlg: *mut core::ffi::c_void, // HWND
nResult: isize // INT_PTR
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("USER32.dll", SetLastError = true)]
public static extern bool EndDialog(IntPtr hDlg, IntPtr nResult);
"@
$api = Add-Type -MemberDefinition $sig -Name 'USER32_EndDialog' -Namespace Win32 -PassThru
# $api::EndDialog(hDlg, nResult)#uselib "USER32.dll"
#func global EndDialog "EndDialog" sptr, sptr
; EndDialog hDlg, nResult ; 戻り値は stat
; hDlg : HWND -> "sptr"
; nResult : INT_PTR -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "USER32.dll"
#cfunc global EndDialog "EndDialog" sptr, sptr
; res = EndDialog(hDlg, nResult)
; hDlg : HWND -> "sptr"
; nResult : INT_PTR -> "sptr"; BOOL EndDialog(HWND hDlg, INT_PTR nResult)
#uselib "USER32.dll"
#cfunc global EndDialog "EndDialog" intptr, intptr
; res = EndDialog(hDlg, nResult)
; hDlg : HWND -> "intptr"
; nResult : INT_PTR -> "intptr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
user32 = windows.NewLazySystemDLL("USER32.dll")
procEndDialog = user32.NewProc("EndDialog")
)
// hDlg (HWND), nResult (INT_PTR)
r1, _, err := procEndDialog.Call(
uintptr(hDlg),
uintptr(nResult),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // BOOLfunction EndDialog(
hDlg: THandle; // HWND
nResult: NativeInt // INT_PTR
): BOOL; stdcall;
external 'USER32.dll' name 'EndDialog';result := DllCall("USER32\EndDialog"
, "Ptr", hDlg ; HWND
, "Ptr", nResult ; INT_PTR
, "Int") ; return: BOOL●EndDialog(hDlg, nResult) = DLL("USER32.dll", "bool EndDialog(void*, int)")
# 呼び出し: EndDialog(hDlg, nResult)
# hDlg : HWND -> "void*"
# nResult : INT_PTR -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。