StrChrIA
関数大文字小文字を区別せず最初の指定文字を検索する。
シグネチャ
// SHLWAPI.dll (ANSI / -A)
#include <windows.h>
LPSTR StrChrIA(
LPCSTR pszStart,
WORD wMatch
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| pszStart | LPCSTR | in |
| wMatch | WORD | in |
戻り値の型: LPSTR
各言語での呼び出し定義
// SHLWAPI.dll (ANSI / -A)
#include <windows.h>
LPSTR StrChrIA(
LPCSTR pszStart,
WORD wMatch
);[DllImport("SHLWAPI.dll", CharSet = CharSet.Ansi, ExactSpelling = true)]
static extern IntPtr StrChrIA(
[MarshalAs(UnmanagedType.LPStr)] string pszStart, // LPCSTR
ushort wMatch // WORD
);<DllImport("SHLWAPI.dll", CharSet:=CharSet.Ansi, ExactSpelling:=True)>
Public Shared Function StrChrIA(
<MarshalAs(UnmanagedType.LPStr)> pszStart As String, ' LPCSTR
wMatch As UShort ' WORD
) As IntPtr
End Function' pszStart : LPCSTR
' wMatch : WORD
Declare PtrSafe Function StrChrIA Lib "shlwapi" ( _
ByVal pszStart As String, _
ByVal wMatch As Integer) As LongPtr
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
StrChrIA = ctypes.windll.shlwapi.StrChrIA
StrChrIA.restype = wintypes.LPSTR
StrChrIA.argtypes = [
wintypes.LPCSTR, # pszStart : LPCSTR
ctypes.c_ushort, # wMatch : WORD
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('SHLWAPI.dll')
StrChrIA = Fiddle::Function.new(
lib['StrChrIA'],
[
Fiddle::TYPE_VOIDP, # pszStart : LPCSTR
-Fiddle::TYPE_SHORT, # wMatch : WORD
],
Fiddle::TYPE_VOIDP)#[link(name = "shlwapi")]
extern "system" {
fn StrChrIA(
pszStart: *const u8, // LPCSTR
wMatch: u16 // WORD
) -> *mut u8;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("SHLWAPI.dll", CharSet = CharSet.Ansi)]
public static extern IntPtr StrChrIA([MarshalAs(UnmanagedType.LPStr)] string pszStart, ushort wMatch);
"@
$api = Add-Type -MemberDefinition $sig -Name 'SHLWAPI_StrChrIA' -Namespace Win32 -PassThru
# $api::StrChrIA(pszStart, wMatch)#uselib "SHLWAPI.dll"
#func global StrChrIA "StrChrIA" sptr, sptr
; StrChrIA pszStart, wMatch ; 戻り値は stat
; pszStart : LPCSTR -> "sptr"
; wMatch : WORD -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "SHLWAPI.dll"
#cfunc global StrChrIA "StrChrIA" str, int
; res = StrChrIA(pszStart, wMatch)
; pszStart : LPCSTR -> "str"
; wMatch : WORD -> "int"; LPSTR StrChrIA(LPCSTR pszStart, WORD wMatch)
#uselib "SHLWAPI.dll"
#cfunc global StrChrIA "StrChrIA" str, int
; res = StrChrIA(pszStart, wMatch)
; pszStart : LPCSTR -> "str"
; wMatch : WORD -> "int"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
shlwapi = windows.NewLazySystemDLL("SHLWAPI.dll")
procStrChrIA = shlwapi.NewProc("StrChrIA")
)
// pszStart (LPCSTR), wMatch (WORD)
r1, _, err := procStrChrIA.Call(
uintptr(unsafe.Pointer(windows.BytePtrFromString(pszStart))),
uintptr(wMatch),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // LPSTRfunction StrChrIA(
pszStart: PAnsiChar; // LPCSTR
wMatch: Word // WORD
): PAnsiChar; stdcall;
external 'SHLWAPI.dll' name 'StrChrIA';result := DllCall("SHLWAPI\StrChrIA"
, "AStr", pszStart ; LPCSTR
, "UShort", wMatch ; WORD
, "Ptr") ; return: LPSTR●StrChrIA(pszStart, wMatch) = DLL("SHLWAPI.dll", "char* StrChrIA(char*, int)")
# 呼び出し: StrChrIA(pszStart, wMatch)
# pszStart : LPCSTR -> "char*"
# wMatch : WORD -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。