ホーム › Networking.Clustering › ResUtilExpandEnvironmentStrings
ResUtilExpandEnvironmentStrings
関数文字列内の環境変数を展開する。
シグネチャ
// RESUTILS.dll
#include <windows.h>
LPWSTR ResUtilExpandEnvironmentStrings(
LPCWSTR pszSrc
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| pszSrc | LPCWSTR | in |
戻り値の型: LPWSTR
各言語での呼び出し定義
// RESUTILS.dll
#include <windows.h>
LPWSTR ResUtilExpandEnvironmentStrings(
LPCWSTR pszSrc
);[DllImport("RESUTILS.dll", SetLastError = true, ExactSpelling = true)]
static extern IntPtr ResUtilExpandEnvironmentStrings(
[MarshalAs(UnmanagedType.LPWStr)] string pszSrc // LPCWSTR
);<DllImport("RESUTILS.dll", SetLastError:=True, ExactSpelling:=True)>
Public Shared Function ResUtilExpandEnvironmentStrings(
<MarshalAs(UnmanagedType.LPWStr)> pszSrc As String ' LPCWSTR
) As IntPtr
End Function' pszSrc : LPCWSTR
Declare PtrSafe Function ResUtilExpandEnvironmentStrings Lib "resutils" ( _
ByVal pszSrc As LongPtr) As LongPtr
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
ResUtilExpandEnvironmentStrings = ctypes.windll.resutils.ResUtilExpandEnvironmentStrings
ResUtilExpandEnvironmentStrings.restype = wintypes.LPWSTR
ResUtilExpandEnvironmentStrings.argtypes = [
wintypes.LPCWSTR, # pszSrc : LPCWSTR
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('RESUTILS.dll')
ResUtilExpandEnvironmentStrings = Fiddle::Function.new(
lib['ResUtilExpandEnvironmentStrings'],
[
Fiddle::TYPE_VOIDP, # pszSrc : LPCWSTR
],
Fiddle::TYPE_VOIDP)#[link(name = "resutils")]
extern "system" {
fn ResUtilExpandEnvironmentStrings(
pszSrc: *const u16 // LPCWSTR
) -> *mut u16;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("RESUTILS.dll", SetLastError = true)]
public static extern IntPtr ResUtilExpandEnvironmentStrings([MarshalAs(UnmanagedType.LPWStr)] string pszSrc);
"@
$api = Add-Type -MemberDefinition $sig -Name 'RESUTILS_ResUtilExpandEnvironmentStrings' -Namespace Win32 -PassThru
# $api::ResUtilExpandEnvironmentStrings(pszSrc)#uselib "RESUTILS.dll"
#func global ResUtilExpandEnvironmentStrings "ResUtilExpandEnvironmentStrings" sptr
; ResUtilExpandEnvironmentStrings pszSrc ; 戻り値は stat
; pszSrc : LPCWSTR -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "RESUTILS.dll"
#cfunc global ResUtilExpandEnvironmentStrings "ResUtilExpandEnvironmentStrings" wstr
; res = ResUtilExpandEnvironmentStrings(pszSrc)
; pszSrc : LPCWSTR -> "wstr"; LPWSTR ResUtilExpandEnvironmentStrings(LPCWSTR pszSrc)
#uselib "RESUTILS.dll"
#cfunc global ResUtilExpandEnvironmentStrings "ResUtilExpandEnvironmentStrings" wstr
; res = ResUtilExpandEnvironmentStrings(pszSrc)
; pszSrc : LPCWSTR -> "wstr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
resutils = windows.NewLazySystemDLL("RESUTILS.dll")
procResUtilExpandEnvironmentStrings = resutils.NewProc("ResUtilExpandEnvironmentStrings")
)
// pszSrc (LPCWSTR)
r1, _, err := procResUtilExpandEnvironmentStrings.Call(
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(pszSrc))),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // LPWSTRfunction ResUtilExpandEnvironmentStrings(
pszSrc: PWideChar // LPCWSTR
): PWideChar; stdcall;
external 'RESUTILS.dll' name 'ResUtilExpandEnvironmentStrings';result := DllCall("RESUTILS\ResUtilExpandEnvironmentStrings"
, "WStr", pszSrc ; LPCWSTR
, "Ptr") ; return: LPWSTR●ResUtilExpandEnvironmentStrings(pszSrc) = DLL("RESUTILS.dll", "char* ResUtilExpandEnvironmentStrings(char*)")
# 呼び出し: ResUtilExpandEnvironmentStrings(pszSrc)
# pszSrc : LPCWSTR -> "char*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。