Win32 API 日本語リファレンス
ホームUI.Shell › SHQueryUserNotificationState

SHQueryUserNotificationState

関数
通知表示が可能かを示すユーザー通知状態を取得する。
DLLSHELL32.dll呼出規約winapi対応OSWindows Vista 以降

シグネチャ

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

HRESULT SHQueryUserNotificationState(
    QUERY_USER_NOTIFICATION_STATE* pquns
);

パラメーター

名前方向
pqunsQUERY_USER_NOTIFICATION_STATE*out

戻り値の型: HRESULT

各言語での呼び出し定義

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

HRESULT SHQueryUserNotificationState(
    QUERY_USER_NOTIFICATION_STATE* pquns
);
[DllImport("SHELL32.dll", ExactSpelling = true)]
static extern int SHQueryUserNotificationState(
    out int pquns   // QUERY_USER_NOTIFICATION_STATE* out
);
<DllImport("SHELL32.dll", ExactSpelling:=True)>
Public Shared Function SHQueryUserNotificationState(
    <Out> ByRef pquns As Integer   ' QUERY_USER_NOTIFICATION_STATE* out
) As Integer
End Function
' pquns : QUERY_USER_NOTIFICATION_STATE* out
Declare PtrSafe Function SHQueryUserNotificationState Lib "shell32" ( _
    ByRef pquns As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

SHQueryUserNotificationState = ctypes.windll.shell32.SHQueryUserNotificationState
SHQueryUserNotificationState.restype = ctypes.c_int
SHQueryUserNotificationState.argtypes = [
    ctypes.c_void_p,  # pquns : QUERY_USER_NOTIFICATION_STATE* out
]
require 'fiddle'
require 'fiddle/import'

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

var (
	shell32 = windows.NewLazySystemDLL("SHELL32.dll")
	procSHQueryUserNotificationState = shell32.NewProc("SHQueryUserNotificationState")
)

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