Win32 API 日本語リファレンス
ホームSystem.Ole › OleUIUpdateLinksW

OleUIUpdateLinksW

関数
コンテナ内のすべてのリンクを更新し進捗を表示する。
DLLoledlg.dll文字セットUnicode (-W)呼出規約winapi対応OSWindows 2000 以降

シグネチャ

// oledlg.dll  (Unicode / -W)
#include <windows.h>

BOOL OleUIUpdateLinksW(
    IOleUILinkContainerW* lpOleUILinkCntr,
    HWND hwndParent,
    LPWSTR lpszTitle,
    INT cLinks
);

パラメーター

名前方向説明
lpOleUILinkCntrIOleUILinkContainerW*inリンクコンテナ上の IOleUILinkContainer インターフェイスへのポインターです。
hwndParentHWNDinダイアログボックスの親ウィンドウです。
lpszTitleLPWSTRinダイアログボックスのタイトルへのポインターです。
cLinksINTinリンクの総数です。

戻り値の型: BOOL

公式ドキュメント

リンクコンテナ内のすべてのリンクを更新し、更新処理の進行状況を示すダイアログボックスを表示します。ユーザーが Stop ボタンを押すか、すべてのリンクが処理されると、処理は停止します。(Unicode)

戻り値

リンクが正常に更新された場合は TRUE を、それ以外の場合は FALSE を返します。

解説(Remarks)

メモ

oledlg.h ヘッダーは OleUIUpdateLinks を、UNICODE プリプロセッサ定数の定義に基づいてこの関数の ANSI 版または Unicode 版を自動的に選択するエイリアスとして定義します。エンコーディング中立のエイリアスの使用を、エンコーディング中立でないコードと混在させると、不整合が生じ、コンパイルエラーや実行時エラーを引き起こす可能性があります。詳細については、関数プロトタイプの規約を参照してください。

出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)

各言語での呼び出し定義

// oledlg.dll  (Unicode / -W)
#include <windows.h>

BOOL OleUIUpdateLinksW(
    IOleUILinkContainerW* lpOleUILinkCntr,
    HWND hwndParent,
    LPWSTR lpszTitle,
    INT cLinks
);
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("oledlg.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
static extern bool OleUIUpdateLinksW(
    IntPtr lpOleUILinkCntr,   // IOleUILinkContainerW*
    IntPtr hwndParent,   // HWND
    [MarshalAs(UnmanagedType.LPWStr)] string lpszTitle,   // LPWSTR
    int cLinks   // INT
);
<DllImport("oledlg.dll", CharSet:=CharSet.Unicode, ExactSpelling:=True)>
Public Shared Function OleUIUpdateLinksW(
    lpOleUILinkCntr As IntPtr,   ' IOleUILinkContainerW*
    hwndParent As IntPtr,   ' HWND
    <MarshalAs(UnmanagedType.LPWStr)> lpszTitle As String,   ' LPWSTR
    cLinks As Integer   ' INT
) As <MarshalAs(UnmanagedType.Bool)> Boolean
End Function
' lpOleUILinkCntr : IOleUILinkContainerW*
' hwndParent : HWND
' lpszTitle : LPWSTR
' cLinks : INT
Declare PtrSafe Function OleUIUpdateLinksW Lib "oledlg" ( _
    ByVal lpOleUILinkCntr As LongPtr, _
    ByVal hwndParent As LongPtr, _
    ByVal lpszTitle As LongPtr, _
    ByVal cLinks As Long) As Long
' Unicode(W): 文字列は ByVal As LongPtr とし StrPtr(unicodeStr) を渡す
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

OleUIUpdateLinksW = ctypes.windll.oledlg.OleUIUpdateLinksW
OleUIUpdateLinksW.restype = wintypes.BOOL
OleUIUpdateLinksW.argtypes = [
    ctypes.c_void_p,  # lpOleUILinkCntr : IOleUILinkContainerW*
    wintypes.HANDLE,  # hwndParent : HWND
    wintypes.LPCWSTR,  # lpszTitle : LPWSTR
    ctypes.c_int,  # cLinks : INT
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('oledlg.dll')
OleUIUpdateLinksW = Fiddle::Function.new(
  lib['OleUIUpdateLinksW'],
  [
    Fiddle::TYPE_VOIDP,  # lpOleUILinkCntr : IOleUILinkContainerW*
    Fiddle::TYPE_VOIDP,  # hwndParent : HWND
    Fiddle::TYPE_VOIDP,  # lpszTitle : LPWSTR
    Fiddle::TYPE_INT,  # cLinks : INT
  ],
  Fiddle::TYPE_INT)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"
#[link(name = "oledlg")]
extern "system" {
    fn OleUIUpdateLinksW(
        lpOleUILinkCntr: *mut core::ffi::c_void,  // IOleUILinkContainerW*
        hwndParent: *mut core::ffi::c_void,  // HWND
        lpszTitle: *mut u16,  // LPWSTR
        cLinks: i32  // INT
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("oledlg.dll", CharSet = CharSet.Unicode)]
public static extern bool OleUIUpdateLinksW(IntPtr lpOleUILinkCntr, IntPtr hwndParent, [MarshalAs(UnmanagedType.LPWStr)] string lpszTitle, int cLinks);
"@
$api = Add-Type -MemberDefinition $sig -Name 'oledlg_OleUIUpdateLinksW' -Namespace Win32 -PassThru
# $api::OleUIUpdateLinksW(lpOleUILinkCntr, hwndParent, lpszTitle, cLinks)
#uselib "oledlg.dll"
#func global OleUIUpdateLinksW "OleUIUpdateLinksW" wptr, wptr, wptr, wptr
; OleUIUpdateLinksW lpOleUILinkCntr, hwndParent, lpszTitle, cLinks   ; 戻り値は stat
; lpOleUILinkCntr : IOleUILinkContainerW* -> "wptr"
; hwndParent : HWND -> "wptr"
; lpszTitle : LPWSTR -> "wptr"
; cLinks : INT -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "oledlg.dll"
#cfunc global OleUIUpdateLinksW "OleUIUpdateLinksW" sptr, sptr, wstr, int
; res = OleUIUpdateLinksW(lpOleUILinkCntr, hwndParent, lpszTitle, cLinks)
; lpOleUILinkCntr : IOleUILinkContainerW* -> "sptr"
; hwndParent : HWND -> "sptr"
; lpszTitle : LPWSTR -> "wstr"
; cLinks : INT -> "int"
; BOOL OleUIUpdateLinksW(IOleUILinkContainerW* lpOleUILinkCntr, HWND hwndParent, LPWSTR lpszTitle, INT cLinks)
#uselib "oledlg.dll"
#cfunc global OleUIUpdateLinksW "OleUIUpdateLinksW" intptr, intptr, wstr, int
; res = OleUIUpdateLinksW(lpOleUILinkCntr, hwndParent, lpszTitle, cLinks)
; lpOleUILinkCntr : IOleUILinkContainerW* -> "intptr"
; hwndParent : HWND -> "intptr"
; lpszTitle : LPWSTR -> "wstr"
; cLinks : INT -> "int"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	oledlg = windows.NewLazySystemDLL("oledlg.dll")
	procOleUIUpdateLinksW = oledlg.NewProc("OleUIUpdateLinksW")
)

// lpOleUILinkCntr (IOleUILinkContainerW*), hwndParent (HWND), lpszTitle (LPWSTR), cLinks (INT)
r1, _, err := procOleUIUpdateLinksW.Call(
	uintptr(lpOleUILinkCntr),
	uintptr(hwndParent),
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(lpszTitle))),
	uintptr(cLinks),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // BOOL
function OleUIUpdateLinksW(
  lpOleUILinkCntr: Pointer;   // IOleUILinkContainerW*
  hwndParent: THandle;   // HWND
  lpszTitle: PWideChar;   // LPWSTR
  cLinks: Integer   // INT
): BOOL; stdcall;
  external 'oledlg.dll' name 'OleUIUpdateLinksW';
result := DllCall("oledlg\OleUIUpdateLinksW"
    , "Ptr", lpOleUILinkCntr   ; IOleUILinkContainerW*
    , "Ptr", hwndParent   ; HWND
    , "WStr", lpszTitle   ; LPWSTR
    , "Int", cLinks   ; INT
    , "Int")   ; return: BOOL
●OleUIUpdateLinksW(lpOleUILinkCntr, hwndParent, lpszTitle, cLinks) = DLL("oledlg.dll", "bool OleUIUpdateLinksW(void*, void*, char*, int)")
# 呼び出し: OleUIUpdateLinksW(lpOleUILinkCntr, hwndParent, lpszTitle, cLinks)
# lpOleUILinkCntr : IOleUILinkContainerW* -> "void*"
# hwndParent : HWND -> "void*"
# lpszTitle : LPWSTR -> "char*"
# cLinks : INT -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※-W(Unicode)関数。なでしこ1はANSIのため -A 版の利用を推奨。
const std = @import("std");

extern "oledlg" fn OleUIUpdateLinksW(
    lpOleUILinkCntr: ?*anyopaque, // IOleUILinkContainerW*
    hwndParent: ?*anyopaque, // HWND
    lpszTitle: [*c]const u16, // LPWSTR
    cLinks: i32 // INT
) callconv(std.os.windows.WINAPI) i32;
// Unicode(-W): UTF-16LE のヌル終端バッファ([*c]const u16)を渡す。
proc OleUIUpdateLinksW(
    lpOleUILinkCntr: pointer,  # IOleUILinkContainerW*
    hwndParent: pointer,  # HWND
    lpszTitle: WideCString,  # LPWSTR
    cLinks: int32  # INT
): int32 {.importc: "OleUIUpdateLinksW", stdcall, dynlib: "oledlg.dll".}
# Unicode(-W): WideCString は newWideCString("...") で生成。
pragma(lib, "oledlg");
extern(Windows)
int OleUIUpdateLinksW(
    void* lpOleUILinkCntr,   // IOleUILinkContainerW*
    void* hwndParent,   // HWND
    const(wchar)* lpszTitle,   // LPWSTR
    int cLinks   // INT
);
ccall((:OleUIUpdateLinksW, "oledlg.dll"), stdcall, Int32,
      (Ptr{Cvoid}, Ptr{Cvoid}, Cwstring, Int32),
      lpOleUILinkCntr, hwndParent, lpszTitle, cLinks)
# lpOleUILinkCntr : IOleUILinkContainerW* -> Ptr{Cvoid}
# hwndParent : HWND -> Ptr{Cvoid}
# lpszTitle : LPWSTR -> Cwstring
# cLinks : INT -> Int32
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
# Unicode(-W): Cwstring には transcode(UInt16, "...") 等で UTF-16 を渡す。
local ffi = require("ffi")
ffi.cdef[[
int32_t OleUIUpdateLinksW(
    void* lpOleUILinkCntr,
    void* hwndParent,
    const uint16_t* lpszTitle,
    int32_t cLinks);
]]
local oledlg = ffi.load("oledlg")
-- oledlg.OleUIUpdateLinksW(lpOleUILinkCntr, hwndParent, lpszTitle, cLinks)
-- lpOleUILinkCntr : IOleUILinkContainerW*
-- hwndParent : HWND
-- lpszTitle : LPWSTR
-- cLinks : INT
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
-- Unicode(-W): uint16_t* には UTF-16LE のバッファ(ffi.new("uint16_t[?]", ...))を渡す。
const koffi = require('koffi');
const lib = koffi.load('oledlg.dll');
const OleUIUpdateLinksW = lib.func('__stdcall', 'OleUIUpdateLinksW', 'int32_t', ['void *', 'void *', 'str16', 'int32_t']);
// OleUIUpdateLinksW(lpOleUILinkCntr, hwndParent, lpszTitle, cLinks)
// lpOleUILinkCntr : IOleUILinkContainerW* -> 'void *'
// hwndParent : HWND -> 'void *'
// lpszTitle : LPWSTR -> 'str16'
// cLinks : INT -> 'int32_t'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("oledlg.dll", {
  OleUIUpdateLinksW: { parameters: ["pointer", "pointer", "buffer", "i32"], result: "i32" },
});
// lib.symbols.OleUIUpdateLinksW(lpOleUILinkCntr, hwndParent, lpszTitle, cLinks)
// lpOleUILinkCntr : IOleUILinkContainerW* -> "pointer"
// hwndParent : HWND -> "pointer"
// lpszTitle : LPWSTR -> "buffer"
// cLinks : INT -> "i32"
// 文字列は "buffer"。Unicode(-W) は new TextEncoder() ではなく UTF-16LE のバイト列(末尾に \x00\x00)を Uint8Array で渡す。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
int32_t OleUIUpdateLinksW(
    void* lpOleUILinkCntr,
    void* hwndParent,
    const uint16_t* lpszTitle,
    int32_t cLinks);
C, "oledlg.dll");
// $ffi->OleUIUpdateLinksW(lpOleUILinkCntr, hwndParent, lpszTitle, cLinks);
// lpOleUILinkCntr : IOleUILinkContainerW*
// hwndParent : HWND
// lpszTitle : LPWSTR
// cLinks : INT
// 構造体/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 Oledlg extends StdCallLibrary {
    Oledlg INSTANCE = Native.load("oledlg", Oledlg.class, W32APIOptions.UNICODE_OPTIONS);
    boolean OleUIUpdateLinksW(
        Pointer lpOleUILinkCntr,   // IOleUILinkContainerW*
        Pointer hwndParent,   // HWND
        WString lpszTitle,   // LPWSTR
        int cLinks   // INT
    );
}
// Unicode(-W): WString(入力)/char[](出力)で UTF-16 をマーシャリング。
@[Link("oledlg")]
lib Liboledlg
  fun OleUIUpdateLinksW = OleUIUpdateLinksW(
    lpOleUILinkCntr : Void*,   # IOleUILinkContainerW*
    hwndParent : Void*,   # HWND
    lpszTitle : UInt16*,   # LPWSTR
    cLinks : Int32   # INT
  ) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef OleUIUpdateLinksWNative = Int32 Function(Pointer<Void>, Pointer<Void>, Pointer<Utf16>, Int32);
typedef OleUIUpdateLinksWDart = int Function(Pointer<Void>, Pointer<Void>, Pointer<Utf16>, int);
final OleUIUpdateLinksW = DynamicLibrary.open('oledlg.dll')
    .lookupFunction<OleUIUpdateLinksWNative, OleUIUpdateLinksWDart>('OleUIUpdateLinksW');
// lpOleUILinkCntr : IOleUILinkContainerW* -> Pointer<Void>
// hwndParent : HWND -> Pointer<Void>
// lpszTitle : LPWSTR -> Pointer<Utf16>
// cLinks : INT -> Int32
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function OleUIUpdateLinksW(
  lpOleUILinkCntr: Pointer;   // IOleUILinkContainerW*
  hwndParent: THandle;   // HWND
  lpszTitle: PWideChar;   // LPWSTR
  cLinks: Integer   // INT
): BOOL; stdcall;
  external 'oledlg.dll' name 'OleUIUpdateLinksW';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "OleUIUpdateLinksW"
  c_OleUIUpdateLinksW :: Ptr () -> Ptr () -> CWString -> Int32 -> IO CInt
-- lpOleUILinkCntr : IOleUILinkContainerW* -> Ptr ()
-- hwndParent : HWND -> Ptr ()
-- lpszTitle : LPWSTR -> CWString
-- cLinks : INT -> Int32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let oleuiupdatelinksw =
  foreign "OleUIUpdateLinksW"
    ((ptr void) @-> (ptr void) @-> (ptr uint16_t) @-> int32_t @-> returning int32_t)
(* lpOleUILinkCntr : IOleUILinkContainerW* -> (ptr void) *)
(* hwndParent : HWND -> (ptr void) *)
(* lpszTitle : LPWSTR -> (ptr uint16_t) *)
(* cLinks : INT -> int32_t *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library oledlg (t "oledlg.dll"))
(cffi:use-foreign-library oledlg)

(cffi:defcfun ("OleUIUpdateLinksW" ole-uiupdate-links-w :convention :stdcall) :int32
  (lp-ole-uilink-cntr :pointer)   ; IOleUILinkContainerW*
  (hwnd-parent :pointer)   ; HWND
  (lpsz-title (:string :encoding :utf-16le))   ; LPWSTR
  (c-links :int32))   ; INT
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $OleUIUpdateLinksW = Win32::API::More->new('oledlg',
    'BOOL OleUIUpdateLinksW(LPVOID lpOleUILinkCntr, HANDLE hwndParent, LPCWSTR lpszTitle, int cLinks)');
# my $ret = $OleUIUpdateLinksW->Call($lpOleUILinkCntr, $hwndParent, $lpszTitle, $cLinks);
# lpOleUILinkCntr : IOleUILinkContainerW* -> LPVOID
# hwndParent : HWND -> HANDLE
# lpszTitle : LPWSTR -> LPCWSTR
# cLinks : INT -> int
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。
# Unicode(-W): LPCWSTR/LPWSTR は Win32::API が UTF-16 変換を行う。

関連項目

文字セット違い
使用する型