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

StrPBrkW

関数
文字集合内のいずれかの文字が最初に現れる位置を探す。
DLLSHLWAPI.dll文字セットUnicode (-W)呼出規約winapi対応OSWindows 2000 以降

シグネチャ

// SHLWAPI.dll  (Unicode / -W)
#include <windows.h>

LPWSTR StrPBrkW(
    LPCWSTR psz,
    LPCWSTR pszSet
);

パラメーター

名前方向
pszLPCWSTRin
pszSetLPCWSTRin

戻り値の型: LPWSTR

各言語での呼び出し定義

// SHLWAPI.dll  (Unicode / -W)
#include <windows.h>

LPWSTR StrPBrkW(
    LPCWSTR psz,
    LPCWSTR pszSet
);
[DllImport("SHLWAPI.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
static extern IntPtr StrPBrkW(
    [MarshalAs(UnmanagedType.LPWStr)] string psz,   // LPCWSTR
    [MarshalAs(UnmanagedType.LPWStr)] string pszSet   // LPCWSTR
);
<DllImport("SHLWAPI.dll", CharSet:=CharSet.Unicode, ExactSpelling:=True)>
Public Shared Function StrPBrkW(
    <MarshalAs(UnmanagedType.LPWStr)> psz As String,   ' LPCWSTR
    <MarshalAs(UnmanagedType.LPWStr)> pszSet As String   ' LPCWSTR
) As IntPtr
End Function
' psz : LPCWSTR
' pszSet : LPCWSTR
Declare PtrSafe Function StrPBrkW Lib "shlwapi" ( _
    ByVal psz As LongPtr, _
    ByVal pszSet As LongPtr) As LongPtr
' 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

StrPBrkW = ctypes.windll.shlwapi.StrPBrkW
StrPBrkW.restype = wintypes.LPWSTR
StrPBrkW.argtypes = [
    wintypes.LPCWSTR,  # psz : LPCWSTR
    wintypes.LPCWSTR,  # pszSet : LPCWSTR
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('SHLWAPI.dll')
StrPBrkW = Fiddle::Function.new(
  lib['StrPBrkW'],
  [
    Fiddle::TYPE_VOIDP,  # psz : LPCWSTR
    Fiddle::TYPE_VOIDP,  # pszSet : LPCWSTR
  ],
  Fiddle::TYPE_VOIDP)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"
#[link(name = "shlwapi")]
extern "system" {
    fn StrPBrkW(
        psz: *const u16,  // LPCWSTR
        pszSet: *const u16  // LPCWSTR
    ) -> *mut u16;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("SHLWAPI.dll", CharSet = CharSet.Unicode)]
public static extern IntPtr StrPBrkW([MarshalAs(UnmanagedType.LPWStr)] string psz, [MarshalAs(UnmanagedType.LPWStr)] string pszSet);
"@
$api = Add-Type -MemberDefinition $sig -Name 'SHLWAPI_StrPBrkW' -Namespace Win32 -PassThru
# $api::StrPBrkW(psz, pszSet)
#uselib "SHLWAPI.dll"
#func global StrPBrkW "StrPBrkW" wptr, wptr
; StrPBrkW psz, pszSet   ; 戻り値は stat
; psz : LPCWSTR -> "wptr"
; pszSet : LPCWSTR -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "SHLWAPI.dll"
#cfunc global StrPBrkW "StrPBrkW" wstr, wstr
; res = StrPBrkW(psz, pszSet)
; psz : LPCWSTR -> "wstr"
; pszSet : LPCWSTR -> "wstr"
; LPWSTR StrPBrkW(LPCWSTR psz, LPCWSTR pszSet)
#uselib "SHLWAPI.dll"
#cfunc global StrPBrkW "StrPBrkW" wstr, wstr
; res = StrPBrkW(psz, pszSet)
; psz : LPCWSTR -> "wstr"
; pszSet : LPCWSTR -> "wstr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	shlwapi = windows.NewLazySystemDLL("SHLWAPI.dll")
	procStrPBrkW = shlwapi.NewProc("StrPBrkW")
)

// psz (LPCWSTR), pszSet (LPCWSTR)
r1, _, err := procStrPBrkW.Call(
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(psz))),
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(pszSet))),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // LPWSTR
function StrPBrkW(
  psz: PWideChar;   // LPCWSTR
  pszSet: PWideChar   // LPCWSTR
): PWideChar; stdcall;
  external 'SHLWAPI.dll' name 'StrPBrkW';
result := DllCall("SHLWAPI\StrPBrkW"
    , "WStr", psz   ; LPCWSTR
    , "WStr", pszSet   ; LPCWSTR
    , "Ptr")   ; return: LPWSTR
●StrPBrkW(psz, pszSet) = DLL("SHLWAPI.dll", "char* StrPBrkW(char*, char*)")
# 呼び出し: StrPBrkW(psz, pszSet)
# psz : LPCWSTR -> "char*"
# pszSet : LPCWSTR -> "char*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※-W(Unicode)関数。なでしこ1はANSIのため -A 版の利用を推奨。