ホーム › Networking.Clustering › SetGroupDependencyExpression
SetGroupDependencyExpression
関数クラスターグループの依存関係式を設定する。
シグネチャ
// CLUSAPI.dll
#include <windows.h>
DWORD SetGroupDependencyExpression(
HGROUP hGroup,
LPCWSTR lpszDependencyExpression
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| hGroup | HGROUP | in | 依存関係式を設定する対象グループへのハンドル。 |
| lpszDependencyExpression | LPCWSTR | in | AND/OR等で構成した依存関係式を指すワイド文字列。 |
戻り値の型: DWORD
各言語での呼び出し定義
// CLUSAPI.dll
#include <windows.h>
DWORD SetGroupDependencyExpression(
HGROUP hGroup,
LPCWSTR lpszDependencyExpression
);[DllImport("CLUSAPI.dll", ExactSpelling = true)]
static extern uint SetGroupDependencyExpression(
IntPtr hGroup, // HGROUP
[MarshalAs(UnmanagedType.LPWStr)] string lpszDependencyExpression // LPCWSTR
);<DllImport("CLUSAPI.dll", ExactSpelling:=True)>
Public Shared Function SetGroupDependencyExpression(
hGroup As IntPtr, ' HGROUP
<MarshalAs(UnmanagedType.LPWStr)> lpszDependencyExpression As String ' LPCWSTR
) As UInteger
End Function' hGroup : HGROUP
' lpszDependencyExpression : LPCWSTR
Declare PtrSafe Function SetGroupDependencyExpression Lib "clusapi" ( _
ByVal hGroup As LongPtr, _
ByVal lpszDependencyExpression As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
SetGroupDependencyExpression = ctypes.windll.clusapi.SetGroupDependencyExpression
SetGroupDependencyExpression.restype = wintypes.DWORD
SetGroupDependencyExpression.argtypes = [
ctypes.c_ssize_t, # hGroup : HGROUP
wintypes.LPCWSTR, # lpszDependencyExpression : LPCWSTR
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('CLUSAPI.dll')
SetGroupDependencyExpression = Fiddle::Function.new(
lib['SetGroupDependencyExpression'],
[
Fiddle::TYPE_INTPTR_T, # hGroup : HGROUP
Fiddle::TYPE_VOIDP, # lpszDependencyExpression : LPCWSTR
],
-Fiddle::TYPE_INT)#[link(name = "clusapi")]
extern "system" {
fn SetGroupDependencyExpression(
hGroup: isize, // HGROUP
lpszDependencyExpression: *const u16 // LPCWSTR
) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("CLUSAPI.dll")]
public static extern uint SetGroupDependencyExpression(IntPtr hGroup, [MarshalAs(UnmanagedType.LPWStr)] string lpszDependencyExpression);
"@
$api = Add-Type -MemberDefinition $sig -Name 'CLUSAPI_SetGroupDependencyExpression' -Namespace Win32 -PassThru
# $api::SetGroupDependencyExpression(hGroup, lpszDependencyExpression)#uselib "CLUSAPI.dll"
#func global SetGroupDependencyExpression "SetGroupDependencyExpression" sptr, sptr
; SetGroupDependencyExpression hGroup, lpszDependencyExpression ; 戻り値は stat
; hGroup : HGROUP -> "sptr"
; lpszDependencyExpression : LPCWSTR -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "CLUSAPI.dll"
#cfunc global SetGroupDependencyExpression "SetGroupDependencyExpression" sptr, wstr
; res = SetGroupDependencyExpression(hGroup, lpszDependencyExpression)
; hGroup : HGROUP -> "sptr"
; lpszDependencyExpression : LPCWSTR -> "wstr"; DWORD SetGroupDependencyExpression(HGROUP hGroup, LPCWSTR lpszDependencyExpression)
#uselib "CLUSAPI.dll"
#cfunc global SetGroupDependencyExpression "SetGroupDependencyExpression" intptr, wstr
; res = SetGroupDependencyExpression(hGroup, lpszDependencyExpression)
; hGroup : HGROUP -> "intptr"
; lpszDependencyExpression : LPCWSTR -> "wstr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
clusapi = windows.NewLazySystemDLL("CLUSAPI.dll")
procSetGroupDependencyExpression = clusapi.NewProc("SetGroupDependencyExpression")
)
// hGroup (HGROUP), lpszDependencyExpression (LPCWSTR)
r1, _, err := procSetGroupDependencyExpression.Call(
uintptr(hGroup),
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(lpszDependencyExpression))),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // DWORDfunction SetGroupDependencyExpression(
hGroup: NativeInt; // HGROUP
lpszDependencyExpression: PWideChar // LPCWSTR
): DWORD; stdcall;
external 'CLUSAPI.dll' name 'SetGroupDependencyExpression';result := DllCall("CLUSAPI\SetGroupDependencyExpression"
, "Ptr", hGroup ; HGROUP
, "WStr", lpszDependencyExpression ; LPCWSTR
, "UInt") ; return: DWORD●SetGroupDependencyExpression(hGroup, lpszDependencyExpression) = DLL("CLUSAPI.dll", "dword SetGroupDependencyExpression(int, char*)")
# 呼び出し: SetGroupDependencyExpression(hGroup, lpszDependencyExpression)
# hGroup : HGROUP -> "int"
# lpszDependencyExpression : LPCWSTR -> "char*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "clusapi" fn SetGroupDependencyExpression(
hGroup: isize, // HGROUP
lpszDependencyExpression: [*c]const u16 // LPCWSTR
) callconv(std.os.windows.WINAPI) u32;proc SetGroupDependencyExpression(
hGroup: int, # HGROUP
lpszDependencyExpression: WideCString # LPCWSTR
): uint32 {.importc: "SetGroupDependencyExpression", stdcall, dynlib: "CLUSAPI.dll".}pragma(lib, "clusapi");
extern(Windows)
uint SetGroupDependencyExpression(
ptrdiff_t hGroup, // HGROUP
const(wchar)* lpszDependencyExpression // LPCWSTR
);ccall((:SetGroupDependencyExpression, "CLUSAPI.dll"), stdcall, UInt32,
(Int, Cwstring),
hGroup, lpszDependencyExpression)
# hGroup : HGROUP -> Int
# lpszDependencyExpression : LPCWSTR -> Cwstring
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
uint32_t SetGroupDependencyExpression(
intptr_t hGroup,
const uint16_t* lpszDependencyExpression);
]]
local clusapi = ffi.load("clusapi")
-- clusapi.SetGroupDependencyExpression(hGroup, lpszDependencyExpression)
-- hGroup : HGROUP
-- lpszDependencyExpression : LPCWSTR
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('CLUSAPI.dll');
const SetGroupDependencyExpression = lib.func('__stdcall', 'SetGroupDependencyExpression', 'uint32_t', ['intptr_t', 'str16']);
// SetGroupDependencyExpression(hGroup, lpszDependencyExpression)
// hGroup : HGROUP -> 'intptr_t'
// lpszDependencyExpression : LPCWSTR -> 'str16'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("CLUSAPI.dll", {
SetGroupDependencyExpression: { parameters: ["isize", "buffer"], result: "u32" },
});
// lib.symbols.SetGroupDependencyExpression(hGroup, lpszDependencyExpression)
// hGroup : HGROUP -> "isize"
// lpszDependencyExpression : LPCWSTR -> "buffer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
uint32_t SetGroupDependencyExpression(
intptr_t hGroup,
const uint16_t* lpszDependencyExpression);
C, "CLUSAPI.dll");
// $ffi->SetGroupDependencyExpression(hGroup, lpszDependencyExpression);
// hGroup : HGROUP
// lpszDependencyExpression : LPCWSTR
// 構造体/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 Clusapi extends StdCallLibrary {
Clusapi INSTANCE = Native.load("clusapi", Clusapi.class);
int SetGroupDependencyExpression(
long hGroup, // HGROUP
WString lpszDependencyExpression // LPCWSTR
);
}@[Link("clusapi")]
lib LibCLUSAPI
fun SetGroupDependencyExpression = SetGroupDependencyExpression(
hGroup : LibC::SSizeT, # HGROUP
lpszDependencyExpression : UInt16* # LPCWSTR
) : UInt32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef SetGroupDependencyExpressionNative = Uint32 Function(IntPtr, Pointer<Utf16>);
typedef SetGroupDependencyExpressionDart = int Function(int, Pointer<Utf16>);
final SetGroupDependencyExpression = DynamicLibrary.open('CLUSAPI.dll')
.lookupFunction<SetGroupDependencyExpressionNative, SetGroupDependencyExpressionDart>('SetGroupDependencyExpression');
// hGroup : HGROUP -> IntPtr
// lpszDependencyExpression : LPCWSTR -> Pointer<Utf16>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function SetGroupDependencyExpression(
hGroup: NativeInt; // HGROUP
lpszDependencyExpression: PWideChar // LPCWSTR
): DWORD; stdcall;
external 'CLUSAPI.dll' name 'SetGroupDependencyExpression';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "SetGroupDependencyExpression"
c_SetGroupDependencyExpression :: CIntPtr -> CWString -> IO Word32
-- hGroup : HGROUP -> CIntPtr
-- lpszDependencyExpression : LPCWSTR -> CWString
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let setgroupdependencyexpression =
foreign "SetGroupDependencyExpression"
(intptr_t @-> (ptr uint16_t) @-> returning uint32_t)
(* hGroup : HGROUP -> intptr_t *)
(* lpszDependencyExpression : LPCWSTR -> (ptr uint16_t) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library clusapi (t "CLUSAPI.dll"))
(cffi:use-foreign-library clusapi)
(cffi:defcfun ("SetGroupDependencyExpression" set-group-dependency-expression :convention :stdcall) :uint32
(h-group :int64) ; HGROUP
(lpsz-dependency-expression (:string :encoding :utf-16le))) ; LPCWSTR
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $SetGroupDependencyExpression = Win32::API::More->new('CLUSAPI',
'DWORD SetGroupDependencyExpression(LPARAM hGroup, LPCWSTR lpszDependencyExpression)');
# my $ret = $SetGroupDependencyExpression->Call($hGroup, $lpszDependencyExpression);
# hGroup : HGROUP -> LPARAM
# lpszDependencyExpression : LPCWSTR -> LPCWSTR
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。関連項目
類似 API
- f SetGroupDependencyExpressionEx — 理由を付与してグループの依存関係式を設定する。