Win32 API 日本語リファレンス
ホームUI.WindowsAndMessaging › RemovePropA

RemovePropA

関数
ウィンドウのプロパティリストから項目を削除する(ANSI版)。
DLLUSER32.dll文字セットANSI (-A)呼出規約winapiSetLastErrorあり対応OSWindows 2000 以降

シグネチャ

// USER32.dll  (ANSI / -A)
#include <windows.h>

HANDLE RemovePropA(
    HWND hWnd,
    LPCSTR lpString
);

パラメーター

名前方向
hWndHWNDin
lpStringLPCSTRin

戻り値の型: HANDLE

各言語での呼び出し定義

// USER32.dll  (ANSI / -A)
#include <windows.h>

HANDLE RemovePropA(
    HWND hWnd,
    LPCSTR lpString
);
[DllImport("USER32.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
static extern IntPtr RemovePropA(
    IntPtr hWnd,   // HWND
    [MarshalAs(UnmanagedType.LPStr)] string lpString   // LPCSTR
);
<DllImport("USER32.dll", CharSet:=CharSet.Ansi, SetLastError:=True, ExactSpelling:=True)>
Public Shared Function RemovePropA(
    hWnd As IntPtr,   ' HWND
    <MarshalAs(UnmanagedType.LPStr)> lpString As String   ' LPCSTR
) As IntPtr
End Function
' hWnd : HWND
' lpString : LPCSTR
Declare PtrSafe Function RemovePropA Lib "user32" ( _
    ByVal hWnd As LongPtr, _
    ByVal lpString As String) As LongPtr
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

RemovePropA = ctypes.windll.user32.RemovePropA
RemovePropA.restype = ctypes.c_void_p
RemovePropA.argtypes = [
    wintypes.HANDLE,  # hWnd : HWND
    wintypes.LPCSTR,  # lpString : LPCSTR
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('USER32.dll')
RemovePropA = Fiddle::Function.new(
  lib['RemovePropA'],
  [
    Fiddle::TYPE_VOIDP,  # hWnd : HWND
    Fiddle::TYPE_VOIDP,  # lpString : LPCSTR
  ],
  Fiddle::TYPE_VOIDP)
#[link(name = "user32")]
extern "system" {
    fn RemovePropA(
        hWnd: *mut core::ffi::c_void,  // HWND
        lpString: *const u8  // LPCSTR
    ) -> *mut core::ffi::c_void;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("USER32.dll", CharSet = CharSet.Ansi, SetLastError = true)]
public static extern IntPtr RemovePropA(IntPtr hWnd, [MarshalAs(UnmanagedType.LPStr)] string lpString);
"@
$api = Add-Type -MemberDefinition $sig -Name 'USER32_RemovePropA' -Namespace Win32 -PassThru
# $api::RemovePropA(hWnd, lpString)
#uselib "USER32.dll"
#func global RemovePropA "RemovePropA" sptr, sptr
; RemovePropA hWnd, lpString   ; 戻り値は stat
; hWnd : HWND -> "sptr"
; lpString : LPCSTR -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "USER32.dll"
#cfunc global RemovePropA "RemovePropA" sptr, str
; res = RemovePropA(hWnd, lpString)
; hWnd : HWND -> "sptr"
; lpString : LPCSTR -> "str"
; HANDLE RemovePropA(HWND hWnd, LPCSTR lpString)
#uselib "USER32.dll"
#cfunc global RemovePropA "RemovePropA" intptr, str
; res = RemovePropA(hWnd, lpString)
; hWnd : HWND -> "intptr"
; lpString : LPCSTR -> "str"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	user32 = windows.NewLazySystemDLL("USER32.dll")
	procRemovePropA = user32.NewProc("RemovePropA")
)

// hWnd (HWND), lpString (LPCSTR)
r1, _, err := procRemovePropA.Call(
	uintptr(hWnd),
	uintptr(unsafe.Pointer(windows.BytePtrFromString(lpString))),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // HANDLE
function RemovePropA(
  hWnd: THandle;   // HWND
  lpString: PAnsiChar   // LPCSTR
): THandle; stdcall;
  external 'USER32.dll' name 'RemovePropA';
result := DllCall("USER32\RemovePropA"
    , "Ptr", hWnd   ; HWND
    , "AStr", lpString   ; LPCSTR
    , "Ptr")   ; return: HANDLE
●RemovePropA(hWnd, lpString) = DLL("USER32.dll", "void* RemovePropA(void*, char*)")
# 呼び出し: RemovePropA(hWnd, lpString)
# hWnd : HWND -> "void*"
# lpString : LPCSTR -> "char*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。