AssocIsDangerous
関数指定の関連付けが危険な種類かどうかを判定する。
シグネチャ
// SHLWAPI.dll
#include <windows.h>
BOOL AssocIsDangerous(
LPCWSTR pszAssoc
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| pszAssoc | LPCWSTR | in |
戻り値の型: BOOL
各言語での呼び出し定義
// SHLWAPI.dll
#include <windows.h>
BOOL AssocIsDangerous(
LPCWSTR pszAssoc
);[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("SHLWAPI.dll", ExactSpelling = true)]
static extern bool AssocIsDangerous(
[MarshalAs(UnmanagedType.LPWStr)] string pszAssoc // LPCWSTR
);<DllImport("SHLWAPI.dll", ExactSpelling:=True)>
Public Shared Function AssocIsDangerous(
<MarshalAs(UnmanagedType.LPWStr)> pszAssoc As String ' LPCWSTR
) As Boolean
End Function' pszAssoc : LPCWSTR
Declare PtrSafe Function AssocIsDangerous Lib "shlwapi" ( _
ByVal pszAssoc As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
AssocIsDangerous = ctypes.windll.shlwapi.AssocIsDangerous
AssocIsDangerous.restype = wintypes.BOOL
AssocIsDangerous.argtypes = [
wintypes.LPCWSTR, # pszAssoc : LPCWSTR
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('SHLWAPI.dll')
AssocIsDangerous = Fiddle::Function.new(
lib['AssocIsDangerous'],
[
Fiddle::TYPE_VOIDP, # pszAssoc : LPCWSTR
],
Fiddle::TYPE_INT)#[link(name = "shlwapi")]
extern "system" {
fn AssocIsDangerous(
pszAssoc: *const u16 // LPCWSTR
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("SHLWAPI.dll")]
public static extern bool AssocIsDangerous([MarshalAs(UnmanagedType.LPWStr)] string pszAssoc);
"@
$api = Add-Type -MemberDefinition $sig -Name 'SHLWAPI_AssocIsDangerous' -Namespace Win32 -PassThru
# $api::AssocIsDangerous(pszAssoc)#uselib "SHLWAPI.dll"
#func global AssocIsDangerous "AssocIsDangerous" sptr
; AssocIsDangerous pszAssoc ; 戻り値は stat
; pszAssoc : LPCWSTR -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "SHLWAPI.dll"
#cfunc global AssocIsDangerous "AssocIsDangerous" wstr
; res = AssocIsDangerous(pszAssoc)
; pszAssoc : LPCWSTR -> "wstr"; BOOL AssocIsDangerous(LPCWSTR pszAssoc)
#uselib "SHLWAPI.dll"
#cfunc global AssocIsDangerous "AssocIsDangerous" wstr
; res = AssocIsDangerous(pszAssoc)
; pszAssoc : LPCWSTR -> "wstr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
shlwapi = windows.NewLazySystemDLL("SHLWAPI.dll")
procAssocIsDangerous = shlwapi.NewProc("AssocIsDangerous")
)
// pszAssoc (LPCWSTR)
r1, _, err := procAssocIsDangerous.Call(
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(pszAssoc))),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // BOOLfunction AssocIsDangerous(
pszAssoc: PWideChar // LPCWSTR
): BOOL; stdcall;
external 'SHLWAPI.dll' name 'AssocIsDangerous';result := DllCall("SHLWAPI\AssocIsDangerous"
, "WStr", pszAssoc ; LPCWSTR
, "Int") ; return: BOOL●AssocIsDangerous(pszAssoc) = DLL("SHLWAPI.dll", "bool AssocIsDangerous(char*)")
# 呼び出し: AssocIsDangerous(pszAssoc)
# pszAssoc : LPCWSTR -> "char*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。