ホーム › Networking.WinInet › GopherOpenFileA
GopherOpenFileA
関数Gopherサーバー上の項目を読み取り用に開く(ANSI版)。
シグネチャ
// WININET.dll (ANSI / -A)
#include <windows.h>
void* GopherOpenFileA(
void* hConnect,
LPCSTR lpszLocator,
LPCSTR lpszView, // optional
DWORD dwFlags,
UINT_PTR dwContext // optional
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hConnect | void* | in |
| lpszLocator | LPCSTR | in |
| lpszView | LPCSTR | inoptional |
| dwFlags | DWORD | in |
| dwContext | UINT_PTR | inoptional |
戻り値の型: void*
各言語での呼び出し定義
// WININET.dll (ANSI / -A)
#include <windows.h>
void* GopherOpenFileA(
void* hConnect,
LPCSTR lpszLocator,
LPCSTR lpszView, // optional
DWORD dwFlags,
UINT_PTR dwContext // optional
);[DllImport("WININET.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
static extern IntPtr GopherOpenFileA(
IntPtr hConnect, // void*
[MarshalAs(UnmanagedType.LPStr)] string lpszLocator, // LPCSTR
[MarshalAs(UnmanagedType.LPStr)] string lpszView, // LPCSTR optional
uint dwFlags, // DWORD
UIntPtr dwContext // UINT_PTR optional
);<DllImport("WININET.dll", CharSet:=CharSet.Ansi, SetLastError:=True, ExactSpelling:=True)>
Public Shared Function GopherOpenFileA(
hConnect As IntPtr, ' void*
<MarshalAs(UnmanagedType.LPStr)> lpszLocator As String, ' LPCSTR
<MarshalAs(UnmanagedType.LPStr)> lpszView As String, ' LPCSTR optional
dwFlags As UInteger, ' DWORD
dwContext As UIntPtr ' UINT_PTR optional
) As IntPtr
End Function' hConnect : void*
' lpszLocator : LPCSTR
' lpszView : LPCSTR optional
' dwFlags : DWORD
' dwContext : UINT_PTR optional
Declare PtrSafe Function GopherOpenFileA Lib "wininet" ( _
ByVal hConnect As LongPtr, _
ByVal lpszLocator As String, _
ByVal lpszView As String, _
ByVal dwFlags As Long, _
ByVal dwContext As LongPtr) As LongPtr
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
GopherOpenFileA = ctypes.windll.wininet.GopherOpenFileA
GopherOpenFileA.restype = ctypes.c_void_p
GopherOpenFileA.argtypes = [
ctypes.POINTER(None), # hConnect : void*
wintypes.LPCSTR, # lpszLocator : LPCSTR
wintypes.LPCSTR, # lpszView : LPCSTR optional
wintypes.DWORD, # dwFlags : DWORD
ctypes.c_size_t, # dwContext : UINT_PTR optional
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('WININET.dll')
GopherOpenFileA = Fiddle::Function.new(
lib['GopherOpenFileA'],
[
Fiddle::TYPE_VOIDP, # hConnect : void*
Fiddle::TYPE_VOIDP, # lpszLocator : LPCSTR
Fiddle::TYPE_VOIDP, # lpszView : LPCSTR optional
-Fiddle::TYPE_INT, # dwFlags : DWORD
Fiddle::TYPE_UINTPTR_T, # dwContext : UINT_PTR optional
],
Fiddle::TYPE_VOIDP)#[link(name = "wininet")]
extern "system" {
fn GopherOpenFileA(
hConnect: *mut (), // void*
lpszLocator: *const u8, // LPCSTR
lpszView: *const u8, // LPCSTR optional
dwFlags: u32, // DWORD
dwContext: usize // UINT_PTR optional
) -> *mut ();
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("WININET.dll", CharSet = CharSet.Ansi, SetLastError = true)]
public static extern IntPtr GopherOpenFileA(IntPtr hConnect, [MarshalAs(UnmanagedType.LPStr)] string lpszLocator, [MarshalAs(UnmanagedType.LPStr)] string lpszView, uint dwFlags, UIntPtr dwContext);
"@
$api = Add-Type -MemberDefinition $sig -Name 'WININET_GopherOpenFileA' -Namespace Win32 -PassThru
# $api::GopherOpenFileA(hConnect, lpszLocator, lpszView, dwFlags, dwContext)#uselib "WININET.dll"
#func global GopherOpenFileA "GopherOpenFileA" sptr, sptr, sptr, sptr, sptr
; GopherOpenFileA hConnect, lpszLocator, lpszView, dwFlags, dwContext ; 戻り値は stat
; hConnect : void* -> "sptr"
; lpszLocator : LPCSTR -> "sptr"
; lpszView : LPCSTR optional -> "sptr"
; dwFlags : DWORD -> "sptr"
; dwContext : UINT_PTR optional -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "WININET.dll"
#cfunc global GopherOpenFileA "GopherOpenFileA" sptr, str, str, int, sptr
; res = GopherOpenFileA(hConnect, lpszLocator, lpszView, dwFlags, dwContext)
; hConnect : void* -> "sptr"
; lpszLocator : LPCSTR -> "str"
; lpszView : LPCSTR optional -> "str"
; dwFlags : DWORD -> "int"
; dwContext : UINT_PTR optional -> "sptr"; void* GopherOpenFileA(void* hConnect, LPCSTR lpszLocator, LPCSTR lpszView, DWORD dwFlags, UINT_PTR dwContext)
#uselib "WININET.dll"
#cfunc global GopherOpenFileA "GopherOpenFileA" intptr, str, str, int, intptr
; res = GopherOpenFileA(hConnect, lpszLocator, lpszView, dwFlags, dwContext)
; hConnect : void* -> "intptr"
; lpszLocator : LPCSTR -> "str"
; lpszView : LPCSTR optional -> "str"
; dwFlags : DWORD -> "int"
; dwContext : UINT_PTR optional -> "intptr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
wininet = windows.NewLazySystemDLL("WININET.dll")
procGopherOpenFileA = wininet.NewProc("GopherOpenFileA")
)
// hConnect (void*), lpszLocator (LPCSTR), lpszView (LPCSTR optional), dwFlags (DWORD), dwContext (UINT_PTR optional)
r1, _, err := procGopherOpenFileA.Call(
uintptr(hConnect),
uintptr(unsafe.Pointer(windows.BytePtrFromString(lpszLocator))),
uintptr(unsafe.Pointer(windows.BytePtrFromString(lpszView))),
uintptr(dwFlags),
uintptr(dwContext),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // void*function GopherOpenFileA(
hConnect: Pointer; // void*
lpszLocator: PAnsiChar; // LPCSTR
lpszView: PAnsiChar; // LPCSTR optional
dwFlags: DWORD; // DWORD
dwContext: NativeUInt // UINT_PTR optional
): Pointer; stdcall;
external 'WININET.dll' name 'GopherOpenFileA';result := DllCall("WININET\GopherOpenFileA"
, "Ptr", hConnect ; void*
, "AStr", lpszLocator ; LPCSTR
, "AStr", lpszView ; LPCSTR optional
, "UInt", dwFlags ; DWORD
, "UPtr", dwContext ; UINT_PTR optional
, "Ptr") ; return: void*●GopherOpenFileA(hConnect, lpszLocator, lpszView, dwFlags, dwContext) = DLL("WININET.dll", "void* GopherOpenFileA(void*, char*, char*, dword, int)")
# 呼び出し: GopherOpenFileA(hConnect, lpszLocator, lpszView, dwFlags, dwContext)
# hConnect : void* -> "void*"
# lpszLocator : LPCSTR -> "char*"
# lpszView : LPCSTR optional -> "char*"
# dwFlags : DWORD -> "dword"
# dwContext : UINT_PTR optional -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。