Win32 API 日本語リファレンス
ホームNetworkManagement.NetworkDiagnosticsFramework › NdfCreateWebIncident

NdfCreateWebIncident

関数
Web URL接続に関するネットワーク診断インシデントを作成する。
DLLNDFAPI.dll呼出規約winapi対応OSWindows Vista 以降

シグネチャ

// NDFAPI.dll
#include <windows.h>

HRESULT NdfCreateWebIncident(
    LPCWSTR url,
    void** handle
);

パラメーター

名前方向
urlLPCWSTRin
handlevoid**out

戻り値の型: HRESULT

各言語での呼び出し定義

// NDFAPI.dll
#include <windows.h>

HRESULT NdfCreateWebIncident(
    LPCWSTR url,
    void** handle
);
[DllImport("NDFAPI.dll", ExactSpelling = true)]
static extern int NdfCreateWebIncident(
    [MarshalAs(UnmanagedType.LPWStr)] string url,   // LPCWSTR
    IntPtr handle   // void** out
);
<DllImport("NDFAPI.dll", ExactSpelling:=True)>
Public Shared Function NdfCreateWebIncident(
    <MarshalAs(UnmanagedType.LPWStr)> url As String,   ' LPCWSTR
    handle As IntPtr   ' void** out
) As Integer
End Function
' url : LPCWSTR
' handle : void** out
Declare PtrSafe Function NdfCreateWebIncident Lib "ndfapi" ( _
    ByVal url As LongPtr, _
    ByVal handle As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

NdfCreateWebIncident = ctypes.windll.ndfapi.NdfCreateWebIncident
NdfCreateWebIncident.restype = ctypes.c_int
NdfCreateWebIncident.argtypes = [
    wintypes.LPCWSTR,  # url : LPCWSTR
    ctypes.c_void_p,  # handle : void** out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('NDFAPI.dll')
NdfCreateWebIncident = Fiddle::Function.new(
  lib['NdfCreateWebIncident'],
  [
    Fiddle::TYPE_VOIDP,  # url : LPCWSTR
    Fiddle::TYPE_VOIDP,  # handle : void** out
  ],
  Fiddle::TYPE_INT)
#[link(name = "ndfapi")]
extern "system" {
    fn NdfCreateWebIncident(
        url: *const u16,  // LPCWSTR
        handle: *mut *mut ()  // void** out
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("NDFAPI.dll")]
public static extern int NdfCreateWebIncident([MarshalAs(UnmanagedType.LPWStr)] string url, IntPtr handle);
"@
$api = Add-Type -MemberDefinition $sig -Name 'NDFAPI_NdfCreateWebIncident' -Namespace Win32 -PassThru
# $api::NdfCreateWebIncident(url, handle)
#uselib "NDFAPI.dll"
#func global NdfCreateWebIncident "NdfCreateWebIncident" sptr, sptr
; NdfCreateWebIncident url, handle   ; 戻り値は stat
; url : LPCWSTR -> "sptr"
; handle : void** out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "NDFAPI.dll"
#cfunc global NdfCreateWebIncident "NdfCreateWebIncident" wstr, sptr
; res = NdfCreateWebIncident(url, handle)
; url : LPCWSTR -> "wstr"
; handle : void** out -> "sptr"
; HRESULT NdfCreateWebIncident(LPCWSTR url, void** handle)
#uselib "NDFAPI.dll"
#cfunc global NdfCreateWebIncident "NdfCreateWebIncident" wstr, intptr
; res = NdfCreateWebIncident(url, handle)
; url : LPCWSTR -> "wstr"
; handle : void** out -> "intptr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	ndfapi = windows.NewLazySystemDLL("NDFAPI.dll")
	procNdfCreateWebIncident = ndfapi.NewProc("NdfCreateWebIncident")
)

// url (LPCWSTR), handle (void** out)
r1, _, err := procNdfCreateWebIncident.Call(
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(url))),
	uintptr(handle),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // HRESULT
function NdfCreateWebIncident(
  url: PWideChar;   // LPCWSTR
  handle: Pointer   // void** out
): Integer; stdcall;
  external 'NDFAPI.dll' name 'NdfCreateWebIncident';
result := DllCall("NDFAPI\NdfCreateWebIncident"
    , "WStr", url   ; LPCWSTR
    , "Ptr", handle   ; void** out
    , "Int")   ; return: HRESULT
●NdfCreateWebIncident(url, handle) = DLL("NDFAPI.dll", "int NdfCreateWebIncident(char*, void*)")
# 呼び出し: NdfCreateWebIncident(url, handle)
# url : LPCWSTR -> "char*"
# handle : void** out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。