ホーム › UI.WindowsAndMessaging › GetCursor
GetCursor
関数現在のマウスカーソルのハンドルを取得する。
シグネチャ
// USER32.dll
#include <windows.h>
HCURSOR GetCursor(void);パラメーターなし。戻り値: HCURSOR
各言語での呼び出し定義
// USER32.dll
#include <windows.h>
HCURSOR GetCursor(void);[DllImport("USER32.dll", ExactSpelling = true)]
static extern IntPtr GetCursor();<DllImport("USER32.dll", ExactSpelling:=True)>
Public Shared Function GetCursor() As IntPtr
End FunctionDeclare PtrSafe Function GetCursor Lib "user32" () As LongPtr
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
GetCursor = ctypes.windll.user32.GetCursor
GetCursor.restype = ctypes.c_void_p
GetCursor.argtypes = []require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('USER32.dll')
GetCursor = Fiddle::Function.new(
lib['GetCursor'],
[],
Fiddle::TYPE_VOIDP)#[link(name = "user32")]
extern "system" {
fn GetCursor() -> *mut core::ffi::c_void;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("USER32.dll")]
public static extern IntPtr GetCursor();
"@
$api = Add-Type -MemberDefinition $sig -Name 'USER32_GetCursor' -Namespace Win32 -PassThru
# $api::GetCursor()#uselib "USER32.dll"
#func global GetCursor "GetCursor"
; GetCursor ; 戻り値は stat
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "USER32.dll"
#cfunc global GetCursor "GetCursor"
; res = GetCursor(); HCURSOR GetCursor()
#uselib "USER32.dll"
#cfunc global GetCursor "GetCursor"
; res = GetCursor()import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
user32 = windows.NewLazySystemDLL("USER32.dll")
procGetCursor = user32.NewProc("GetCursor")
)
r1, _, err := procGetCursor.Call()
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HCURSORfunction GetCursor: THandle; stdcall;
external 'USER32.dll' name 'GetCursor';result := DllCall("USER32\GetCursor", "Ptr")●GetCursor() = DLL("USER32.dll", "void* GetCursor()")
# 呼び出し: GetCursor()
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。