SHShellFolderView_Message
関数シェルフォルダービューにメッセージを送信する。
シグネチャ
// SHELL32.dll
#include <windows.h>
LRESULT SHShellFolderView_Message(
HWND hwndMain,
DWORD uMsg,
LPARAM lParam
);パラメーター
| 名前 | 型 | 方向 | 説明 | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| hwndMain | HWND | in | メッセージを受け取るウィンドウへのハンドルです。 | ||||||||||||||||||
| uMsg | DWORD | in | 送信するメッセージです。以下は指定可能なメッセージの一覧です。
| ||||||||||||||||||
| lParam | LPARAM | in | この値の内容は、uMsg で渡されるメッセージによって異なります。詳細については個々のメッセージのトピックを参照してください。 |
戻り値の型: LRESULT
公式ドキュメント
SHShellFolderView_Message は変更されるか、利用できなくなる可能性があります。
戻り値
型: LRESULT
戻り値は uMsg で渡されるメッセージによって異なります。詳細については個々のメッセージのトピックを参照してください。
出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
各言語での呼び出し定義
// 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 // LRESULTfunction 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)。const std = @import("std");
extern "shell32" fn SHShellFolderView_Message(
hwndMain: ?*anyopaque, // HWND
uMsg: u32, // DWORD
lParam: isize // LPARAM
) callconv(std.os.windows.WINAPI) isize;proc SHShellFolderView_Message(
hwndMain: pointer, # HWND
uMsg: uint32, # DWORD
lParam: int # LPARAM
): int {.importc: "SHShellFolderView_Message", stdcall, dynlib: "SHELL32.dll".}pragma(lib, "shell32");
extern(Windows)
ptrdiff_t SHShellFolderView_Message(
void* hwndMain, // HWND
uint uMsg, // DWORD
ptrdiff_t lParam // LPARAM
);ccall((:SHShellFolderView_Message, "SHELL32.dll"), stdcall, Int,
(Ptr{Cvoid}, UInt32, Int),
hwndMain, uMsg, lParam)
# hwndMain : HWND -> Ptr{Cvoid}
# uMsg : DWORD -> UInt32
# lParam : LPARAM -> Int
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
intptr_t SHShellFolderView_Message(
void* hwndMain,
uint32_t uMsg,
intptr_t lParam);
]]
local shell32 = ffi.load("shell32")
-- shell32.SHShellFolderView_Message(hwndMain, uMsg, lParam)
-- hwndMain : HWND
-- uMsg : DWORD
-- lParam : LPARAM
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('SHELL32.dll');
const SHShellFolderView_Message = lib.func('__stdcall', 'SHShellFolderView_Message', 'intptr_t', ['void *', 'uint32_t', 'intptr_t']);
// SHShellFolderView_Message(hwndMain, uMsg, lParam)
// hwndMain : HWND -> 'void *'
// uMsg : DWORD -> 'uint32_t'
// lParam : LPARAM -> 'intptr_t'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("SHELL32.dll", {
SHShellFolderView_Message: { parameters: ["pointer", "u32", "isize"], result: "isize" },
});
// lib.symbols.SHShellFolderView_Message(hwndMain, uMsg, lParam)
// hwndMain : HWND -> "pointer"
// uMsg : DWORD -> "u32"
// lParam : LPARAM -> "isize"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
intptr_t SHShellFolderView_Message(
void* hwndMain,
uint32_t uMsg,
intptr_t lParam);
C, "SHELL32.dll");
// $ffi->SHShellFolderView_Message(hwndMain, uMsg, lParam);
// hwndMain : HWND
// uMsg : DWORD
// lParam : LPARAM
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
// WINAPI(stdcall): x64 では呼出規約が統一されるため問題なし。x86 では __stdcall 対応のラッパが必要な場合あり。import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;
public interface Shell32 extends StdCallLibrary {
Shell32 INSTANCE = Native.load("shell32", Shell32.class);
long SHShellFolderView_Message(
Pointer hwndMain, // HWND
int uMsg, // DWORD
long lParam // LPARAM
);
}@[Link("shell32")]
lib LibSHELL32
fun SHShellFolderView_Message = SHShellFolderView_Message(
hwndMain : Void*, # HWND
uMsg : UInt32, # DWORD
lParam : LibC::SSizeT # LPARAM
) : LibC::SSizeT
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef SHShellFolderView_MessageNative = IntPtr Function(Pointer<Void>, Uint32, IntPtr);
typedef SHShellFolderView_MessageDart = int Function(Pointer<Void>, int, int);
final SHShellFolderView_Message = DynamicLibrary.open('SHELL32.dll')
.lookupFunction<SHShellFolderView_MessageNative, SHShellFolderView_MessageDart>('SHShellFolderView_Message');
// hwndMain : HWND -> Pointer<Void>
// uMsg : DWORD -> Uint32
// lParam : LPARAM -> IntPtr
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function SHShellFolderView_Message(
hwndMain: THandle; // HWND
uMsg: DWORD; // DWORD
lParam: NativeInt // LPARAM
): NativeInt; stdcall;
external 'SHELL32.dll' name 'SHShellFolderView_Message';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "SHShellFolderView_Message"
c_SHShellFolderView_Message :: Ptr () -> Word32 -> CIntPtr -> IO CIntPtr
-- hwndMain : HWND -> Ptr ()
-- uMsg : DWORD -> Word32
-- lParam : LPARAM -> CIntPtr
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let shshellfolderview_message =
foreign "SHShellFolderView_Message"
((ptr void) @-> uint32_t @-> intptr_t @-> returning intptr_t)
(* hwndMain : HWND -> (ptr void) *)
(* uMsg : DWORD -> uint32_t *)
(* lParam : LPARAM -> intptr_t *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library shell32 (t "SHELL32.dll"))
(cffi:use-foreign-library shell32)
(cffi:defcfun ("SHShellFolderView_Message" shshell-folder-view-message :convention :stdcall) :int64
(hwnd-main :pointer) ; HWND
(u-msg :uint32) ; DWORD
(l-param :int64)) ; LPARAM
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $SHShellFolderView_Message = Win32::API::More->new('SHELL32',
'LPARAM SHShellFolderView_Message(HANDLE hwndMain, DWORD uMsg, LPARAM lParam)');
# my $ret = $SHShellFolderView_Message->Call($hwndMain, $uMsg, $lParam);
# hwndMain : HWND -> HANDLE
# uMsg : DWORD -> DWORD
# lParam : LPARAM -> LPARAM
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。関連項目
公式の関連項目
- f SHCreateShellFolderView — シェルフォルダービュー(IShellView)を生成する。