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

WcmSetProfileList

関数
接続プロファイルの優先順位リストを設定する。
DLLwcmapi.dll呼出規約winapi対応OSwindows8.0

シグネチャ

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

DWORD WcmSetProfileList(
    WCM_PROFILE_INFO_LIST* pProfileList,
    DWORD dwPosition,
    BOOL fIgnoreUnknownProfiles,
    void* pReserved   // optional
);

パラメーター

名前方向
pProfileListWCM_PROFILE_INFO_LIST*in
dwPositionDWORDin
fIgnoreUnknownProfilesBOOLin
pReservedvoid*optional

戻り値の型: DWORD

各言語での呼び出し定義

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

DWORD WcmSetProfileList(
    WCM_PROFILE_INFO_LIST* pProfileList,
    DWORD dwPosition,
    BOOL fIgnoreUnknownProfiles,
    void* pReserved   // optional
);
[DllImport("wcmapi.dll", ExactSpelling = true)]
static extern uint WcmSetProfileList(
    IntPtr pProfileList,   // WCM_PROFILE_INFO_LIST*
    uint dwPosition,   // DWORD
    bool fIgnoreUnknownProfiles,   // BOOL
    IntPtr pReserved   // void* optional
);
<DllImport("wcmapi.dll", ExactSpelling:=True)>
Public Shared Function WcmSetProfileList(
    pProfileList As IntPtr,   ' WCM_PROFILE_INFO_LIST*
    dwPosition As UInteger,   ' DWORD
    fIgnoreUnknownProfiles As Boolean,   ' BOOL
    pReserved As IntPtr   ' void* optional
) As UInteger
End Function
' pProfileList : WCM_PROFILE_INFO_LIST*
' dwPosition : DWORD
' fIgnoreUnknownProfiles : BOOL
' pReserved : void* optional
Declare PtrSafe Function WcmSetProfileList Lib "wcmapi" ( _
    ByVal pProfileList As LongPtr, _
    ByVal dwPosition As Long, _
    ByVal fIgnoreUnknownProfiles As Long, _
    ByVal pReserved As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

WcmSetProfileList = ctypes.windll.wcmapi.WcmSetProfileList
WcmSetProfileList.restype = wintypes.DWORD
WcmSetProfileList.argtypes = [
    ctypes.c_void_p,  # pProfileList : WCM_PROFILE_INFO_LIST*
    wintypes.DWORD,  # dwPosition : DWORD
    wintypes.BOOL,  # fIgnoreUnknownProfiles : BOOL
    ctypes.POINTER(None),  # pReserved : void* optional
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('wcmapi.dll')
WcmSetProfileList = Fiddle::Function.new(
  lib['WcmSetProfileList'],
  [
    Fiddle::TYPE_VOIDP,  # pProfileList : WCM_PROFILE_INFO_LIST*
    -Fiddle::TYPE_INT,  # dwPosition : DWORD
    Fiddle::TYPE_INT,  # fIgnoreUnknownProfiles : BOOL
    Fiddle::TYPE_VOIDP,  # pReserved : void* optional
  ],
  -Fiddle::TYPE_INT)
#[link(name = "wcmapi")]
extern "system" {
    fn WcmSetProfileList(
        pProfileList: *mut WCM_PROFILE_INFO_LIST,  // WCM_PROFILE_INFO_LIST*
        dwPosition: u32,  // DWORD
        fIgnoreUnknownProfiles: i32,  // BOOL
        pReserved: *mut ()  // void* optional
    ) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("wcmapi.dll")]
public static extern uint WcmSetProfileList(IntPtr pProfileList, uint dwPosition, bool fIgnoreUnknownProfiles, IntPtr pReserved);
"@
$api = Add-Type -MemberDefinition $sig -Name 'wcmapi_WcmSetProfileList' -Namespace Win32 -PassThru
# $api::WcmSetProfileList(pProfileList, dwPosition, fIgnoreUnknownProfiles, pReserved)
#uselib "wcmapi.dll"
#func global WcmSetProfileList "WcmSetProfileList" sptr, sptr, sptr, sptr
; WcmSetProfileList varptr(pProfileList), dwPosition, fIgnoreUnknownProfiles, pReserved   ; 戻り値は stat
; pProfileList : WCM_PROFILE_INFO_LIST* -> "sptr"
; dwPosition : DWORD -> "sptr"
; fIgnoreUnknownProfiles : BOOL -> "sptr"
; pReserved : void* optional -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "wcmapi.dll"
#cfunc global WcmSetProfileList "WcmSetProfileList" var, int, int, sptr
; res = WcmSetProfileList(pProfileList, dwPosition, fIgnoreUnknownProfiles, pReserved)
; pProfileList : WCM_PROFILE_INFO_LIST* -> "var"
; dwPosition : DWORD -> "int"
; fIgnoreUnknownProfiles : BOOL -> "int"
; pReserved : void* optional -> "sptr"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; DWORD WcmSetProfileList(WCM_PROFILE_INFO_LIST* pProfileList, DWORD dwPosition, BOOL fIgnoreUnknownProfiles, void* pReserved)
#uselib "wcmapi.dll"
#cfunc global WcmSetProfileList "WcmSetProfileList" var, int, int, intptr
; res = WcmSetProfileList(pProfileList, dwPosition, fIgnoreUnknownProfiles, pReserved)
; pProfileList : WCM_PROFILE_INFO_LIST* -> "var"
; dwPosition : DWORD -> "int"
; fIgnoreUnknownProfiles : BOOL -> "int"
; pReserved : void* optional -> "intptr"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	wcmapi = windows.NewLazySystemDLL("wcmapi.dll")
	procWcmSetProfileList = wcmapi.NewProc("WcmSetProfileList")
)

// pProfileList (WCM_PROFILE_INFO_LIST*), dwPosition (DWORD), fIgnoreUnknownProfiles (BOOL), pReserved (void* optional)
r1, _, err := procWcmSetProfileList.Call(
	uintptr(pProfileList),
	uintptr(dwPosition),
	uintptr(fIgnoreUnknownProfiles),
	uintptr(pReserved),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // DWORD
function WcmSetProfileList(
  pProfileList: Pointer;   // WCM_PROFILE_INFO_LIST*
  dwPosition: DWORD;   // DWORD
  fIgnoreUnknownProfiles: BOOL;   // BOOL
  pReserved: Pointer   // void* optional
): DWORD; stdcall;
  external 'wcmapi.dll' name 'WcmSetProfileList';
result := DllCall("wcmapi\WcmSetProfileList"
    , "Ptr", pProfileList   ; WCM_PROFILE_INFO_LIST*
    , "UInt", dwPosition   ; DWORD
    , "Int", fIgnoreUnknownProfiles   ; BOOL
    , "Ptr", pReserved   ; void* optional
    , "UInt")   ; return: DWORD
●WcmSetProfileList(pProfileList, dwPosition, fIgnoreUnknownProfiles, pReserved) = DLL("wcmapi.dll", "dword WcmSetProfileList(void*, dword, bool, void*)")
# 呼び出し: WcmSetProfileList(pProfileList, dwPosition, fIgnoreUnknownProfiles, pReserved)
# pProfileList : WCM_PROFILE_INFO_LIST* -> "void*"
# dwPosition : DWORD -> "dword"
# fIgnoreUnknownProfiles : BOOL -> "bool"
# pReserved : void* optional -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。