ホーム › System.Diagnostics.Debug › OutputDebugStringA
OutputDebugStringA
関数ANSI文字列をデバッガの出力に送信する。
シグネチャ
// KERNEL32.dll (ANSI / -A)
#include <windows.h>
void OutputDebugStringA(
LPCSTR lpOutputString // optional
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| lpOutputString | LPCSTR | inoptional |
戻り値の型: void
各言語での呼び出し定義
// KERNEL32.dll (ANSI / -A)
#include <windows.h>
void OutputDebugStringA(
LPCSTR lpOutputString // optional
);[DllImport("KERNEL32.dll", CharSet = CharSet.Ansi, ExactSpelling = true)]
static extern void OutputDebugStringA(
[MarshalAs(UnmanagedType.LPStr)] string lpOutputString // LPCSTR optional
);<DllImport("KERNEL32.dll", CharSet:=CharSet.Ansi, ExactSpelling:=True)>
Public Shared Sub OutputDebugStringA(
<MarshalAs(UnmanagedType.LPStr)> lpOutputString As String ' LPCSTR optional
)
End Sub' lpOutputString : LPCSTR optional
Declare PtrSafe Sub OutputDebugStringA Lib "kernel32" ( _
ByVal lpOutputString As String)
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
OutputDebugStringA = ctypes.windll.kernel32.OutputDebugStringA
OutputDebugStringA.restype = None
OutputDebugStringA.argtypes = [
wintypes.LPCSTR, # lpOutputString : LPCSTR optional
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('KERNEL32.dll')
OutputDebugStringA = Fiddle::Function.new(
lib['OutputDebugStringA'],
[
Fiddle::TYPE_VOIDP, # lpOutputString : LPCSTR optional
],
Fiddle::TYPE_VOID)#[link(name = "kernel32")]
extern "system" {
fn OutputDebugStringA(
lpOutputString: *const u8 // LPCSTR optional
);
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("KERNEL32.dll", CharSet = CharSet.Ansi)]
public static extern void OutputDebugStringA([MarshalAs(UnmanagedType.LPStr)] string lpOutputString);
"@
$api = Add-Type -MemberDefinition $sig -Name 'KERNEL32_OutputDebugStringA' -Namespace Win32 -PassThru
# $api::OutputDebugStringA(lpOutputString)#uselib "KERNEL32.dll"
#func global OutputDebugStringA "OutputDebugStringA" sptr
; OutputDebugStringA lpOutputString
; lpOutputString : LPCSTR optional -> "sptr"#uselib "KERNEL32.dll"
#func global OutputDebugStringA "OutputDebugStringA" str
; OutputDebugStringA lpOutputString
; lpOutputString : LPCSTR optional -> "str"; void OutputDebugStringA(LPCSTR lpOutputString)
#uselib "KERNEL32.dll"
#func global OutputDebugStringA "OutputDebugStringA" str
; OutputDebugStringA lpOutputString
; lpOutputString : LPCSTR optional -> "str"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
kernel32 = windows.NewLazySystemDLL("KERNEL32.dll")
procOutputDebugStringA = kernel32.NewProc("OutputDebugStringA")
)
// lpOutputString (LPCSTR optional)
r1, _, err := procOutputDebugStringA.Call(
uintptr(unsafe.Pointer(windows.BytePtrFromString(lpOutputString))),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // voidprocedure OutputDebugStringA(
lpOutputString: PAnsiChar // LPCSTR optional
); stdcall;
external 'KERNEL32.dll' name 'OutputDebugStringA';result := DllCall("KERNEL32\OutputDebugStringA"
, "AStr", lpOutputString ; LPCSTR optional
, "Int") ; return: void●OutputDebugStringA(lpOutputString) = DLL("KERNEL32.dll", "int OutputDebugStringA(char*)")
# 呼び出し: OutputDebugStringA(lpOutputString)
# lpOutputString : LPCSTR optional -> "char*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。