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