DuplicateIcon
関数アイコンを複製して新しいハンドルを返す。
シグネチャ
// SHELL32.dll
#include <windows.h>
HICON DuplicateIcon(
HINSTANCE hInst, // optional
HICON hIcon
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hInst | HINSTANCE | optional |
| hIcon | HICON | in |
戻り値の型: HICON
各言語での呼び出し定義
// SHELL32.dll
#include <windows.h>
HICON DuplicateIcon(
HINSTANCE hInst, // optional
HICON hIcon
);[DllImport("SHELL32.dll", ExactSpelling = true)]
static extern IntPtr DuplicateIcon(
IntPtr hInst, // HINSTANCE optional
IntPtr hIcon // HICON
);<DllImport("SHELL32.dll", ExactSpelling:=True)>
Public Shared Function DuplicateIcon(
hInst As IntPtr, ' HINSTANCE optional
hIcon As IntPtr ' HICON
) As IntPtr
End Function' hInst : HINSTANCE optional
' hIcon : HICON
Declare PtrSafe Function DuplicateIcon Lib "shell32" ( _
ByVal hInst As LongPtr, _
ByVal hIcon As LongPtr) As LongPtr
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
DuplicateIcon = ctypes.windll.shell32.DuplicateIcon
DuplicateIcon.restype = ctypes.c_void_p
DuplicateIcon.argtypes = [
wintypes.HANDLE, # hInst : HINSTANCE optional
wintypes.HANDLE, # hIcon : HICON
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('SHELL32.dll')
DuplicateIcon = Fiddle::Function.new(
lib['DuplicateIcon'],
[
Fiddle::TYPE_VOIDP, # hInst : HINSTANCE optional
Fiddle::TYPE_VOIDP, # hIcon : HICON
],
Fiddle::TYPE_VOIDP)#[link(name = "shell32")]
extern "system" {
fn DuplicateIcon(
hInst: *mut core::ffi::c_void, // HINSTANCE optional
hIcon: *mut core::ffi::c_void // HICON
) -> *mut core::ffi::c_void;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("SHELL32.dll")]
public static extern IntPtr DuplicateIcon(IntPtr hInst, IntPtr hIcon);
"@
$api = Add-Type -MemberDefinition $sig -Name 'SHELL32_DuplicateIcon' -Namespace Win32 -PassThru
# $api::DuplicateIcon(hInst, hIcon)#uselib "SHELL32.dll"
#func global DuplicateIcon "DuplicateIcon" sptr, sptr
; DuplicateIcon hInst, hIcon ; 戻り値は stat
; hInst : HINSTANCE optional -> "sptr"
; hIcon : HICON -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "SHELL32.dll"
#cfunc global DuplicateIcon "DuplicateIcon" sptr, sptr
; res = DuplicateIcon(hInst, hIcon)
; hInst : HINSTANCE optional -> "sptr"
; hIcon : HICON -> "sptr"; HICON DuplicateIcon(HINSTANCE hInst, HICON hIcon)
#uselib "SHELL32.dll"
#cfunc global DuplicateIcon "DuplicateIcon" intptr, intptr
; res = DuplicateIcon(hInst, hIcon)
; hInst : HINSTANCE optional -> "intptr"
; hIcon : HICON -> "intptr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
shell32 = windows.NewLazySystemDLL("SHELL32.dll")
procDuplicateIcon = shell32.NewProc("DuplicateIcon")
)
// hInst (HINSTANCE optional), hIcon (HICON)
r1, _, err := procDuplicateIcon.Call(
uintptr(hInst),
uintptr(hIcon),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HICONfunction DuplicateIcon(
hInst: THandle; // HINSTANCE optional
hIcon: THandle // HICON
): THandle; stdcall;
external 'SHELL32.dll' name 'DuplicateIcon';result := DllCall("SHELL32\DuplicateIcon"
, "Ptr", hInst ; HINSTANCE optional
, "Ptr", hIcon ; HICON
, "Ptr") ; return: HICON●DuplicateIcon(hInst, hIcon) = DLL("SHELL32.dll", "void* DuplicateIcon(void*, void*)")
# 呼び出し: DuplicateIcon(hInst, hIcon)
# hInst : HINSTANCE optional -> "void*"
# hIcon : HICON -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。