ホーム › System.Pipes › WaitNamedPipeW
WaitNamedPipeW
関数名前付きパイプが利用可能になるまで待機する。
シグネチャ
// KERNEL32.dll (Unicode / -W)
#include <windows.h>
BOOL WaitNamedPipeW(
LPCWSTR lpNamedPipeName,
DWORD nTimeOut
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| lpNamedPipeName | LPCWSTR | in |
| nTimeOut | DWORD | in |
戻り値の型: BOOL
各言語での呼び出し定義
// KERNEL32.dll (Unicode / -W)
#include <windows.h>
BOOL WaitNamedPipeW(
LPCWSTR lpNamedPipeName,
DWORD nTimeOut
);[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("KERNEL32.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
static extern bool WaitNamedPipeW(
[MarshalAs(UnmanagedType.LPWStr)] string lpNamedPipeName, // LPCWSTR
uint nTimeOut // DWORD
);<DllImport("KERNEL32.dll", CharSet:=CharSet.Unicode, ExactSpelling:=True)>
Public Shared Function WaitNamedPipeW(
<MarshalAs(UnmanagedType.LPWStr)> lpNamedPipeName As String, ' LPCWSTR
nTimeOut As UInteger ' DWORD
) As Boolean
End Function' lpNamedPipeName : LPCWSTR
' nTimeOut : DWORD
Declare PtrSafe Function WaitNamedPipeW Lib "kernel32" ( _
ByVal lpNamedPipeName As LongPtr, _
ByVal nTimeOut As Long) As Long
' Unicode(W): 文字列は ByVal As LongPtr とし StrPtr(unicodeStr) を渡す
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
WaitNamedPipeW = ctypes.windll.kernel32.WaitNamedPipeW
WaitNamedPipeW.restype = wintypes.BOOL
WaitNamedPipeW.argtypes = [
wintypes.LPCWSTR, # lpNamedPipeName : LPCWSTR
wintypes.DWORD, # nTimeOut : DWORD
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('KERNEL32.dll')
WaitNamedPipeW = Fiddle::Function.new(
lib['WaitNamedPipeW'],
[
Fiddle::TYPE_VOIDP, # lpNamedPipeName : LPCWSTR
-Fiddle::TYPE_INT, # nTimeOut : DWORD
],
Fiddle::TYPE_INT)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"#[link(name = "kernel32")]
extern "system" {
fn WaitNamedPipeW(
lpNamedPipeName: *const u16, // LPCWSTR
nTimeOut: u32 // DWORD
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("KERNEL32.dll", CharSet = CharSet.Unicode)]
public static extern bool WaitNamedPipeW([MarshalAs(UnmanagedType.LPWStr)] string lpNamedPipeName, uint nTimeOut);
"@
$api = Add-Type -MemberDefinition $sig -Name 'KERNEL32_WaitNamedPipeW' -Namespace Win32 -PassThru
# $api::WaitNamedPipeW(lpNamedPipeName, nTimeOut)#uselib "KERNEL32.dll"
#func global WaitNamedPipeW "WaitNamedPipeW" wptr, wptr
; WaitNamedPipeW lpNamedPipeName, nTimeOut ; 戻り値は stat
; lpNamedPipeName : LPCWSTR -> "wptr"
; nTimeOut : DWORD -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "KERNEL32.dll"
#cfunc global WaitNamedPipeW "WaitNamedPipeW" wstr, int
; res = WaitNamedPipeW(lpNamedPipeName, nTimeOut)
; lpNamedPipeName : LPCWSTR -> "wstr"
; nTimeOut : DWORD -> "int"; BOOL WaitNamedPipeW(LPCWSTR lpNamedPipeName, DWORD nTimeOut)
#uselib "KERNEL32.dll"
#cfunc global WaitNamedPipeW "WaitNamedPipeW" wstr, int
; res = WaitNamedPipeW(lpNamedPipeName, nTimeOut)
; lpNamedPipeName : LPCWSTR -> "wstr"
; nTimeOut : DWORD -> "int"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
kernel32 = windows.NewLazySystemDLL("KERNEL32.dll")
procWaitNamedPipeW = kernel32.NewProc("WaitNamedPipeW")
)
// lpNamedPipeName (LPCWSTR), nTimeOut (DWORD)
r1, _, err := procWaitNamedPipeW.Call(
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(lpNamedPipeName))),
uintptr(nTimeOut),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // BOOLfunction WaitNamedPipeW(
lpNamedPipeName: PWideChar; // LPCWSTR
nTimeOut: DWORD // DWORD
): BOOL; stdcall;
external 'KERNEL32.dll' name 'WaitNamedPipeW';result := DllCall("KERNEL32\WaitNamedPipeW"
, "WStr", lpNamedPipeName ; LPCWSTR
, "UInt", nTimeOut ; DWORD
, "Int") ; return: BOOL●WaitNamedPipeW(lpNamedPipeName, nTimeOut) = DLL("KERNEL32.dll", "bool WaitNamedPipeW(char*, dword)")
# 呼び出し: WaitNamedPipeW(lpNamedPipeName, nTimeOut)
# lpNamedPipeName : LPCWSTR -> "char*"
# nTimeOut : DWORD -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※-W(Unicode)関数。なでしこ1はANSIのため -A 版の利用を推奨。