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