SHOpenWithDialog
関数プログラムから開くダイアログを表示する。
シグネチャ
// SHELL32.dll
#include <windows.h>
HRESULT SHOpenWithDialog(
HWND hwndParent, // optional
const OPENASINFO* poainfo
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hwndParent | HWND | inoptional |
| poainfo | OPENASINFO* | in |
戻り値の型: HRESULT
各言語での呼び出し定義
// SHELL32.dll
#include <windows.h>
HRESULT SHOpenWithDialog(
HWND hwndParent, // optional
const OPENASINFO* poainfo
);[DllImport("SHELL32.dll", ExactSpelling = true)]
static extern int SHOpenWithDialog(
IntPtr hwndParent, // HWND optional
IntPtr poainfo // OPENASINFO*
);<DllImport("SHELL32.dll", ExactSpelling:=True)>
Public Shared Function SHOpenWithDialog(
hwndParent As IntPtr, ' HWND optional
poainfo As IntPtr ' OPENASINFO*
) As Integer
End Function' hwndParent : HWND optional
' poainfo : OPENASINFO*
Declare PtrSafe Function SHOpenWithDialog Lib "shell32" ( _
ByVal hwndParent As LongPtr, _
ByVal poainfo As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
SHOpenWithDialog = ctypes.windll.shell32.SHOpenWithDialog
SHOpenWithDialog.restype = ctypes.c_int
SHOpenWithDialog.argtypes = [
wintypes.HANDLE, # hwndParent : HWND optional
ctypes.c_void_p, # poainfo : OPENASINFO*
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('SHELL32.dll')
SHOpenWithDialog = Fiddle::Function.new(
lib['SHOpenWithDialog'],
[
Fiddle::TYPE_VOIDP, # hwndParent : HWND optional
Fiddle::TYPE_VOIDP, # poainfo : OPENASINFO*
],
Fiddle::TYPE_INT)#[link(name = "shell32")]
extern "system" {
fn SHOpenWithDialog(
hwndParent: *mut core::ffi::c_void, // HWND optional
poainfo: *const OPENASINFO // OPENASINFO*
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("SHELL32.dll")]
public static extern int SHOpenWithDialog(IntPtr hwndParent, IntPtr poainfo);
"@
$api = Add-Type -MemberDefinition $sig -Name 'SHELL32_SHOpenWithDialog' -Namespace Win32 -PassThru
# $api::SHOpenWithDialog(hwndParent, poainfo)#uselib "SHELL32.dll"
#func global SHOpenWithDialog "SHOpenWithDialog" sptr, sptr
; SHOpenWithDialog hwndParent, varptr(poainfo) ; 戻り値は stat
; hwndParent : HWND optional -> "sptr"
; poainfo : OPENASINFO* -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "SHELL32.dll" #cfunc global SHOpenWithDialog "SHOpenWithDialog" sptr, var ; res = SHOpenWithDialog(hwndParent, poainfo) ; hwndParent : HWND optional -> "sptr" ; poainfo : OPENASINFO* -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "SHELL32.dll" #cfunc global SHOpenWithDialog "SHOpenWithDialog" sptr, sptr ; res = SHOpenWithDialog(hwndParent, varptr(poainfo)) ; hwndParent : HWND optional -> "sptr" ; poainfo : OPENASINFO* -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; HRESULT SHOpenWithDialog(HWND hwndParent, OPENASINFO* poainfo) #uselib "SHELL32.dll" #cfunc global SHOpenWithDialog "SHOpenWithDialog" intptr, var ; res = SHOpenWithDialog(hwndParent, poainfo) ; hwndParent : HWND optional -> "intptr" ; poainfo : OPENASINFO* -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; HRESULT SHOpenWithDialog(HWND hwndParent, OPENASINFO* poainfo) #uselib "SHELL32.dll" #cfunc global SHOpenWithDialog "SHOpenWithDialog" intptr, intptr ; res = SHOpenWithDialog(hwndParent, varptr(poainfo)) ; hwndParent : HWND optional -> "intptr" ; poainfo : OPENASINFO* -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
shell32 = windows.NewLazySystemDLL("SHELL32.dll")
procSHOpenWithDialog = shell32.NewProc("SHOpenWithDialog")
)
// hwndParent (HWND optional), poainfo (OPENASINFO*)
r1, _, err := procSHOpenWithDialog.Call(
uintptr(hwndParent),
uintptr(poainfo),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction SHOpenWithDialog(
hwndParent: THandle; // HWND optional
poainfo: Pointer // OPENASINFO*
): Integer; stdcall;
external 'SHELL32.dll' name 'SHOpenWithDialog';result := DllCall("SHELL32\SHOpenWithDialog"
, "Ptr", hwndParent ; HWND optional
, "Ptr", poainfo ; OPENASINFO*
, "Int") ; return: HRESULT●SHOpenWithDialog(hwndParent, poainfo) = DLL("SHELL32.dll", "int SHOpenWithDialog(void*, void*)")
# 呼び出し: SHOpenWithDialog(hwndParent, poainfo)
# hwndParent : HWND optional -> "void*"
# poainfo : OPENASINFO* -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。