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

SHShellFolderView_Message

関数
シェルフォルダービューにメッセージを送信する。
DLLSHELL32.dll呼出規約winapi対応OSWindows XP 以降

シグネチャ

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

LRESULT SHShellFolderView_Message(
    HWND hwndMain,
    DWORD uMsg,
    LPARAM lParam
);

パラメーター

名前方向
hwndMainHWNDin
uMsgDWORDin
lParamLPARAMin

戻り値の型: LRESULT

各言語での呼び出し定義

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

LRESULT SHShellFolderView_Message(
    HWND hwndMain,
    DWORD uMsg,
    LPARAM lParam
);
[DllImport("SHELL32.dll", ExactSpelling = true)]
static extern IntPtr SHShellFolderView_Message(
    IntPtr hwndMain,   // HWND
    uint uMsg,   // DWORD
    IntPtr lParam   // LPARAM
);
<DllImport("SHELL32.dll", ExactSpelling:=True)>
Public Shared Function SHShellFolderView_Message(
    hwndMain As IntPtr,   ' HWND
    uMsg As UInteger,   ' DWORD
    lParam As IntPtr   ' LPARAM
) As IntPtr
End Function
' hwndMain : HWND
' uMsg : DWORD
' lParam : LPARAM
Declare PtrSafe Function SHShellFolderView_Message Lib "shell32" ( _
    ByVal hwndMain As LongPtr, _
    ByVal uMsg As Long, _
    ByVal lParam As LongPtr) As LongPtr
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

SHShellFolderView_Message = ctypes.windll.shell32.SHShellFolderView_Message
SHShellFolderView_Message.restype = ctypes.c_ssize_t
SHShellFolderView_Message.argtypes = [
    wintypes.HANDLE,  # hwndMain : HWND
    wintypes.DWORD,  # uMsg : DWORD
    ctypes.c_ssize_t,  # lParam : LPARAM
]
require 'fiddle'
require 'fiddle/import'

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

var (
	shell32 = windows.NewLazySystemDLL("SHELL32.dll")
	procSHShellFolderView_Message = shell32.NewProc("SHShellFolderView_Message")
)

// hwndMain (HWND), uMsg (DWORD), lParam (LPARAM)
r1, _, err := procSHShellFolderView_Message.Call(
	uintptr(hwndMain),
	uintptr(uMsg),
	uintptr(lParam),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // LRESULT
function SHShellFolderView_Message(
  hwndMain: THandle;   // HWND
  uMsg: DWORD;   // DWORD
  lParam: NativeInt   // LPARAM
): NativeInt; stdcall;
  external 'SHELL32.dll' name 'SHShellFolderView_Message';
result := DllCall("SHELL32\SHShellFolderView_Message"
    , "Ptr", hwndMain   ; HWND
    , "UInt", uMsg   ; DWORD
    , "Ptr", lParam   ; LPARAM
    , "Ptr")   ; return: LRESULT
●SHShellFolderView_Message(hwndMain, uMsg, lParam) = DLL("SHELL32.dll", "int SHShellFolderView_Message(void*, dword, int)")
# 呼び出し: SHShellFolderView_Message(hwndMain, uMsg, lParam)
# hwndMain : HWND -> "void*"
# uMsg : DWORD -> "dword"
# lParam : LPARAM -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。