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