Win32 API 日本語リファレンス
ホームSystem.SecurityCenter › WscRegisterForUserNotifications

WscRegisterForUserNotifications

関数
セキュリティセンターのユーザー通知の受信を登録する。
DLLWSCAPI.dll呼出規約winapi

シグネチャ

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

HRESULT WscRegisterForUserNotifications(void);

パラメーターなし。戻り値: HRESULT

各言語での呼び出し定義

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

HRESULT WscRegisterForUserNotifications(void);
[DllImport("WSCAPI.dll", ExactSpelling = true)]
static extern int WscRegisterForUserNotifications();
<DllImport("WSCAPI.dll", ExactSpelling:=True)>
Public Shared Function WscRegisterForUserNotifications() As Integer
End Function
Declare PtrSafe Function WscRegisterForUserNotifications Lib "wscapi" () As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

WscRegisterForUserNotifications = ctypes.windll.wscapi.WscRegisterForUserNotifications
WscRegisterForUserNotifications.restype = ctypes.c_int
WscRegisterForUserNotifications.argtypes = []
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('WSCAPI.dll')
WscRegisterForUserNotifications = Fiddle::Function.new(
  lib['WscRegisterForUserNotifications'],
  [],
  Fiddle::TYPE_INT)
#[link(name = "wscapi")]
extern "system" {
    fn WscRegisterForUserNotifications() -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("WSCAPI.dll")]
public static extern int WscRegisterForUserNotifications();
"@
$api = Add-Type -MemberDefinition $sig -Name 'WSCAPI_WscRegisterForUserNotifications' -Namespace Win32 -PassThru
# $api::WscRegisterForUserNotifications()
#uselib "WSCAPI.dll"
#func global WscRegisterForUserNotifications "WscRegisterForUserNotifications"
; WscRegisterForUserNotifications   ; 戻り値は stat
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "WSCAPI.dll"
#cfunc global WscRegisterForUserNotifications "WscRegisterForUserNotifications"
; res = WscRegisterForUserNotifications()
; HRESULT WscRegisterForUserNotifications()
#uselib "WSCAPI.dll"
#cfunc global WscRegisterForUserNotifications "WscRegisterForUserNotifications"
; res = WscRegisterForUserNotifications()
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	wscapi = windows.NewLazySystemDLL("WSCAPI.dll")
	procWscRegisterForUserNotifications = wscapi.NewProc("WscRegisterForUserNotifications")
)

r1, _, err := procWscRegisterForUserNotifications.Call()
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // HRESULT
function WscRegisterForUserNotifications: Integer; stdcall;
  external 'WSCAPI.dll' name 'WscRegisterForUserNotifications';
result := DllCall("WSCAPI\WscRegisterForUserNotifications", "Int")
●WscRegisterForUserNotifications() = DLL("WSCAPI.dll", "int WscRegisterForUserNotifications()")
# 呼び出し: WscRegisterForUserNotifications()
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。