ホーム › System.Threading › CreateBoundaryDescriptorA
CreateBoundaryDescriptorA
関数プライベート名前空間用の境界記述子を作成する(ANSI版)。
シグネチャ
// KERNEL32.dll (ANSI / -A)
#include <windows.h>
HANDLE CreateBoundaryDescriptorA(
LPCSTR Name,
DWORD Flags
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| Name | LPCSTR | in |
| Flags | DWORD | in |
戻り値の型: HANDLE
各言語での呼び出し定義
// KERNEL32.dll (ANSI / -A)
#include <windows.h>
HANDLE CreateBoundaryDescriptorA(
LPCSTR Name,
DWORD Flags
);[DllImport("KERNEL32.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
static extern IntPtr CreateBoundaryDescriptorA(
[MarshalAs(UnmanagedType.LPStr)] string Name, // LPCSTR
uint Flags // DWORD
);<DllImport("KERNEL32.dll", CharSet:=CharSet.Ansi, SetLastError:=True, ExactSpelling:=True)>
Public Shared Function CreateBoundaryDescriptorA(
<MarshalAs(UnmanagedType.LPStr)> Name As String, ' LPCSTR
Flags As UInteger ' DWORD
) As IntPtr
End Function' Name : LPCSTR
' Flags : DWORD
Declare PtrSafe Function CreateBoundaryDescriptorA Lib "kernel32" ( _
ByVal Name As String, _
ByVal Flags As Long) As LongPtr
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
CreateBoundaryDescriptorA = ctypes.windll.kernel32.CreateBoundaryDescriptorA
CreateBoundaryDescriptorA.restype = ctypes.c_void_p
CreateBoundaryDescriptorA.argtypes = [
wintypes.LPCSTR, # Name : LPCSTR
wintypes.DWORD, # Flags : DWORD
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('KERNEL32.dll')
CreateBoundaryDescriptorA = Fiddle::Function.new(
lib['CreateBoundaryDescriptorA'],
[
Fiddle::TYPE_VOIDP, # Name : LPCSTR
-Fiddle::TYPE_INT, # Flags : DWORD
],
Fiddle::TYPE_VOIDP)#[link(name = "kernel32")]
extern "system" {
fn CreateBoundaryDescriptorA(
Name: *const u8, // LPCSTR
Flags: u32 // DWORD
) -> *mut core::ffi::c_void;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("KERNEL32.dll", CharSet = CharSet.Ansi, SetLastError = true)]
public static extern IntPtr CreateBoundaryDescriptorA([MarshalAs(UnmanagedType.LPStr)] string Name, uint Flags);
"@
$api = Add-Type -MemberDefinition $sig -Name 'KERNEL32_CreateBoundaryDescriptorA' -Namespace Win32 -PassThru
# $api::CreateBoundaryDescriptorA(Name, Flags)#uselib "KERNEL32.dll"
#func global CreateBoundaryDescriptorA "CreateBoundaryDescriptorA" sptr, sptr
; CreateBoundaryDescriptorA Name, Flags ; 戻り値は stat
; Name : LPCSTR -> "sptr"
; Flags : DWORD -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "KERNEL32.dll"
#cfunc global CreateBoundaryDescriptorA "CreateBoundaryDescriptorA" str, int
; res = CreateBoundaryDescriptorA(Name, Flags)
; Name : LPCSTR -> "str"
; Flags : DWORD -> "int"; HANDLE CreateBoundaryDescriptorA(LPCSTR Name, DWORD Flags)
#uselib "KERNEL32.dll"
#cfunc global CreateBoundaryDescriptorA "CreateBoundaryDescriptorA" str, int
; res = CreateBoundaryDescriptorA(Name, Flags)
; Name : LPCSTR -> "str"
; Flags : DWORD -> "int"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
kernel32 = windows.NewLazySystemDLL("KERNEL32.dll")
procCreateBoundaryDescriptorA = kernel32.NewProc("CreateBoundaryDescriptorA")
)
// Name (LPCSTR), Flags (DWORD)
r1, _, err := procCreateBoundaryDescriptorA.Call(
uintptr(unsafe.Pointer(windows.BytePtrFromString(Name))),
uintptr(Flags),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HANDLEfunction CreateBoundaryDescriptorA(
Name: PAnsiChar; // LPCSTR
Flags: DWORD // DWORD
): THandle; stdcall;
external 'KERNEL32.dll' name 'CreateBoundaryDescriptorA';result := DllCall("KERNEL32\CreateBoundaryDescriptorA"
, "AStr", Name ; LPCSTR
, "UInt", Flags ; DWORD
, "Ptr") ; return: HANDLE●CreateBoundaryDescriptorA(Name, Flags) = DLL("KERNEL32.dll", "void* CreateBoundaryDescriptorA(char*, dword)")
# 呼び出し: CreateBoundaryDescriptorA(Name, Flags)
# Name : LPCSTR -> "char*"
# Flags : DWORD -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。