ホーム › System.Com › CreateStdProgressIndicator
CreateStdProgressIndicator
関数標準の進行状況表示用バインドステータスコールバックを作成する。
シグネチャ
// OLE32.dll
#include <windows.h>
HRESULT CreateStdProgressIndicator(
HWND hwndParent,
LPCWSTR pszTitle,
IBindStatusCallback* pIbscCaller,
IBindStatusCallback** ppIbsc
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| hwndParent | HWND | in | 進捗ダイアログの親となるウィンドウのハンドル。NULL可。 |
| pszTitle | LPCWSTR | in | 進捗ダイアログのタイトルバーに表示する文字列。NULL終端のワイド文字列。 |
| pIbscCaller | IBindStatusCallback* | in | 呼び出し側が提供する任意のIBindStatusCallbackで、進捗通知を中継する先。NULL可。 |
| ppIbsc | IBindStatusCallback** | out | 生成された標準進捗インジケーターのIBindStatusCallbackを受け取る出力ポインター。 |
戻り値の型: 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)。const std = @import("std");
extern "ole32" fn CreateStdProgressIndicator(
hwndParent: ?*anyopaque, // HWND
pszTitle: [*c]const u16, // LPCWSTR
pIbscCaller: ?*anyopaque, // IBindStatusCallback*
ppIbsc: ?*anyopaque // IBindStatusCallback** out
) callconv(std.os.windows.WINAPI) i32;proc CreateStdProgressIndicator(
hwndParent: pointer, # HWND
pszTitle: WideCString, # LPCWSTR
pIbscCaller: pointer, # IBindStatusCallback*
ppIbsc: pointer # IBindStatusCallback** out
): int32 {.importc: "CreateStdProgressIndicator", stdcall, dynlib: "OLE32.dll".}pragma(lib, "ole32");
extern(Windows)
int CreateStdProgressIndicator(
void* hwndParent, // HWND
const(wchar)* pszTitle, // LPCWSTR
void* pIbscCaller, // IBindStatusCallback*
void* ppIbsc // IBindStatusCallback** out
);ccall((:CreateStdProgressIndicator, "OLE32.dll"), stdcall, Int32,
(Ptr{Cvoid}, Cwstring, Ptr{Cvoid}, Ptr{Cvoid}),
hwndParent, pszTitle, pIbscCaller, ppIbsc)
# hwndParent : HWND -> Ptr{Cvoid}
# pszTitle : LPCWSTR -> Cwstring
# pIbscCaller : IBindStatusCallback* -> Ptr{Cvoid}
# ppIbsc : IBindStatusCallback** out -> Ptr{Cvoid}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t CreateStdProgressIndicator(
void* hwndParent,
const uint16_t* pszTitle,
void* pIbscCaller,
void* ppIbsc);
]]
local ole32 = ffi.load("ole32")
-- ole32.CreateStdProgressIndicator(hwndParent, pszTitle, pIbscCaller, ppIbsc)
-- hwndParent : HWND
-- pszTitle : LPCWSTR
-- pIbscCaller : IBindStatusCallback*
-- ppIbsc : IBindStatusCallback** out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('OLE32.dll');
const CreateStdProgressIndicator = lib.func('__stdcall', 'CreateStdProgressIndicator', 'int32_t', ['void *', 'str16', 'void *', 'void *']);
// CreateStdProgressIndicator(hwndParent, pszTitle, pIbscCaller, ppIbsc)
// hwndParent : HWND -> 'void *'
// pszTitle : LPCWSTR -> 'str16'
// pIbscCaller : IBindStatusCallback* -> 'void *'
// ppIbsc : IBindStatusCallback** out -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("OLE32.dll", {
CreateStdProgressIndicator: { parameters: ["pointer", "buffer", "pointer", "pointer"], result: "i32" },
});
// lib.symbols.CreateStdProgressIndicator(hwndParent, pszTitle, pIbscCaller, ppIbsc)
// hwndParent : HWND -> "pointer"
// pszTitle : LPCWSTR -> "buffer"
// pIbscCaller : IBindStatusCallback* -> "pointer"
// ppIbsc : IBindStatusCallback** out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t CreateStdProgressIndicator(
void* hwndParent,
const uint16_t* pszTitle,
void* pIbscCaller,
void* ppIbsc);
C, "OLE32.dll");
// $ffi->CreateStdProgressIndicator(hwndParent, pszTitle, pIbscCaller, ppIbsc);
// hwndParent : HWND
// pszTitle : LPCWSTR
// pIbscCaller : IBindStatusCallback*
// ppIbsc : IBindStatusCallback** out
// 構造体/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 Ole32 extends StdCallLibrary {
Ole32 INSTANCE = Native.load("ole32", Ole32.class);
int CreateStdProgressIndicator(
Pointer hwndParent, // HWND
WString pszTitle, // LPCWSTR
Pointer pIbscCaller, // IBindStatusCallback*
Pointer ppIbsc // IBindStatusCallback** out
);
}@[Link("ole32")]
lib LibOLE32
fun CreateStdProgressIndicator = CreateStdProgressIndicator(
hwndParent : Void*, # HWND
pszTitle : UInt16*, # LPCWSTR
pIbscCaller : Void*, # IBindStatusCallback*
ppIbsc : Void* # IBindStatusCallback** out
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef CreateStdProgressIndicatorNative = Int32 Function(Pointer<Void>, Pointer<Utf16>, Pointer<Void>, Pointer<Void>);
typedef CreateStdProgressIndicatorDart = int Function(Pointer<Void>, Pointer<Utf16>, Pointer<Void>, Pointer<Void>);
final CreateStdProgressIndicator = DynamicLibrary.open('OLE32.dll')
.lookupFunction<CreateStdProgressIndicatorNative, CreateStdProgressIndicatorDart>('CreateStdProgressIndicator');
// hwndParent : HWND -> Pointer<Void>
// pszTitle : LPCWSTR -> Pointer<Utf16>
// pIbscCaller : IBindStatusCallback* -> Pointer<Void>
// ppIbsc : IBindStatusCallback** out -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function CreateStdProgressIndicator(
hwndParent: THandle; // HWND
pszTitle: PWideChar; // LPCWSTR
pIbscCaller: Pointer; // IBindStatusCallback*
ppIbsc: Pointer // IBindStatusCallback** out
): Integer; stdcall;
external 'OLE32.dll' name 'CreateStdProgressIndicator';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "CreateStdProgressIndicator"
c_CreateStdProgressIndicator :: Ptr () -> CWString -> Ptr () -> Ptr () -> IO Int32
-- hwndParent : HWND -> Ptr ()
-- pszTitle : LPCWSTR -> CWString
-- pIbscCaller : IBindStatusCallback* -> Ptr ()
-- ppIbsc : IBindStatusCallback** out -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let createstdprogressindicator =
foreign "CreateStdProgressIndicator"
((ptr void) @-> (ptr uint16_t) @-> (ptr void) @-> (ptr void) @-> returning int32_t)
(* hwndParent : HWND -> (ptr void) *)
(* pszTitle : LPCWSTR -> (ptr uint16_t) *)
(* pIbscCaller : IBindStatusCallback* -> (ptr void) *)
(* ppIbsc : IBindStatusCallback** out -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library ole32 (t "OLE32.dll"))
(cffi:use-foreign-library ole32)
(cffi:defcfun ("CreateStdProgressIndicator" create-std-progress-indicator :convention :stdcall) :int32
(hwnd-parent :pointer) ; HWND
(psz-title (:string :encoding :utf-16le)) ; LPCWSTR
(p-ibsc-caller :pointer) ; IBindStatusCallback*
(pp-ibsc :pointer)) ; IBindStatusCallback** out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $CreateStdProgressIndicator = Win32::API::More->new('OLE32',
'int CreateStdProgressIndicator(HANDLE hwndParent, LPCWSTR pszTitle, LPVOID pIbscCaller, LPVOID ppIbsc)');
# my $ret = $CreateStdProgressIndicator->Call($hwndParent, $pszTitle, $pIbscCaller, $ppIbsc);
# hwndParent : HWND -> HANDLE
# pszTitle : LPCWSTR -> LPCWSTR
# pIbscCaller : IBindStatusCallback* -> LPVOID
# ppIbsc : IBindStatusCallback** out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。