ホーム › System.Com › CoGetCurrentProcess
CoGetCurrentProcess
関数現在のスレッドの一意なプロセス識別子を取得する。
シグネチャ
// OLE32.dll
#include <windows.h>
DWORD CoGetCurrentProcess(void);パラメーターなし。戻り値: DWORD
各言語での呼び出し定義
// OLE32.dll
#include <windows.h>
DWORD CoGetCurrentProcess(void);[DllImport("OLE32.dll", ExactSpelling = true)]
static extern uint CoGetCurrentProcess();<DllImport("OLE32.dll", ExactSpelling:=True)>
Public Shared Function CoGetCurrentProcess() As UInteger
End FunctionDeclare PtrSafe Function CoGetCurrentProcess Lib "ole32" () As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
CoGetCurrentProcess = ctypes.windll.ole32.CoGetCurrentProcess
CoGetCurrentProcess.restype = wintypes.DWORD
CoGetCurrentProcess.argtypes = []require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('OLE32.dll')
CoGetCurrentProcess = Fiddle::Function.new(
lib['CoGetCurrentProcess'],
[],
-Fiddle::TYPE_INT)#[link(name = "ole32")]
extern "system" {
fn CoGetCurrentProcess() -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("OLE32.dll")]
public static extern uint CoGetCurrentProcess();
"@
$api = Add-Type -MemberDefinition $sig -Name 'OLE32_CoGetCurrentProcess' -Namespace Win32 -PassThru
# $api::CoGetCurrentProcess()#uselib "OLE32.dll"
#func global CoGetCurrentProcess "CoGetCurrentProcess"
; CoGetCurrentProcess ; 戻り値は stat
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "OLE32.dll"
#cfunc global CoGetCurrentProcess "CoGetCurrentProcess"
; res = CoGetCurrentProcess(); DWORD CoGetCurrentProcess()
#uselib "OLE32.dll"
#cfunc global CoGetCurrentProcess "CoGetCurrentProcess"
; res = CoGetCurrentProcess()import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
ole32 = windows.NewLazySystemDLL("OLE32.dll")
procCoGetCurrentProcess = ole32.NewProc("CoGetCurrentProcess")
)
r1, _, err := procCoGetCurrentProcess.Call()
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // DWORDfunction CoGetCurrentProcess: DWORD; stdcall;
external 'OLE32.dll' name 'CoGetCurrentProcess';result := DllCall("OLE32\CoGetCurrentProcess", "UInt")●CoGetCurrentProcess() = DLL("OLE32.dll", "dword CoGetCurrentProcess()")
# 呼び出し: CoGetCurrentProcess()
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。