Win32 API 日本語リファレンス
ホームNetworking.Clustering › SetGroupDependencyExpressionEx

SetGroupDependencyExpressionEx

関数
理由を付与してグループの依存関係式を設定する。
DLLCLUSAPI.dll呼出規約winapi

シグネチャ

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

DWORD SetGroupDependencyExpressionEx(
    HGROUP hGroup,
    LPCWSTR lpszDependencyExpression,
    LPCWSTR lpszReason   // optional
);

パラメーター

名前方向
hGroupHGROUPin
lpszDependencyExpressionLPCWSTRin
lpszReasonLPCWSTRinoptional

戻り値の型: DWORD

各言語での呼び出し定義

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

DWORD SetGroupDependencyExpressionEx(
    HGROUP hGroup,
    LPCWSTR lpszDependencyExpression,
    LPCWSTR lpszReason   // optional
);
[DllImport("CLUSAPI.dll", ExactSpelling = true)]
static extern uint SetGroupDependencyExpressionEx(
    IntPtr hGroup,   // HGROUP
    [MarshalAs(UnmanagedType.LPWStr)] string lpszDependencyExpression,   // LPCWSTR
    [MarshalAs(UnmanagedType.LPWStr)] string lpszReason   // LPCWSTR optional
);
<DllImport("CLUSAPI.dll", ExactSpelling:=True)>
Public Shared Function SetGroupDependencyExpressionEx(
    hGroup As IntPtr,   ' HGROUP
    <MarshalAs(UnmanagedType.LPWStr)> lpszDependencyExpression As String,   ' LPCWSTR
    <MarshalAs(UnmanagedType.LPWStr)> lpszReason As String   ' LPCWSTR optional
) As UInteger
End Function
' hGroup : HGROUP
' lpszDependencyExpression : LPCWSTR
' lpszReason : LPCWSTR optional
Declare PtrSafe Function SetGroupDependencyExpressionEx Lib "clusapi" ( _
    ByVal hGroup As LongPtr, _
    ByVal lpszDependencyExpression As LongPtr, _
    ByVal lpszReason As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

SetGroupDependencyExpressionEx = ctypes.windll.clusapi.SetGroupDependencyExpressionEx
SetGroupDependencyExpressionEx.restype = wintypes.DWORD
SetGroupDependencyExpressionEx.argtypes = [
    ctypes.c_ssize_t,  # hGroup : HGROUP
    wintypes.LPCWSTR,  # lpszDependencyExpression : LPCWSTR
    wintypes.LPCWSTR,  # lpszReason : LPCWSTR optional
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('CLUSAPI.dll')
SetGroupDependencyExpressionEx = Fiddle::Function.new(
  lib['SetGroupDependencyExpressionEx'],
  [
    Fiddle::TYPE_INTPTR_T,  # hGroup : HGROUP
    Fiddle::TYPE_VOIDP,  # lpszDependencyExpression : LPCWSTR
    Fiddle::TYPE_VOIDP,  # lpszReason : LPCWSTR optional
  ],
  -Fiddle::TYPE_INT)
#[link(name = "clusapi")]
extern "system" {
    fn SetGroupDependencyExpressionEx(
        hGroup: isize,  // HGROUP
        lpszDependencyExpression: *const u16,  // LPCWSTR
        lpszReason: *const u16  // LPCWSTR optional
    ) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("CLUSAPI.dll")]
public static extern uint SetGroupDependencyExpressionEx(IntPtr hGroup, [MarshalAs(UnmanagedType.LPWStr)] string lpszDependencyExpression, [MarshalAs(UnmanagedType.LPWStr)] string lpszReason);
"@
$api = Add-Type -MemberDefinition $sig -Name 'CLUSAPI_SetGroupDependencyExpressionEx' -Namespace Win32 -PassThru
# $api::SetGroupDependencyExpressionEx(hGroup, lpszDependencyExpression, lpszReason)
#uselib "CLUSAPI.dll"
#func global SetGroupDependencyExpressionEx "SetGroupDependencyExpressionEx" sptr, sptr, sptr
; SetGroupDependencyExpressionEx hGroup, lpszDependencyExpression, lpszReason   ; 戻り値は stat
; hGroup : HGROUP -> "sptr"
; lpszDependencyExpression : LPCWSTR -> "sptr"
; lpszReason : LPCWSTR optional -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "CLUSAPI.dll"
#cfunc global SetGroupDependencyExpressionEx "SetGroupDependencyExpressionEx" sptr, wstr, wstr
; res = SetGroupDependencyExpressionEx(hGroup, lpszDependencyExpression, lpszReason)
; hGroup : HGROUP -> "sptr"
; lpszDependencyExpression : LPCWSTR -> "wstr"
; lpszReason : LPCWSTR optional -> "wstr"
; DWORD SetGroupDependencyExpressionEx(HGROUP hGroup, LPCWSTR lpszDependencyExpression, LPCWSTR lpszReason)
#uselib "CLUSAPI.dll"
#cfunc global SetGroupDependencyExpressionEx "SetGroupDependencyExpressionEx" intptr, wstr, wstr
; res = SetGroupDependencyExpressionEx(hGroup, lpszDependencyExpression, lpszReason)
; hGroup : HGROUP -> "intptr"
; lpszDependencyExpression : LPCWSTR -> "wstr"
; lpszReason : LPCWSTR optional -> "wstr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	clusapi = windows.NewLazySystemDLL("CLUSAPI.dll")
	procSetGroupDependencyExpressionEx = clusapi.NewProc("SetGroupDependencyExpressionEx")
)

// hGroup (HGROUP), lpszDependencyExpression (LPCWSTR), lpszReason (LPCWSTR optional)
r1, _, err := procSetGroupDependencyExpressionEx.Call(
	uintptr(hGroup),
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(lpszDependencyExpression))),
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(lpszReason))),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // DWORD
function SetGroupDependencyExpressionEx(
  hGroup: NativeInt;   // HGROUP
  lpszDependencyExpression: PWideChar;   // LPCWSTR
  lpszReason: PWideChar   // LPCWSTR optional
): DWORD; stdcall;
  external 'CLUSAPI.dll' name 'SetGroupDependencyExpressionEx';
result := DllCall("CLUSAPI\SetGroupDependencyExpressionEx"
    , "Ptr", hGroup   ; HGROUP
    , "WStr", lpszDependencyExpression   ; LPCWSTR
    , "WStr", lpszReason   ; LPCWSTR optional
    , "UInt")   ; return: DWORD
●SetGroupDependencyExpressionEx(hGroup, lpszDependencyExpression, lpszReason) = DLL("CLUSAPI.dll", "dword SetGroupDependencyExpressionEx(int, char*, char*)")
# 呼び出し: SetGroupDependencyExpressionEx(hGroup, lpszDependencyExpression, lpszReason)
# hGroup : HGROUP -> "int"
# lpszDependencyExpression : LPCWSTR -> "char*"
# lpszReason : LPCWSTR optional -> "char*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。