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

SHCreateShellFolderViewEx

関数
拡張パラメーターでシェルフォルダービューを生成する。
DLLSHELL32.dll呼出規約winapi対応OSWindows 2000 以降

シグネチャ

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

HRESULT SHCreateShellFolderViewEx(
    CSFV* pcsfv,
    IShellView** ppsv
);

パラメーター

名前方向
pcsfvCSFV*in
ppsvIShellView**out

戻り値の型: HRESULT

各言語での呼び出し定義

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

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

SHCreateShellFolderViewEx = ctypes.windll.shell32.SHCreateShellFolderViewEx
SHCreateShellFolderViewEx.restype = ctypes.c_int
SHCreateShellFolderViewEx.argtypes = [
    ctypes.c_void_p,  # pcsfv : CSFV*
    ctypes.c_void_p,  # ppsv : IShellView** out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('SHELL32.dll')
SHCreateShellFolderViewEx = Fiddle::Function.new(
  lib['SHCreateShellFolderViewEx'],
  [
    Fiddle::TYPE_VOIDP,  # pcsfv : CSFV*
    Fiddle::TYPE_VOIDP,  # ppsv : IShellView** out
  ],
  Fiddle::TYPE_INT)
#[link(name = "shell32")]
extern "system" {
    fn SHCreateShellFolderViewEx(
        pcsfv: *mut CSFV,  // CSFV*
        ppsv: *mut *mut core::ffi::c_void  // IShellView** out
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("SHELL32.dll")]
public static extern int SHCreateShellFolderViewEx(IntPtr pcsfv, IntPtr ppsv);
"@
$api = Add-Type -MemberDefinition $sig -Name 'SHELL32_SHCreateShellFolderViewEx' -Namespace Win32 -PassThru
# $api::SHCreateShellFolderViewEx(pcsfv, ppsv)
#uselib "SHELL32.dll"
#func global SHCreateShellFolderViewEx "SHCreateShellFolderViewEx" sptr, sptr
; SHCreateShellFolderViewEx varptr(pcsfv), ppsv   ; 戻り値は stat
; pcsfv : CSFV* -> "sptr"
; ppsv : IShellView** out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "SHELL32.dll"
#cfunc global SHCreateShellFolderViewEx "SHCreateShellFolderViewEx" var, sptr
; res = SHCreateShellFolderViewEx(pcsfv, ppsv)
; pcsfv : CSFV* -> "var"
; ppsv : IShellView** out -> "sptr"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; HRESULT SHCreateShellFolderViewEx(CSFV* pcsfv, IShellView** ppsv)
#uselib "SHELL32.dll"
#cfunc global SHCreateShellFolderViewEx "SHCreateShellFolderViewEx" var, intptr
; res = SHCreateShellFolderViewEx(pcsfv, ppsv)
; pcsfv : CSFV* -> "var"
; ppsv : IShellView** out -> "intptr"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	shell32 = windows.NewLazySystemDLL("SHELL32.dll")
	procSHCreateShellFolderViewEx = shell32.NewProc("SHCreateShellFolderViewEx")
)

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