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