Win32 API 日本語リファレンス
ホームUI.Shell › SHGetInstanceExplorer

SHGetInstanceExplorer

関数
ホストするエクスプローラーのIUnknownを取得する。
DLLSHELL32.dll呼出規約winapi対応OSWindows XP 以降

シグネチャ

// SHELL32.dll
#include <windows.h>

HRESULT SHGetInstanceExplorer(
    IUnknown** ppunk
);

パラメーター

名前方向
ppunkIUnknown**out

戻り値の型: HRESULT

各言語での呼び出し定義

// SHELL32.dll
#include <windows.h>

HRESULT SHGetInstanceExplorer(
    IUnknown** ppunk
);
[DllImport("SHELL32.dll", ExactSpelling = true)]
static extern int SHGetInstanceExplorer(
    IntPtr ppunk   // IUnknown** out
);
<DllImport("SHELL32.dll", ExactSpelling:=True)>
Public Shared Function SHGetInstanceExplorer(
    ppunk As IntPtr   ' IUnknown** out
) As Integer
End Function
' ppunk : IUnknown** out
Declare PtrSafe Function SHGetInstanceExplorer Lib "shell32" ( _
    ByVal ppunk As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

SHGetInstanceExplorer = ctypes.windll.shell32.SHGetInstanceExplorer
SHGetInstanceExplorer.restype = ctypes.c_int
SHGetInstanceExplorer.argtypes = [
    ctypes.c_void_p,  # ppunk : IUnknown** out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('SHELL32.dll')
SHGetInstanceExplorer = Fiddle::Function.new(
  lib['SHGetInstanceExplorer'],
  [
    Fiddle::TYPE_VOIDP,  # ppunk : IUnknown** out
  ],
  Fiddle::TYPE_INT)
#[link(name = "shell32")]
extern "system" {
    fn SHGetInstanceExplorer(
        ppunk: *mut *mut core::ffi::c_void  // IUnknown** out
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("SHELL32.dll")]
public static extern int SHGetInstanceExplorer(IntPtr ppunk);
"@
$api = Add-Type -MemberDefinition $sig -Name 'SHELL32_SHGetInstanceExplorer' -Namespace Win32 -PassThru
# $api::SHGetInstanceExplorer(ppunk)
#uselib "SHELL32.dll"
#func global SHGetInstanceExplorer "SHGetInstanceExplorer" sptr
; SHGetInstanceExplorer ppunk   ; 戻り値は stat
; ppunk : IUnknown** out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "SHELL32.dll"
#cfunc global SHGetInstanceExplorer "SHGetInstanceExplorer" sptr
; res = SHGetInstanceExplorer(ppunk)
; ppunk : IUnknown** out -> "sptr"
; HRESULT SHGetInstanceExplorer(IUnknown** ppunk)
#uselib "SHELL32.dll"
#cfunc global SHGetInstanceExplorer "SHGetInstanceExplorer" intptr
; res = SHGetInstanceExplorer(ppunk)
; ppunk : IUnknown** out -> "intptr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	shell32 = windows.NewLazySystemDLL("SHELL32.dll")
	procSHGetInstanceExplorer = shell32.NewProc("SHGetInstanceExplorer")
)

// ppunk (IUnknown** out)
r1, _, err := procSHGetInstanceExplorer.Call(
	uintptr(ppunk),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // HRESULT
function SHGetInstanceExplorer(
  ppunk: Pointer   // IUnknown** out
): Integer; stdcall;
  external 'SHELL32.dll' name 'SHGetInstanceExplorer';
result := DllCall("SHELL32\SHGetInstanceExplorer"
    , "Ptr", ppunk   ; IUnknown** out
    , "Int")   ; return: HRESULT
●SHGetInstanceExplorer(ppunk) = DLL("SHELL32.dll", "int SHGetInstanceExplorer(void*)")
# 呼び出し: SHGetInstanceExplorer(ppunk)
# ppunk : IUnknown** out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。