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

SHShowManageLibraryUI

関数
ライブラリ管理用のダイアログUIを表示する。
DLLSHELL32.dll呼出規約winapi対応OSWindows 7 以降

シグネチャ

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

HRESULT SHShowManageLibraryUI(
    IShellItem* psiLibrary,
    HWND hwndOwner,
    LPCWSTR pszTitle,   // optional
    LPCWSTR pszInstruction,   // optional
    LIBRARYMANAGEDIALOGOPTIONS lmdOptions
);

パラメーター

名前方向
psiLibraryIShellItem*in
hwndOwnerHWNDin
pszTitleLPCWSTRinoptional
pszInstructionLPCWSTRinoptional
lmdOptionsLIBRARYMANAGEDIALOGOPTIONSin

戻り値の型: HRESULT

各言語での呼び出し定義

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

HRESULT SHShowManageLibraryUI(
    IShellItem* psiLibrary,
    HWND hwndOwner,
    LPCWSTR pszTitle,   // optional
    LPCWSTR pszInstruction,   // optional
    LIBRARYMANAGEDIALOGOPTIONS lmdOptions
);
[DllImport("SHELL32.dll", ExactSpelling = true)]
static extern int SHShowManageLibraryUI(
    IntPtr psiLibrary,   // IShellItem*
    IntPtr hwndOwner,   // HWND
    [MarshalAs(UnmanagedType.LPWStr)] string pszTitle,   // LPCWSTR optional
    [MarshalAs(UnmanagedType.LPWStr)] string pszInstruction,   // LPCWSTR optional
    int lmdOptions   // LIBRARYMANAGEDIALOGOPTIONS
);
<DllImport("SHELL32.dll", ExactSpelling:=True)>
Public Shared Function SHShowManageLibraryUI(
    psiLibrary As IntPtr,   ' IShellItem*
    hwndOwner As IntPtr,   ' HWND
    <MarshalAs(UnmanagedType.LPWStr)> pszTitle As String,   ' LPCWSTR optional
    <MarshalAs(UnmanagedType.LPWStr)> pszInstruction As String,   ' LPCWSTR optional
    lmdOptions As Integer   ' LIBRARYMANAGEDIALOGOPTIONS
) As Integer
End Function
' psiLibrary : IShellItem*
' hwndOwner : HWND
' pszTitle : LPCWSTR optional
' pszInstruction : LPCWSTR optional
' lmdOptions : LIBRARYMANAGEDIALOGOPTIONS
Declare PtrSafe Function SHShowManageLibraryUI Lib "shell32" ( _
    ByVal psiLibrary As LongPtr, _
    ByVal hwndOwner As LongPtr, _
    ByVal pszTitle As LongPtr, _
    ByVal pszInstruction As LongPtr, _
    ByVal lmdOptions As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

SHShowManageLibraryUI = ctypes.windll.shell32.SHShowManageLibraryUI
SHShowManageLibraryUI.restype = ctypes.c_int
SHShowManageLibraryUI.argtypes = [
    ctypes.c_void_p,  # psiLibrary : IShellItem*
    wintypes.HANDLE,  # hwndOwner : HWND
    wintypes.LPCWSTR,  # pszTitle : LPCWSTR optional
    wintypes.LPCWSTR,  # pszInstruction : LPCWSTR optional
    ctypes.c_int,  # lmdOptions : LIBRARYMANAGEDIALOGOPTIONS
]
require 'fiddle'
require 'fiddle/import'

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

var (
	shell32 = windows.NewLazySystemDLL("SHELL32.dll")
	procSHShowManageLibraryUI = shell32.NewProc("SHShowManageLibraryUI")
)

// psiLibrary (IShellItem*), hwndOwner (HWND), pszTitle (LPCWSTR optional), pszInstruction (LPCWSTR optional), lmdOptions (LIBRARYMANAGEDIALOGOPTIONS)
r1, _, err := procSHShowManageLibraryUI.Call(
	uintptr(psiLibrary),
	uintptr(hwndOwner),
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(pszTitle))),
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(pszInstruction))),
	uintptr(lmdOptions),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // HRESULT
function SHShowManageLibraryUI(
  psiLibrary: Pointer;   // IShellItem*
  hwndOwner: THandle;   // HWND
  pszTitle: PWideChar;   // LPCWSTR optional
  pszInstruction: PWideChar;   // LPCWSTR optional
  lmdOptions: Integer   // LIBRARYMANAGEDIALOGOPTIONS
): Integer; stdcall;
  external 'SHELL32.dll' name 'SHShowManageLibraryUI';
result := DllCall("SHELL32\SHShowManageLibraryUI"
    , "Ptr", psiLibrary   ; IShellItem*
    , "Ptr", hwndOwner   ; HWND
    , "WStr", pszTitle   ; LPCWSTR optional
    , "WStr", pszInstruction   ; LPCWSTR optional
    , "Int", lmdOptions   ; LIBRARYMANAGEDIALOGOPTIONS
    , "Int")   ; return: HRESULT
●SHShowManageLibraryUI(psiLibrary, hwndOwner, pszTitle, pszInstruction, lmdOptions) = DLL("SHELL32.dll", "int SHShowManageLibraryUI(void*, void*, char*, char*, int)")
# 呼び出し: SHShowManageLibraryUI(psiLibrary, hwndOwner, pszTitle, pszInstruction, lmdOptions)
# psiLibrary : IShellItem* -> "void*"
# hwndOwner : HWND -> "void*"
# pszTitle : LPCWSTR optional -> "char*"
# pszInstruction : LPCWSTR optional -> "char*"
# lmdOptions : LIBRARYMANAGEDIALOGOPTIONS -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。