ホーム › System.Com.Urlmon › CoInternetSetFeatureEnabled
CoInternetSetFeatureEnabled
関数指定したインターネット機能の有効無効を設定する。
シグネチャ
// urlmon.dll
#include <windows.h>
HRESULT CoInternetSetFeatureEnabled(
INTERNETFEATURELIST FeatureEntry,
DWORD dwFlags,
BOOL fEnable
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| FeatureEntry | INTERNETFEATURELIST | in | 有効/無効を設定する対象のインターネット機能を示すINTERNETFEATURELIST列挙値。 |
| dwFlags | DWORD | in | 設定を適用するスコープを指定するフラグ。プロセス全体やレジストリ単位などを選ぶ。 |
| fEnable | BOOL | in | 機能を有効化する場合TRUE、無効化する場合FALSEを指定する。 |
戻り値の型: HRESULT
各言語での呼び出し定義
// urlmon.dll
#include <windows.h>
HRESULT CoInternetSetFeatureEnabled(
INTERNETFEATURELIST FeatureEntry,
DWORD dwFlags,
BOOL fEnable
);[DllImport("urlmon.dll", ExactSpelling = true)]
static extern int CoInternetSetFeatureEnabled(
int FeatureEntry, // INTERNETFEATURELIST
uint dwFlags, // DWORD
bool fEnable // BOOL
);<DllImport("urlmon.dll", ExactSpelling:=True)>
Public Shared Function CoInternetSetFeatureEnabled(
FeatureEntry As Integer, ' INTERNETFEATURELIST
dwFlags As UInteger, ' DWORD
fEnable As Boolean ' BOOL
) As Integer
End Function' FeatureEntry : INTERNETFEATURELIST
' dwFlags : DWORD
' fEnable : BOOL
Declare PtrSafe Function CoInternetSetFeatureEnabled Lib "urlmon" ( _
ByVal FeatureEntry As Long, _
ByVal dwFlags As Long, _
ByVal fEnable As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
CoInternetSetFeatureEnabled = ctypes.windll.urlmon.CoInternetSetFeatureEnabled
CoInternetSetFeatureEnabled.restype = ctypes.c_int
CoInternetSetFeatureEnabled.argtypes = [
ctypes.c_int, # FeatureEntry : INTERNETFEATURELIST
wintypes.DWORD, # dwFlags : DWORD
wintypes.BOOL, # fEnable : BOOL
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('urlmon.dll')
CoInternetSetFeatureEnabled = Fiddle::Function.new(
lib['CoInternetSetFeatureEnabled'],
[
Fiddle::TYPE_INT, # FeatureEntry : INTERNETFEATURELIST
-Fiddle::TYPE_INT, # dwFlags : DWORD
Fiddle::TYPE_INT, # fEnable : BOOL
],
Fiddle::TYPE_INT)#[link(name = "urlmon")]
extern "system" {
fn CoInternetSetFeatureEnabled(
FeatureEntry: i32, // INTERNETFEATURELIST
dwFlags: u32, // DWORD
fEnable: i32 // BOOL
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("urlmon.dll")]
public static extern int CoInternetSetFeatureEnabled(int FeatureEntry, uint dwFlags, bool fEnable);
"@
$api = Add-Type -MemberDefinition $sig -Name 'urlmon_CoInternetSetFeatureEnabled' -Namespace Win32 -PassThru
# $api::CoInternetSetFeatureEnabled(FeatureEntry, dwFlags, fEnable)#uselib "urlmon.dll"
#func global CoInternetSetFeatureEnabled "CoInternetSetFeatureEnabled" sptr, sptr, sptr
; CoInternetSetFeatureEnabled FeatureEntry, dwFlags, fEnable ; 戻り値は stat
; FeatureEntry : INTERNETFEATURELIST -> "sptr"
; dwFlags : DWORD -> "sptr"
; fEnable : BOOL -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "urlmon.dll"
#cfunc global CoInternetSetFeatureEnabled "CoInternetSetFeatureEnabled" int, int, int
; res = CoInternetSetFeatureEnabled(FeatureEntry, dwFlags, fEnable)
; FeatureEntry : INTERNETFEATURELIST -> "int"
; dwFlags : DWORD -> "int"
; fEnable : BOOL -> "int"; HRESULT CoInternetSetFeatureEnabled(INTERNETFEATURELIST FeatureEntry, DWORD dwFlags, BOOL fEnable)
#uselib "urlmon.dll"
#cfunc global CoInternetSetFeatureEnabled "CoInternetSetFeatureEnabled" int, int, int
; res = CoInternetSetFeatureEnabled(FeatureEntry, dwFlags, fEnable)
; FeatureEntry : INTERNETFEATURELIST -> "int"
; dwFlags : DWORD -> "int"
; fEnable : BOOL -> "int"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
urlmon = windows.NewLazySystemDLL("urlmon.dll")
procCoInternetSetFeatureEnabled = urlmon.NewProc("CoInternetSetFeatureEnabled")
)
// FeatureEntry (INTERNETFEATURELIST), dwFlags (DWORD), fEnable (BOOL)
r1, _, err := procCoInternetSetFeatureEnabled.Call(
uintptr(FeatureEntry),
uintptr(dwFlags),
uintptr(fEnable),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction CoInternetSetFeatureEnabled(
FeatureEntry: Integer; // INTERNETFEATURELIST
dwFlags: DWORD; // DWORD
fEnable: BOOL // BOOL
): Integer; stdcall;
external 'urlmon.dll' name 'CoInternetSetFeatureEnabled';result := DllCall("urlmon\CoInternetSetFeatureEnabled"
, "Int", FeatureEntry ; INTERNETFEATURELIST
, "UInt", dwFlags ; DWORD
, "Int", fEnable ; BOOL
, "Int") ; return: HRESULT●CoInternetSetFeatureEnabled(FeatureEntry, dwFlags, fEnable) = DLL("urlmon.dll", "int CoInternetSetFeatureEnabled(int, dword, bool)")
# 呼び出し: CoInternetSetFeatureEnabled(FeatureEntry, dwFlags, fEnable)
# FeatureEntry : INTERNETFEATURELIST -> "int"
# dwFlags : DWORD -> "dword"
# fEnable : BOOL -> "bool"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "urlmon" fn CoInternetSetFeatureEnabled(
FeatureEntry: i32, // INTERNETFEATURELIST
dwFlags: u32, // DWORD
fEnable: i32 // BOOL
) callconv(std.os.windows.WINAPI) i32;proc CoInternetSetFeatureEnabled(
FeatureEntry: int32, # INTERNETFEATURELIST
dwFlags: uint32, # DWORD
fEnable: int32 # BOOL
): int32 {.importc: "CoInternetSetFeatureEnabled", stdcall, dynlib: "urlmon.dll".}pragma(lib, "urlmon");
extern(Windows)
int CoInternetSetFeatureEnabled(
int FeatureEntry, // INTERNETFEATURELIST
uint dwFlags, // DWORD
int fEnable // BOOL
);ccall((:CoInternetSetFeatureEnabled, "urlmon.dll"), stdcall, Int32,
(Int32, UInt32, Int32),
FeatureEntry, dwFlags, fEnable)
# FeatureEntry : INTERNETFEATURELIST -> Int32
# dwFlags : DWORD -> UInt32
# fEnable : BOOL -> Int32
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t CoInternetSetFeatureEnabled(
int32_t FeatureEntry,
uint32_t dwFlags,
int32_t fEnable);
]]
local urlmon = ffi.load("urlmon")
-- urlmon.CoInternetSetFeatureEnabled(FeatureEntry, dwFlags, fEnable)
-- FeatureEntry : INTERNETFEATURELIST
-- dwFlags : DWORD
-- fEnable : BOOL
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('urlmon.dll');
const CoInternetSetFeatureEnabled = lib.func('__stdcall', 'CoInternetSetFeatureEnabled', 'int32_t', ['int32_t', 'uint32_t', 'int32_t']);
// CoInternetSetFeatureEnabled(FeatureEntry, dwFlags, fEnable)
// FeatureEntry : INTERNETFEATURELIST -> 'int32_t'
// dwFlags : DWORD -> 'uint32_t'
// fEnable : BOOL -> 'int32_t'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("urlmon.dll", {
CoInternetSetFeatureEnabled: { parameters: ["i32", "u32", "i32"], result: "i32" },
});
// lib.symbols.CoInternetSetFeatureEnabled(FeatureEntry, dwFlags, fEnable)
// FeatureEntry : INTERNETFEATURELIST -> "i32"
// dwFlags : DWORD -> "u32"
// fEnable : BOOL -> "i32"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t CoInternetSetFeatureEnabled(
int32_t FeatureEntry,
uint32_t dwFlags,
int32_t fEnable);
C, "urlmon.dll");
// $ffi->CoInternetSetFeatureEnabled(FeatureEntry, dwFlags, fEnable);
// FeatureEntry : INTERNETFEATURELIST
// dwFlags : DWORD
// fEnable : BOOL
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
// WINAPI(stdcall): x64 では呼出規約が統一されるため問題なし。x86 では __stdcall 対応のラッパが必要な場合あり。import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;
public interface Urlmon extends StdCallLibrary {
Urlmon INSTANCE = Native.load("urlmon", Urlmon.class);
int CoInternetSetFeatureEnabled(
int FeatureEntry, // INTERNETFEATURELIST
int dwFlags, // DWORD
boolean fEnable // BOOL
);
}@[Link("urlmon")]
lib Liburlmon
fun CoInternetSetFeatureEnabled = CoInternetSetFeatureEnabled(
FeatureEntry : Int32, # INTERNETFEATURELIST
dwFlags : UInt32, # DWORD
fEnable : Int32 # BOOL
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef CoInternetSetFeatureEnabledNative = Int32 Function(Int32, Uint32, Int32);
typedef CoInternetSetFeatureEnabledDart = int Function(int, int, int);
final CoInternetSetFeatureEnabled = DynamicLibrary.open('urlmon.dll')
.lookupFunction<CoInternetSetFeatureEnabledNative, CoInternetSetFeatureEnabledDart>('CoInternetSetFeatureEnabled');
// FeatureEntry : INTERNETFEATURELIST -> Int32
// dwFlags : DWORD -> Uint32
// fEnable : BOOL -> Int32
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function CoInternetSetFeatureEnabled(
FeatureEntry: Integer; // INTERNETFEATURELIST
dwFlags: DWORD; // DWORD
fEnable: BOOL // BOOL
): Integer; stdcall;
external 'urlmon.dll' name 'CoInternetSetFeatureEnabled';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "CoInternetSetFeatureEnabled"
c_CoInternetSetFeatureEnabled :: Int32 -> Word32 -> CInt -> IO Int32
-- FeatureEntry : INTERNETFEATURELIST -> Int32
-- dwFlags : DWORD -> Word32
-- fEnable : BOOL -> CInt
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let cointernetsetfeatureenabled =
foreign "CoInternetSetFeatureEnabled"
(int32_t @-> uint32_t @-> int32_t @-> returning int32_t)
(* FeatureEntry : INTERNETFEATURELIST -> int32_t *)
(* dwFlags : DWORD -> uint32_t *)
(* fEnable : BOOL -> int32_t *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library urlmon (t "urlmon.dll"))
(cffi:use-foreign-library urlmon)
(cffi:defcfun ("CoInternetSetFeatureEnabled" co-internet-set-feature-enabled :convention :stdcall) :int32
(feature-entry :int32) ; INTERNETFEATURELIST
(dw-flags :uint32) ; DWORD
(f-enable :int32)) ; BOOL
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $CoInternetSetFeatureEnabled = Win32::API::More->new('urlmon',
'int CoInternetSetFeatureEnabled(int FeatureEntry, DWORD dwFlags, BOOL fEnable)');
# my $ret = $CoInternetSetFeatureEnabled->Call($FeatureEntry, $dwFlags, $fEnable);
# FeatureEntry : INTERNETFEATURELIST -> int
# dwFlags : DWORD -> DWORD
# fEnable : BOOL -> BOOL
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。