SHGetThreadRef
関数現在のスレッドのスレッド参照オブジェクトを取得する。
シグネチャ
// SHLWAPI.dll
#include <windows.h>
HRESULT SHGetThreadRef(
IUnknown** ppunk
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| ppunk | IUnknown** | out |
戻り値の型: HRESULT
各言語での呼び出し定義
// SHLWAPI.dll
#include <windows.h>
HRESULT SHGetThreadRef(
IUnknown** ppunk
);[DllImport("SHLWAPI.dll", ExactSpelling = true)]
static extern int SHGetThreadRef(
IntPtr ppunk // IUnknown** out
);<DllImport("SHLWAPI.dll", ExactSpelling:=True)>
Public Shared Function SHGetThreadRef(
ppunk As IntPtr ' IUnknown** out
) As Integer
End Function' ppunk : IUnknown** out
Declare PtrSafe Function SHGetThreadRef Lib "shlwapi" ( _
ByVal ppunk As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
SHGetThreadRef = ctypes.windll.shlwapi.SHGetThreadRef
SHGetThreadRef.restype = ctypes.c_int
SHGetThreadRef.argtypes = [
ctypes.c_void_p, # ppunk : IUnknown** out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('SHLWAPI.dll')
SHGetThreadRef = Fiddle::Function.new(
lib['SHGetThreadRef'],
[
Fiddle::TYPE_VOIDP, # ppunk : IUnknown** out
],
Fiddle::TYPE_INT)#[link(name = "shlwapi")]
extern "system" {
fn SHGetThreadRef(
ppunk: *mut *mut core::ffi::c_void // IUnknown** out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("SHLWAPI.dll")]
public static extern int SHGetThreadRef(IntPtr ppunk);
"@
$api = Add-Type -MemberDefinition $sig -Name 'SHLWAPI_SHGetThreadRef' -Namespace Win32 -PassThru
# $api::SHGetThreadRef(ppunk)#uselib "SHLWAPI.dll"
#func global SHGetThreadRef "SHGetThreadRef" sptr
; SHGetThreadRef ppunk ; 戻り値は stat
; ppunk : IUnknown** out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "SHLWAPI.dll"
#cfunc global SHGetThreadRef "SHGetThreadRef" sptr
; res = SHGetThreadRef(ppunk)
; ppunk : IUnknown** out -> "sptr"; HRESULT SHGetThreadRef(IUnknown** ppunk)
#uselib "SHLWAPI.dll"
#cfunc global SHGetThreadRef "SHGetThreadRef" intptr
; res = SHGetThreadRef(ppunk)
; ppunk : IUnknown** out -> "intptr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
shlwapi = windows.NewLazySystemDLL("SHLWAPI.dll")
procSHGetThreadRef = shlwapi.NewProc("SHGetThreadRef")
)
// ppunk (IUnknown** out)
r1, _, err := procSHGetThreadRef.Call(
uintptr(ppunk),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction SHGetThreadRef(
ppunk: Pointer // IUnknown** out
): Integer; stdcall;
external 'SHLWAPI.dll' name 'SHGetThreadRef';result := DllCall("SHLWAPI\SHGetThreadRef"
, "Ptr", ppunk ; IUnknown** out
, "Int") ; return: HRESULT●SHGetThreadRef(ppunk) = DLL("SHLWAPI.dll", "int SHGetThreadRef(void*)")
# 呼び出し: SHGetThreadRef(ppunk)
# ppunk : IUnknown** out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。