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