Win32 API 日本語リファレンス
ホームSystem.Ole › OleIconToCursor

OleIconToCursor

関数
アイコンハンドルからカーソルハンドルを作成する。
DLLOLEAUT32.dll呼出規約winapi対応OSWindows 2000 以降

シグネチャ

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

HCURSOR OleIconToCursor(
    HINSTANCE hinstExe,
    HICON hIcon
);

パラメーター

名前方向
hinstExeHINSTANCEin
hIconHICONin

戻り値の型: HCURSOR

各言語での呼び出し定義

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

HCURSOR OleIconToCursor(
    HINSTANCE hinstExe,
    HICON hIcon
);
[DllImport("OLEAUT32.dll", ExactSpelling = true)]
static extern IntPtr OleIconToCursor(
    IntPtr hinstExe,   // HINSTANCE
    IntPtr hIcon   // HICON
);
<DllImport("OLEAUT32.dll", ExactSpelling:=True)>
Public Shared Function OleIconToCursor(
    hinstExe As IntPtr,   ' HINSTANCE
    hIcon As IntPtr   ' HICON
) As IntPtr
End Function
' hinstExe : HINSTANCE
' hIcon : HICON
Declare PtrSafe Function OleIconToCursor Lib "oleaut32" ( _
    ByVal hinstExe 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

OleIconToCursor = ctypes.windll.oleaut32.OleIconToCursor
OleIconToCursor.restype = ctypes.c_void_p
OleIconToCursor.argtypes = [
    wintypes.HANDLE,  # hinstExe : HINSTANCE
    wintypes.HANDLE,  # hIcon : HICON
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('OLEAUT32.dll')
OleIconToCursor = Fiddle::Function.new(
  lib['OleIconToCursor'],
  [
    Fiddle::TYPE_VOIDP,  # hinstExe : HINSTANCE
    Fiddle::TYPE_VOIDP,  # hIcon : HICON
  ],
  Fiddle::TYPE_VOIDP)
#[link(name = "oleaut32")]
extern "system" {
    fn OleIconToCursor(
        hinstExe: *mut core::ffi::c_void,  // HINSTANCE
        hIcon: *mut core::ffi::c_void  // HICON
    ) -> *mut core::ffi::c_void;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("OLEAUT32.dll")]
public static extern IntPtr OleIconToCursor(IntPtr hinstExe, IntPtr hIcon);
"@
$api = Add-Type -MemberDefinition $sig -Name 'OLEAUT32_OleIconToCursor' -Namespace Win32 -PassThru
# $api::OleIconToCursor(hinstExe, hIcon)
#uselib "OLEAUT32.dll"
#func global OleIconToCursor "OleIconToCursor" sptr, sptr
; OleIconToCursor hinstExe, hIcon   ; 戻り値は stat
; hinstExe : HINSTANCE -> "sptr"
; hIcon : HICON -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "OLEAUT32.dll"
#cfunc global OleIconToCursor "OleIconToCursor" sptr, sptr
; res = OleIconToCursor(hinstExe, hIcon)
; hinstExe : HINSTANCE -> "sptr"
; hIcon : HICON -> "sptr"
; HCURSOR OleIconToCursor(HINSTANCE hinstExe, HICON hIcon)
#uselib "OLEAUT32.dll"
#cfunc global OleIconToCursor "OleIconToCursor" intptr, intptr
; res = OleIconToCursor(hinstExe, hIcon)
; hinstExe : HINSTANCE -> "intptr"
; hIcon : HICON -> "intptr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	oleaut32 = windows.NewLazySystemDLL("OLEAUT32.dll")
	procOleIconToCursor = oleaut32.NewProc("OleIconToCursor")
)

// hinstExe (HINSTANCE), hIcon (HICON)
r1, _, err := procOleIconToCursor.Call(
	uintptr(hinstExe),
	uintptr(hIcon),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // HCURSOR
function OleIconToCursor(
  hinstExe: THandle;   // HINSTANCE
  hIcon: THandle   // HICON
): THandle; stdcall;
  external 'OLEAUT32.dll' name 'OleIconToCursor';
result := DllCall("OLEAUT32\OleIconToCursor"
    , "Ptr", hinstExe   ; HINSTANCE
    , "Ptr", hIcon   ; HICON
    , "Ptr")   ; return: HCURSOR
●OleIconToCursor(hinstExe, hIcon) = DLL("OLEAUT32.dll", "void* OleIconToCursor(void*, void*)")
# 呼び出し: OleIconToCursor(hinstExe, hIcon)
# hinstExe : HINSTANCE -> "void*"
# hIcon : HICON -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。