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

DeleteAtom

関数
ローカルアトムテーブルのアトム参照カウントを減らし削除する。
DLLKERNEL32.dll呼出規約winapiSetLastErrorあり対応OSWindows 2000 以降

シグネチャ

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

WORD DeleteAtom(
    WORD nAtom
);

パラメーター

名前方向
nAtomWORDin

戻り値の型: WORD

各言語での呼び出し定義

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

WORD DeleteAtom(
    WORD nAtom
);
[DllImport("KERNEL32.dll", SetLastError = true, ExactSpelling = true)]
static extern ushort DeleteAtom(
    ushort nAtom   // WORD
);
<DllImport("KERNEL32.dll", SetLastError:=True, ExactSpelling:=True)>
Public Shared Function DeleteAtom(
    nAtom As UShort   ' WORD
) As UShort
End Function
' nAtom : WORD
Declare PtrSafe Function DeleteAtom Lib "kernel32" ( _
    ByVal nAtom As Integer) As Integer
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

DeleteAtom = ctypes.windll.kernel32.DeleteAtom
DeleteAtom.restype = ctypes.c_ushort
DeleteAtom.argtypes = [
    ctypes.c_ushort,  # nAtom : WORD
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('KERNEL32.dll')
DeleteAtom = Fiddle::Function.new(
  lib['DeleteAtom'],
  [
    -Fiddle::TYPE_SHORT,  # nAtom : WORD
  ],
  -Fiddle::TYPE_SHORT)
#[link(name = "kernel32")]
extern "system" {
    fn DeleteAtom(
        nAtom: u16  // WORD
    ) -> u16;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("KERNEL32.dll", SetLastError = true)]
public static extern ushort DeleteAtom(ushort nAtom);
"@
$api = Add-Type -MemberDefinition $sig -Name 'KERNEL32_DeleteAtom' -Namespace Win32 -PassThru
# $api::DeleteAtom(nAtom)
#uselib "KERNEL32.dll"
#func global DeleteAtom "DeleteAtom" sptr
; DeleteAtom nAtom   ; 戻り値は stat
; nAtom : WORD -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "KERNEL32.dll"
#cfunc global DeleteAtom "DeleteAtom" int
; res = DeleteAtom(nAtom)
; nAtom : WORD -> "int"
; WORD DeleteAtom(WORD nAtom)
#uselib "KERNEL32.dll"
#cfunc global DeleteAtom "DeleteAtom" int
; res = DeleteAtom(nAtom)
; nAtom : WORD -> "int"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	kernel32 = windows.NewLazySystemDLL("KERNEL32.dll")
	procDeleteAtom = kernel32.NewProc("DeleteAtom")
)

// nAtom (WORD)
r1, _, err := procDeleteAtom.Call(
	uintptr(nAtom),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // WORD
function DeleteAtom(
  nAtom: Word   // WORD
): Word; stdcall;
  external 'KERNEL32.dll' name 'DeleteAtom';
result := DllCall("KERNEL32\DeleteAtom"
    , "UShort", nAtom   ; WORD
    , "UShort")   ; return: WORD
●DeleteAtom(nAtom) = DLL("KERNEL32.dll", "int DeleteAtom(int)")
# 呼び出し: DeleteAtom(nAtom)
# nAtom : WORD -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。