Win32 API 日本語リファレンス
ホームStorage.CloudFilters › CfReportProviderProgress

CfReportProviderProgress

関数
プロバイダーのデータ転送進捗を報告する。
DLLcldapi.dll呼出規約winapi対応OSWindows 10 以降

シグネチャ

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

HRESULT CfReportProviderProgress(
    CF_CONNECTION_KEY ConnectionKey,
    LONGLONG TransferKey,
    LONGLONG ProviderProgressTotal,
    LONGLONG ProviderProgressCompleted
);

パラメーター

名前方向説明
ConnectionKeyCF_CONNECTION_KEYin進捗を報告する接続を識別するCF_CONNECTION_KEY。
TransferKeyLONGLONGin対象転送を識別する転送キー。
ProviderProgressTotalLONGLONGin処理予定の総量を示す値。進捗率算出の分母となる。
ProviderProgressCompletedLONGLONGin現時点で完了した量を示す値。ProviderProgressTotalに対する進捗を表す。

戻り値の型: HRESULT

各言語での呼び出し定義

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

HRESULT CfReportProviderProgress(
    CF_CONNECTION_KEY ConnectionKey,
    LONGLONG TransferKey,
    LONGLONG ProviderProgressTotal,
    LONGLONG ProviderProgressCompleted
);
[DllImport("cldapi.dll", ExactSpelling = true)]
static extern int CfReportProviderProgress(
    long ConnectionKey,   // CF_CONNECTION_KEY
    long TransferKey,   // LONGLONG
    long ProviderProgressTotal,   // LONGLONG
    long ProviderProgressCompleted   // LONGLONG
);
<DllImport("cldapi.dll", ExactSpelling:=True)>
Public Shared Function CfReportProviderProgress(
    ConnectionKey As Long,   ' CF_CONNECTION_KEY
    TransferKey As Long,   ' LONGLONG
    ProviderProgressTotal As Long,   ' LONGLONG
    ProviderProgressCompleted As Long   ' LONGLONG
) As Integer
End Function
' ConnectionKey : CF_CONNECTION_KEY
' TransferKey : LONGLONG
' ProviderProgressTotal : LONGLONG
' ProviderProgressCompleted : LONGLONG
Declare PtrSafe Function CfReportProviderProgress Lib "cldapi" ( _
    ByVal ConnectionKey As LongLong, _
    ByVal TransferKey As LongLong, _
    ByVal ProviderProgressTotal As LongLong, _
    ByVal ProviderProgressCompleted As LongLong) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

CfReportProviderProgress = ctypes.windll.cldapi.CfReportProviderProgress
CfReportProviderProgress.restype = ctypes.c_int
CfReportProviderProgress.argtypes = [
    ctypes.c_longlong,  # ConnectionKey : CF_CONNECTION_KEY
    ctypes.c_longlong,  # TransferKey : LONGLONG
    ctypes.c_longlong,  # ProviderProgressTotal : LONGLONG
    ctypes.c_longlong,  # ProviderProgressCompleted : LONGLONG
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('cldapi.dll')
CfReportProviderProgress = Fiddle::Function.new(
  lib['CfReportProviderProgress'],
  [
    Fiddle::TYPE_LONG_LONG,  # ConnectionKey : CF_CONNECTION_KEY
    Fiddle::TYPE_LONG_LONG,  # TransferKey : LONGLONG
    Fiddle::TYPE_LONG_LONG,  # ProviderProgressTotal : LONGLONG
    Fiddle::TYPE_LONG_LONG,  # ProviderProgressCompleted : LONGLONG
  ],
  Fiddle::TYPE_INT)
#[link(name = "cldapi")]
extern "system" {
    fn CfReportProviderProgress(
        ConnectionKey: i64,  // CF_CONNECTION_KEY
        TransferKey: i64,  // LONGLONG
        ProviderProgressTotal: i64,  // LONGLONG
        ProviderProgressCompleted: i64  // LONGLONG
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("cldapi.dll")]
public static extern int CfReportProviderProgress(long ConnectionKey, long TransferKey, long ProviderProgressTotal, long ProviderProgressCompleted);
"@
$api = Add-Type -MemberDefinition $sig -Name 'cldapi_CfReportProviderProgress' -Namespace Win32 -PassThru
# $api::CfReportProviderProgress(ConnectionKey, TransferKey, ProviderProgressTotal, ProviderProgressCompleted)
#uselib "cldapi.dll"
#func global CfReportProviderProgress "CfReportProviderProgress" sptr, sptr, sptr, sptr
; CfReportProviderProgress ConnectionKey, TransferKey, ProviderProgressTotal, ProviderProgressCompleted   ; 戻り値は stat
; ConnectionKey : CF_CONNECTION_KEY -> "sptr"
; TransferKey : LONGLONG -> "sptr"
; ProviderProgressTotal : LONGLONG -> "sptr"
; ProviderProgressCompleted : LONGLONG -> "sptr"
; ※HSP3.7は int64 引数(64bit値渡し)に非対応です。
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "cldapi.dll"
#cfunc global CfReportProviderProgress "CfReportProviderProgress" int64, int64, int64, int64
; res = CfReportProviderProgress(ConnectionKey, TransferKey, ProviderProgressTotal, ProviderProgressCompleted)
; ConnectionKey : CF_CONNECTION_KEY -> "int64"
; TransferKey : LONGLONG -> "int64"
; ProviderProgressTotal : LONGLONG -> "int64"
; ProviderProgressCompleted : LONGLONG -> "int64"
; ※int64 引数の DLL 値渡しは x64 ランタイム(hsp3_64)のみ対応(x86 は未対応)。
; HRESULT CfReportProviderProgress(CF_CONNECTION_KEY ConnectionKey, LONGLONG TransferKey, LONGLONG ProviderProgressTotal, LONGLONG ProviderProgressCompleted)
#uselib "cldapi.dll"
#cfunc global CfReportProviderProgress "CfReportProviderProgress" int64, int64, int64, int64
; res = CfReportProviderProgress(ConnectionKey, TransferKey, ProviderProgressTotal, ProviderProgressCompleted)
; ConnectionKey : CF_CONNECTION_KEY -> "int64"
; TransferKey : LONGLONG -> "int64"
; ProviderProgressTotal : LONGLONG -> "int64"
; ProviderProgressCompleted : LONGLONG -> "int64"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	cldapi = windows.NewLazySystemDLL("cldapi.dll")
	procCfReportProviderProgress = cldapi.NewProc("CfReportProviderProgress")
)

// ConnectionKey (CF_CONNECTION_KEY), TransferKey (LONGLONG), ProviderProgressTotal (LONGLONG), ProviderProgressCompleted (LONGLONG)
r1, _, err := procCfReportProviderProgress.Call(
	uintptr(ConnectionKey),
	uintptr(TransferKey),
	uintptr(ProviderProgressTotal),
	uintptr(ProviderProgressCompleted),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // HRESULT
function CfReportProviderProgress(
  ConnectionKey: Int64;   // CF_CONNECTION_KEY
  TransferKey: Int64;   // LONGLONG
  ProviderProgressTotal: Int64;   // LONGLONG
  ProviderProgressCompleted: Int64   // LONGLONG
): Integer; stdcall;
  external 'cldapi.dll' name 'CfReportProviderProgress';
result := DllCall("cldapi\CfReportProviderProgress"
    , "Int64", ConnectionKey   ; CF_CONNECTION_KEY
    , "Int64", TransferKey   ; LONGLONG
    , "Int64", ProviderProgressTotal   ; LONGLONG
    , "Int64", ProviderProgressCompleted   ; LONGLONG
    , "Int")   ; return: HRESULT
●CfReportProviderProgress(ConnectionKey, TransferKey, ProviderProgressTotal, ProviderProgressCompleted) = DLL("cldapi.dll", "int CfReportProviderProgress(int64, int64, int64, int64)")
# 呼び出し: CfReportProviderProgress(ConnectionKey, TransferKey, ProviderProgressTotal, ProviderProgressCompleted)
# ConnectionKey : CF_CONNECTION_KEY -> "int64"
# TransferKey : LONGLONG -> "int64"
# ProviderProgressTotal : LONGLONG -> "int64"
# ProviderProgressCompleted : LONGLONG -> "int64"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
const std = @import("std");

extern "cldapi" fn CfReportProviderProgress(
    ConnectionKey: i64, // CF_CONNECTION_KEY
    TransferKey: i64, // LONGLONG
    ProviderProgressTotal: i64, // LONGLONG
    ProviderProgressCompleted: i64 // LONGLONG
) callconv(std.os.windows.WINAPI) i32;
proc CfReportProviderProgress(
    ConnectionKey: int64,  # CF_CONNECTION_KEY
    TransferKey: int64,  # LONGLONG
    ProviderProgressTotal: int64,  # LONGLONG
    ProviderProgressCompleted: int64  # LONGLONG
): int32 {.importc: "CfReportProviderProgress", stdcall, dynlib: "cldapi.dll".}
pragma(lib, "cldapi");
extern(Windows)
int CfReportProviderProgress(
    long ConnectionKey,   // CF_CONNECTION_KEY
    long TransferKey,   // LONGLONG
    long ProviderProgressTotal,   // LONGLONG
    long ProviderProgressCompleted   // LONGLONG
);
ccall((:CfReportProviderProgress, "cldapi.dll"), stdcall, Int32,
      (Int64, Int64, Int64, Int64),
      ConnectionKey, TransferKey, ProviderProgressTotal, ProviderProgressCompleted)
# ConnectionKey : CF_CONNECTION_KEY -> Int64
# TransferKey : LONGLONG -> Int64
# ProviderProgressTotal : LONGLONG -> Int64
# ProviderProgressCompleted : LONGLONG -> Int64
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
int32_t CfReportProviderProgress(
    int64_t ConnectionKey,
    int64_t TransferKey,
    int64_t ProviderProgressTotal,
    int64_t ProviderProgressCompleted);
]]
local cldapi = ffi.load("cldapi")
-- cldapi.CfReportProviderProgress(ConnectionKey, TransferKey, ProviderProgressTotal, ProviderProgressCompleted)
-- ConnectionKey : CF_CONNECTION_KEY
-- TransferKey : LONGLONG
-- ProviderProgressTotal : LONGLONG
-- ProviderProgressCompleted : LONGLONG
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('cldapi.dll');
const CfReportProviderProgress = lib.func('__stdcall', 'CfReportProviderProgress', 'int32_t', ['int64_t', 'int64_t', 'int64_t', 'int64_t']);
// CfReportProviderProgress(ConnectionKey, TransferKey, ProviderProgressTotal, ProviderProgressCompleted)
// ConnectionKey : CF_CONNECTION_KEY -> 'int64_t'
// TransferKey : LONGLONG -> 'int64_t'
// ProviderProgressTotal : LONGLONG -> 'int64_t'
// ProviderProgressCompleted : LONGLONG -> 'int64_t'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("cldapi.dll", {
  CfReportProviderProgress: { parameters: ["i64", "i64", "i64", "i64"], result: "i32" },
});
// lib.symbols.CfReportProviderProgress(ConnectionKey, TransferKey, ProviderProgressTotal, ProviderProgressCompleted)
// ConnectionKey : CF_CONNECTION_KEY -> "i64"
// TransferKey : LONGLONG -> "i64"
// ProviderProgressTotal : LONGLONG -> "i64"
// ProviderProgressCompleted : LONGLONG -> "i64"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
int32_t CfReportProviderProgress(
    int64_t ConnectionKey,
    int64_t TransferKey,
    int64_t ProviderProgressTotal,
    int64_t ProviderProgressCompleted);
C, "cldapi.dll");
// $ffi->CfReportProviderProgress(ConnectionKey, TransferKey, ProviderProgressTotal, ProviderProgressCompleted);
// ConnectionKey : CF_CONNECTION_KEY
// TransferKey : LONGLONG
// ProviderProgressTotal : LONGLONG
// ProviderProgressCompleted : LONGLONG
// 構造体/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 Cldapi extends StdCallLibrary {
    Cldapi INSTANCE = Native.load("cldapi", Cldapi.class);
    int CfReportProviderProgress(
        long ConnectionKey,   // CF_CONNECTION_KEY
        long TransferKey,   // LONGLONG
        long ProviderProgressTotal,   // LONGLONG
        long ProviderProgressCompleted   // LONGLONG
    );
}
@[Link("cldapi")]
lib Libcldapi
  fun CfReportProviderProgress = CfReportProviderProgress(
    ConnectionKey : Int64,   # CF_CONNECTION_KEY
    TransferKey : Int64,   # LONGLONG
    ProviderProgressTotal : Int64,   # LONGLONG
    ProviderProgressCompleted : Int64   # LONGLONG
  ) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef CfReportProviderProgressNative = Int32 Function(Int64, Int64, Int64, Int64);
typedef CfReportProviderProgressDart = int Function(int, int, int, int);
final CfReportProviderProgress = DynamicLibrary.open('cldapi.dll')
    .lookupFunction<CfReportProviderProgressNative, CfReportProviderProgressDart>('CfReportProviderProgress');
// ConnectionKey : CF_CONNECTION_KEY -> Int64
// TransferKey : LONGLONG -> Int64
// ProviderProgressTotal : LONGLONG -> Int64
// ProviderProgressCompleted : LONGLONG -> Int64
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function CfReportProviderProgress(
  ConnectionKey: Int64;   // CF_CONNECTION_KEY
  TransferKey: Int64;   // LONGLONG
  ProviderProgressTotal: Int64;   // LONGLONG
  ProviderProgressCompleted: Int64   // LONGLONG
): Integer; stdcall;
  external 'cldapi.dll' name 'CfReportProviderProgress';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "CfReportProviderProgress"
  c_CfReportProviderProgress :: Int64 -> Int64 -> Int64 -> Int64 -> IO Int32
-- ConnectionKey : CF_CONNECTION_KEY -> Int64
-- TransferKey : LONGLONG -> Int64
-- ProviderProgressTotal : LONGLONG -> Int64
-- ProviderProgressCompleted : LONGLONG -> Int64
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let cfreportproviderprogress =
  foreign "CfReportProviderProgress"
    (int64_t @-> int64_t @-> int64_t @-> int64_t @-> returning int32_t)
(* ConnectionKey : CF_CONNECTION_KEY -> int64_t *)
(* TransferKey : LONGLONG -> int64_t *)
(* ProviderProgressTotal : LONGLONG -> int64_t *)
(* ProviderProgressCompleted : LONGLONG -> int64_t *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library cldapi (t "cldapi.dll"))
(cffi:use-foreign-library cldapi)

(cffi:defcfun ("CfReportProviderProgress" cf-report-provider-progress :convention :stdcall) :int32
  (connection-key :int64)   ; CF_CONNECTION_KEY
  (transfer-key :int64)   ; LONGLONG
  (provider-progress-total :int64)   ; LONGLONG
  (provider-progress-completed :int64))   ; LONGLONG
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $CfReportProviderProgress = Win32::API::More->new('cldapi',
    'int CfReportProviderProgress(INT64 ConnectionKey, INT64 TransferKey, INT64 ProviderProgressTotal, INT64 ProviderProgressCompleted)');
# my $ret = $CfReportProviderProgress->Call($ConnectionKey, $TransferKey, $ProviderProgressTotal, $ProviderProgressCompleted);
# ConnectionKey : CF_CONNECTION_KEY -> INT64
# TransferKey : LONGLONG -> INT64
# ProviderProgressTotal : LONGLONG -> INT64
# ProviderProgressCompleted : LONGLONG -> INT64
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。

関連項目

類似 API