ホーム › System.Com › CreateStdProgressIndicator
CreateStdProgressIndicator
関数標準の進行状況表示用バインドステータスコールバックを作成する。
シグネチャ
// ole32.dll
#include <windows.h>
HRESULT CreateStdProgressIndicator(
HWND hwndParent,
LPCWSTR pszTitle,
IBindStatusCallback* pIbscCaller,
IBindStatusCallback** ppIbsc
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hwndParent | HWND | in |
| pszTitle | LPCWSTR | in |
| pIbscCaller | IBindStatusCallback* | in |
| ppIbsc | IBindStatusCallback** | out |
戻り値の型: HRESULT
各言語での呼び出し定義
// ole32.dll
#include <windows.h>
HRESULT CreateStdProgressIndicator(
HWND hwndParent,
LPCWSTR pszTitle,
IBindStatusCallback* pIbscCaller,
IBindStatusCallback** ppIbsc
);[DllImport("ole32.dll", ExactSpelling = true)]
static extern int CreateStdProgressIndicator(
IntPtr hwndParent, // HWND
[MarshalAs(UnmanagedType.LPWStr)] string pszTitle, // LPCWSTR
IntPtr pIbscCaller, // IBindStatusCallback*
IntPtr ppIbsc // IBindStatusCallback** out
);<DllImport("ole32.dll", ExactSpelling:=True)>
Public Shared Function CreateStdProgressIndicator(
hwndParent As IntPtr, ' HWND
<MarshalAs(UnmanagedType.LPWStr)> pszTitle As String, ' LPCWSTR
pIbscCaller As IntPtr, ' IBindStatusCallback*
ppIbsc As IntPtr ' IBindStatusCallback** out
) As Integer
End Function' hwndParent : HWND
' pszTitle : LPCWSTR
' pIbscCaller : IBindStatusCallback*
' ppIbsc : IBindStatusCallback** out
Declare PtrSafe Function CreateStdProgressIndicator Lib "ole32" ( _
ByVal hwndParent As LongPtr, _
ByVal pszTitle As LongPtr, _
ByVal pIbscCaller As LongPtr, _
ByVal ppIbsc As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
CreateStdProgressIndicator = ctypes.windll.ole32.CreateStdProgressIndicator
CreateStdProgressIndicator.restype = ctypes.c_int
CreateStdProgressIndicator.argtypes = [
wintypes.HANDLE, # hwndParent : HWND
wintypes.LPCWSTR, # pszTitle : LPCWSTR
ctypes.c_void_p, # pIbscCaller : IBindStatusCallback*
ctypes.c_void_p, # ppIbsc : IBindStatusCallback** out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('ole32.dll')
CreateStdProgressIndicator = Fiddle::Function.new(
lib['CreateStdProgressIndicator'],
[
Fiddle::TYPE_VOIDP, # hwndParent : HWND
Fiddle::TYPE_VOIDP, # pszTitle : LPCWSTR
Fiddle::TYPE_VOIDP, # pIbscCaller : IBindStatusCallback*
Fiddle::TYPE_VOIDP, # ppIbsc : IBindStatusCallback** out
],
Fiddle::TYPE_INT)#[link(name = "ole32")]
extern "system" {
fn CreateStdProgressIndicator(
hwndParent: *mut core::ffi::c_void, // HWND
pszTitle: *const u16, // LPCWSTR
pIbscCaller: *mut core::ffi::c_void, // IBindStatusCallback*
ppIbsc: *mut *mut core::ffi::c_void // IBindStatusCallback** out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("ole32.dll")]
public static extern int CreateStdProgressIndicator(IntPtr hwndParent, [MarshalAs(UnmanagedType.LPWStr)] string pszTitle, IntPtr pIbscCaller, IntPtr ppIbsc);
"@
$api = Add-Type -MemberDefinition $sig -Name 'ole32_CreateStdProgressIndicator' -Namespace Win32 -PassThru
# $api::CreateStdProgressIndicator(hwndParent, pszTitle, pIbscCaller, ppIbsc)#uselib "ole32.dll"
#func global CreateStdProgressIndicator "CreateStdProgressIndicator" sptr, sptr, sptr, sptr
; CreateStdProgressIndicator hwndParent, pszTitle, pIbscCaller, ppIbsc ; 戻り値は stat
; hwndParent : HWND -> "sptr"
; pszTitle : LPCWSTR -> "sptr"
; pIbscCaller : IBindStatusCallback* -> "sptr"
; ppIbsc : IBindStatusCallback** out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "ole32.dll"
#cfunc global CreateStdProgressIndicator "CreateStdProgressIndicator" sptr, wstr, sptr, sptr
; res = CreateStdProgressIndicator(hwndParent, pszTitle, pIbscCaller, ppIbsc)
; hwndParent : HWND -> "sptr"
; pszTitle : LPCWSTR -> "wstr"
; pIbscCaller : IBindStatusCallback* -> "sptr"
; ppIbsc : IBindStatusCallback** out -> "sptr"; HRESULT CreateStdProgressIndicator(HWND hwndParent, LPCWSTR pszTitle, IBindStatusCallback* pIbscCaller, IBindStatusCallback** ppIbsc)
#uselib "ole32.dll"
#cfunc global CreateStdProgressIndicator "CreateStdProgressIndicator" intptr, wstr, intptr, intptr
; res = CreateStdProgressIndicator(hwndParent, pszTitle, pIbscCaller, ppIbsc)
; hwndParent : HWND -> "intptr"
; pszTitle : LPCWSTR -> "wstr"
; pIbscCaller : IBindStatusCallback* -> "intptr"
; ppIbsc : IBindStatusCallback** out -> "intptr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
ole32 = windows.NewLazySystemDLL("ole32.dll")
procCreateStdProgressIndicator = ole32.NewProc("CreateStdProgressIndicator")
)
// hwndParent (HWND), pszTitle (LPCWSTR), pIbscCaller (IBindStatusCallback*), ppIbsc (IBindStatusCallback** out)
r1, _, err := procCreateStdProgressIndicator.Call(
uintptr(hwndParent),
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(pszTitle))),
uintptr(pIbscCaller),
uintptr(ppIbsc),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction CreateStdProgressIndicator(
hwndParent: THandle; // HWND
pszTitle: PWideChar; // LPCWSTR
pIbscCaller: Pointer; // IBindStatusCallback*
ppIbsc: Pointer // IBindStatusCallback** out
): Integer; stdcall;
external 'ole32.dll' name 'CreateStdProgressIndicator';result := DllCall("ole32\CreateStdProgressIndicator"
, "Ptr", hwndParent ; HWND
, "WStr", pszTitle ; LPCWSTR
, "Ptr", pIbscCaller ; IBindStatusCallback*
, "Ptr", ppIbsc ; IBindStatusCallback** out
, "Int") ; return: HRESULT●CreateStdProgressIndicator(hwndParent, pszTitle, pIbscCaller, ppIbsc) = DLL("ole32.dll", "int CreateStdProgressIndicator(void*, char*, void*, void*)")
# 呼び出し: CreateStdProgressIndicator(hwndParent, pszTitle, pIbscCaller, ppIbsc)
# hwndParent : HWND -> "void*"
# pszTitle : LPCWSTR -> "char*"
# pIbscCaller : IBindStatusCallback* -> "void*"
# ppIbsc : IBindStatusCallback** out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。