ホーム › System.Com › CreateUriWithFragment
CreateUriWithFragment
関数フラグメントを付加したURIからIUriオブジェクトを作成する。
シグネチャ
// URLMON.dll
#include <windows.h>
HRESULT CreateUriWithFragment(
LPCWSTR pwzURI,
LPCWSTR pwzFragment, // optional
DWORD dwFlags,
UINT_PTR dwReserved, // optional
IUri** ppURI
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| pwzURI | LPCWSTR | in |
| pwzFragment | LPCWSTR | inoptional |
| dwFlags | DWORD | in |
| dwReserved | UINT_PTR | optional |
| ppURI | IUri** | out |
戻り値の型: HRESULT
各言語での呼び出し定義
// URLMON.dll
#include <windows.h>
HRESULT CreateUriWithFragment(
LPCWSTR pwzURI,
LPCWSTR pwzFragment, // optional
DWORD dwFlags,
UINT_PTR dwReserved, // optional
IUri** ppURI
);[DllImport("URLMON.dll", ExactSpelling = true)]
static extern int CreateUriWithFragment(
[MarshalAs(UnmanagedType.LPWStr)] string pwzURI, // LPCWSTR
[MarshalAs(UnmanagedType.LPWStr)] string pwzFragment, // LPCWSTR optional
uint dwFlags, // DWORD
UIntPtr dwReserved, // UINT_PTR optional
IntPtr ppURI // IUri** out
);<DllImport("URLMON.dll", ExactSpelling:=True)>
Public Shared Function CreateUriWithFragment(
<MarshalAs(UnmanagedType.LPWStr)> pwzURI As String, ' LPCWSTR
<MarshalAs(UnmanagedType.LPWStr)> pwzFragment As String, ' LPCWSTR optional
dwFlags As UInteger, ' DWORD
dwReserved As UIntPtr, ' UINT_PTR optional
ppURI As IntPtr ' IUri** out
) As Integer
End Function' pwzURI : LPCWSTR
' pwzFragment : LPCWSTR optional
' dwFlags : DWORD
' dwReserved : UINT_PTR optional
' ppURI : IUri** out
Declare PtrSafe Function CreateUriWithFragment Lib "urlmon" ( _
ByVal pwzURI As LongPtr, _
ByVal pwzFragment As LongPtr, _
ByVal dwFlags As Long, _
ByVal dwReserved As LongPtr, _
ByVal ppURI As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
CreateUriWithFragment = ctypes.windll.urlmon.CreateUriWithFragment
CreateUriWithFragment.restype = ctypes.c_int
CreateUriWithFragment.argtypes = [
wintypes.LPCWSTR, # pwzURI : LPCWSTR
wintypes.LPCWSTR, # pwzFragment : LPCWSTR optional
wintypes.DWORD, # dwFlags : DWORD
ctypes.c_size_t, # dwReserved : UINT_PTR optional
ctypes.c_void_p, # ppURI : IUri** out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('URLMON.dll')
CreateUriWithFragment = Fiddle::Function.new(
lib['CreateUriWithFragment'],
[
Fiddle::TYPE_VOIDP, # pwzURI : LPCWSTR
Fiddle::TYPE_VOIDP, # pwzFragment : LPCWSTR optional
-Fiddle::TYPE_INT, # dwFlags : DWORD
Fiddle::TYPE_UINTPTR_T, # dwReserved : UINT_PTR optional
Fiddle::TYPE_VOIDP, # ppURI : IUri** out
],
Fiddle::TYPE_INT)#[link(name = "urlmon")]
extern "system" {
fn CreateUriWithFragment(
pwzURI: *const u16, // LPCWSTR
pwzFragment: *const u16, // LPCWSTR optional
dwFlags: u32, // DWORD
dwReserved: usize, // UINT_PTR optional
ppURI: *mut *mut core::ffi::c_void // IUri** out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("URLMON.dll")]
public static extern int CreateUriWithFragment([MarshalAs(UnmanagedType.LPWStr)] string pwzURI, [MarshalAs(UnmanagedType.LPWStr)] string pwzFragment, uint dwFlags, UIntPtr dwReserved, IntPtr ppURI);
"@
$api = Add-Type -MemberDefinition $sig -Name 'URLMON_CreateUriWithFragment' -Namespace Win32 -PassThru
# $api::CreateUriWithFragment(pwzURI, pwzFragment, dwFlags, dwReserved, ppURI)#uselib "URLMON.dll"
#func global CreateUriWithFragment "CreateUriWithFragment" sptr, sptr, sptr, sptr, sptr
; CreateUriWithFragment pwzURI, pwzFragment, dwFlags, dwReserved, ppURI ; 戻り値は stat
; pwzURI : LPCWSTR -> "sptr"
; pwzFragment : LPCWSTR optional -> "sptr"
; dwFlags : DWORD -> "sptr"
; dwReserved : UINT_PTR optional -> "sptr"
; ppURI : IUri** out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "URLMON.dll"
#cfunc global CreateUriWithFragment "CreateUriWithFragment" wstr, wstr, int, sptr, sptr
; res = CreateUriWithFragment(pwzURI, pwzFragment, dwFlags, dwReserved, ppURI)
; pwzURI : LPCWSTR -> "wstr"
; pwzFragment : LPCWSTR optional -> "wstr"
; dwFlags : DWORD -> "int"
; dwReserved : UINT_PTR optional -> "sptr"
; ppURI : IUri** out -> "sptr"; HRESULT CreateUriWithFragment(LPCWSTR pwzURI, LPCWSTR pwzFragment, DWORD dwFlags, UINT_PTR dwReserved, IUri** ppURI)
#uselib "URLMON.dll"
#cfunc global CreateUriWithFragment "CreateUriWithFragment" wstr, wstr, int, intptr, intptr
; res = CreateUriWithFragment(pwzURI, pwzFragment, dwFlags, dwReserved, ppURI)
; pwzURI : LPCWSTR -> "wstr"
; pwzFragment : LPCWSTR optional -> "wstr"
; dwFlags : DWORD -> "int"
; dwReserved : UINT_PTR optional -> "intptr"
; ppURI : IUri** out -> "intptr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
urlmon = windows.NewLazySystemDLL("URLMON.dll")
procCreateUriWithFragment = urlmon.NewProc("CreateUriWithFragment")
)
// pwzURI (LPCWSTR), pwzFragment (LPCWSTR optional), dwFlags (DWORD), dwReserved (UINT_PTR optional), ppURI (IUri** out)
r1, _, err := procCreateUriWithFragment.Call(
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(pwzURI))),
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(pwzFragment))),
uintptr(dwFlags),
uintptr(dwReserved),
uintptr(ppURI),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction CreateUriWithFragment(
pwzURI: PWideChar; // LPCWSTR
pwzFragment: PWideChar; // LPCWSTR optional
dwFlags: DWORD; // DWORD
dwReserved: NativeUInt; // UINT_PTR optional
ppURI: Pointer // IUri** out
): Integer; stdcall;
external 'URLMON.dll' name 'CreateUriWithFragment';result := DllCall("URLMON\CreateUriWithFragment"
, "WStr", pwzURI ; LPCWSTR
, "WStr", pwzFragment ; LPCWSTR optional
, "UInt", dwFlags ; DWORD
, "UPtr", dwReserved ; UINT_PTR optional
, "Ptr", ppURI ; IUri** out
, "Int") ; return: HRESULT●CreateUriWithFragment(pwzURI, pwzFragment, dwFlags, dwReserved, ppURI) = DLL("URLMON.dll", "int CreateUriWithFragment(char*, char*, dword, int, void*)")
# 呼び出し: CreateUriWithFragment(pwzURI, pwzFragment, dwFlags, dwReserved, ppURI)
# pwzURI : LPCWSTR -> "char*"
# pwzFragment : LPCWSTR optional -> "char*"
# dwFlags : DWORD -> "dword"
# dwReserved : UINT_PTR optional -> "int"
# ppURI : IUri** out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。