ホーム › Networking.WinInet › RunOnceUrlCache
RunOnceUrlCache
関数URLキャッシュの初回実行処理を行う。
シグネチャ
// WININET.dll
#include <windows.h>
DWORD RunOnceUrlCache(
HWND hwnd,
HINSTANCE hinst,
LPSTR lpszCmd,
INT nCmdShow
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hwnd | HWND | in |
| hinst | HINSTANCE | in |
| lpszCmd | LPSTR | in |
| nCmdShow | INT | in |
戻り値の型: DWORD
各言語での呼び出し定義
// WININET.dll
#include <windows.h>
DWORD RunOnceUrlCache(
HWND hwnd,
HINSTANCE hinst,
LPSTR lpszCmd,
INT nCmdShow
);[DllImport("WININET.dll", ExactSpelling = true)]
static extern uint RunOnceUrlCache(
IntPtr hwnd, // HWND
IntPtr hinst, // HINSTANCE
[MarshalAs(UnmanagedType.LPStr)] string lpszCmd, // LPSTR
int nCmdShow // INT
);<DllImport("WININET.dll", ExactSpelling:=True)>
Public Shared Function RunOnceUrlCache(
hwnd As IntPtr, ' HWND
hinst As IntPtr, ' HINSTANCE
<MarshalAs(UnmanagedType.LPStr)> lpszCmd As String, ' LPSTR
nCmdShow As Integer ' INT
) As UInteger
End Function' hwnd : HWND
' hinst : HINSTANCE
' lpszCmd : LPSTR
' nCmdShow : INT
Declare PtrSafe Function RunOnceUrlCache Lib "wininet" ( _
ByVal hwnd As LongPtr, _
ByVal hinst As LongPtr, _
ByVal lpszCmd As String, _
ByVal nCmdShow As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
RunOnceUrlCache = ctypes.windll.wininet.RunOnceUrlCache
RunOnceUrlCache.restype = wintypes.DWORD
RunOnceUrlCache.argtypes = [
wintypes.HANDLE, # hwnd : HWND
wintypes.HANDLE, # hinst : HINSTANCE
wintypes.LPCSTR, # lpszCmd : LPSTR
ctypes.c_int, # nCmdShow : INT
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('WININET.dll')
RunOnceUrlCache = Fiddle::Function.new(
lib['RunOnceUrlCache'],
[
Fiddle::TYPE_VOIDP, # hwnd : HWND
Fiddle::TYPE_VOIDP, # hinst : HINSTANCE
Fiddle::TYPE_VOIDP, # lpszCmd : LPSTR
Fiddle::TYPE_INT, # nCmdShow : INT
],
-Fiddle::TYPE_INT)#[link(name = "wininet")]
extern "system" {
fn RunOnceUrlCache(
hwnd: *mut core::ffi::c_void, // HWND
hinst: *mut core::ffi::c_void, // HINSTANCE
lpszCmd: *mut u8, // LPSTR
nCmdShow: i32 // INT
) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("WININET.dll")]
public static extern uint RunOnceUrlCache(IntPtr hwnd, IntPtr hinst, [MarshalAs(UnmanagedType.LPStr)] string lpszCmd, int nCmdShow);
"@
$api = Add-Type -MemberDefinition $sig -Name 'WININET_RunOnceUrlCache' -Namespace Win32 -PassThru
# $api::RunOnceUrlCache(hwnd, hinst, lpszCmd, nCmdShow)#uselib "WININET.dll"
#func global RunOnceUrlCache "RunOnceUrlCache" sptr, sptr, sptr, sptr
; RunOnceUrlCache hwnd, hinst, lpszCmd, nCmdShow ; 戻り値は stat
; hwnd : HWND -> "sptr"
; hinst : HINSTANCE -> "sptr"
; lpszCmd : LPSTR -> "sptr"
; nCmdShow : INT -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "WININET.dll"
#cfunc global RunOnceUrlCache "RunOnceUrlCache" sptr, sptr, str, int
; res = RunOnceUrlCache(hwnd, hinst, lpszCmd, nCmdShow)
; hwnd : HWND -> "sptr"
; hinst : HINSTANCE -> "sptr"
; lpszCmd : LPSTR -> "str"
; nCmdShow : INT -> "int"; DWORD RunOnceUrlCache(HWND hwnd, HINSTANCE hinst, LPSTR lpszCmd, INT nCmdShow)
#uselib "WININET.dll"
#cfunc global RunOnceUrlCache "RunOnceUrlCache" intptr, intptr, str, int
; res = RunOnceUrlCache(hwnd, hinst, lpszCmd, nCmdShow)
; hwnd : HWND -> "intptr"
; hinst : HINSTANCE -> "intptr"
; lpszCmd : LPSTR -> "str"
; nCmdShow : INT -> "int"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
wininet = windows.NewLazySystemDLL("WININET.dll")
procRunOnceUrlCache = wininet.NewProc("RunOnceUrlCache")
)
// hwnd (HWND), hinst (HINSTANCE), lpszCmd (LPSTR), nCmdShow (INT)
r1, _, err := procRunOnceUrlCache.Call(
uintptr(hwnd),
uintptr(hinst),
uintptr(unsafe.Pointer(windows.BytePtrFromString(lpszCmd))),
uintptr(nCmdShow),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // DWORDfunction RunOnceUrlCache(
hwnd: THandle; // HWND
hinst: THandle; // HINSTANCE
lpszCmd: PAnsiChar; // LPSTR
nCmdShow: Integer // INT
): DWORD; stdcall;
external 'WININET.dll' name 'RunOnceUrlCache';result := DllCall("WININET\RunOnceUrlCache"
, "Ptr", hwnd ; HWND
, "Ptr", hinst ; HINSTANCE
, "AStr", lpszCmd ; LPSTR
, "Int", nCmdShow ; INT
, "UInt") ; return: DWORD●RunOnceUrlCache(hwnd, hinst, lpszCmd, nCmdShow) = DLL("WININET.dll", "dword RunOnceUrlCache(void*, void*, char*, int)")
# 呼び出し: RunOnceUrlCache(hwnd, hinst, lpszCmd, nCmdShow)
# hwnd : HWND -> "void*"
# hinst : HINSTANCE -> "void*"
# lpszCmd : LPSTR -> "char*"
# nCmdShow : INT -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。