ホーム › UI.Controls › CreatePropertySheetPageW
CreatePropertySheetPageW
関数プロパティシートページを作成する(Unicode版)。
シグネチャ
// COMCTL32.dll (Unicode / -W)
#include <windows.h>
HPROPSHEETPAGE CreatePropertySheetPageW(
PROPSHEETPAGEW* constPropSheetPagePointer
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| constPropSheetPagePointer | PROPSHEETPAGEW* | inout | プロパティシートに含めるページを定義する PROPSHEETPAGE 構造体へのポインターです。 |
戻り値の型: HPROPSHEETPAGE
公式ドキュメント
プロパティシートに新しいページを作成します。(Unicode)
戻り値
型: HPROPSHEETPAGE
成功した場合は新しいプロパティページのハンドルを返し、それ以外の場合は NULL を返します。
解説(Remarks)
注意 コモンコントロール バージョン 7.0 より前では、この関数はビジュアルスタイルをサポートしていませんでした。
Windows 95: システムが対応できるウィンドウハンドルの最大数は 16,364 個です。
メモ
prsht.h ヘッダーは CreatePropertySheetPage を、UNICODE プリプロセッサ定数の定義に基づいてこの関数の ANSI 版または Unicode 版を自動的に選択するエイリアスとして定義しています。エンコーディング非依存のエイリアスを、エンコーディング非依存でないコードと混在させて使用すると、不一致が生じてコンパイルエラーや実行時エラーの原因となる可能性があります。詳細については、Conventions for Function Prototypes を参照してください。
出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
各言語での呼び出し定義
// COMCTL32.dll (Unicode / -W)
#include <windows.h>
HPROPSHEETPAGE CreatePropertySheetPageW(
PROPSHEETPAGEW* constPropSheetPagePointer
);[DllImport("COMCTL32.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
static extern IntPtr CreatePropertySheetPageW(
IntPtr constPropSheetPagePointer // PROPSHEETPAGEW* in/out
);<DllImport("COMCTL32.dll", CharSet:=CharSet.Unicode, ExactSpelling:=True)>
Public Shared Function CreatePropertySheetPageW(
constPropSheetPagePointer As IntPtr ' PROPSHEETPAGEW* in/out
) As IntPtr
End Function' constPropSheetPagePointer : PROPSHEETPAGEW* in/out
Declare PtrSafe Function CreatePropertySheetPageW Lib "comctl32" ( _
ByVal constPropSheetPagePointer As LongPtr) As LongPtr
' 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
CreatePropertySheetPageW = ctypes.windll.comctl32.CreatePropertySheetPageW
CreatePropertySheetPageW.restype = ctypes.c_void_p
CreatePropertySheetPageW.argtypes = [
ctypes.c_void_p, # constPropSheetPagePointer : PROPSHEETPAGEW* in/out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('COMCTL32.dll')
CreatePropertySheetPageW = Fiddle::Function.new(
lib['CreatePropertySheetPageW'],
[
Fiddle::TYPE_VOIDP, # constPropSheetPagePointer : PROPSHEETPAGEW* in/out
],
Fiddle::TYPE_VOIDP)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"#[link(name = "comctl32")]
extern "system" {
fn CreatePropertySheetPageW(
constPropSheetPagePointer: *mut PROPSHEETPAGEW // PROPSHEETPAGEW* in/out
) -> *mut core::ffi::c_void;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("COMCTL32.dll", CharSet = CharSet.Unicode)]
public static extern IntPtr CreatePropertySheetPageW(IntPtr constPropSheetPagePointer);
"@
$api = Add-Type -MemberDefinition $sig -Name 'COMCTL32_CreatePropertySheetPageW' -Namespace Win32 -PassThru
# $api::CreatePropertySheetPageW(constPropSheetPagePointer)#uselib "COMCTL32.dll"
#func global CreatePropertySheetPageW "CreatePropertySheetPageW" wptr
; CreatePropertySheetPageW varptr(constPropSheetPagePointer) ; 戻り値は stat
; constPropSheetPagePointer : PROPSHEETPAGEW* in/out -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "COMCTL32.dll" #cfunc global CreatePropertySheetPageW "CreatePropertySheetPageW" var ; res = CreatePropertySheetPageW(constPropSheetPagePointer) ; constPropSheetPagePointer : PROPSHEETPAGEW* in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "COMCTL32.dll" #cfunc global CreatePropertySheetPageW "CreatePropertySheetPageW" sptr ; res = CreatePropertySheetPageW(varptr(constPropSheetPagePointer)) ; constPropSheetPagePointer : PROPSHEETPAGEW* in/out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; HPROPSHEETPAGE CreatePropertySheetPageW(PROPSHEETPAGEW* constPropSheetPagePointer) #uselib "COMCTL32.dll" #cfunc global CreatePropertySheetPageW "CreatePropertySheetPageW" var ; res = CreatePropertySheetPageW(constPropSheetPagePointer) ; constPropSheetPagePointer : PROPSHEETPAGEW* in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; HPROPSHEETPAGE CreatePropertySheetPageW(PROPSHEETPAGEW* constPropSheetPagePointer) #uselib "COMCTL32.dll" #cfunc global CreatePropertySheetPageW "CreatePropertySheetPageW" intptr ; res = CreatePropertySheetPageW(varptr(constPropSheetPagePointer)) ; constPropSheetPagePointer : PROPSHEETPAGEW* in/out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
comctl32 = windows.NewLazySystemDLL("COMCTL32.dll")
procCreatePropertySheetPageW = comctl32.NewProc("CreatePropertySheetPageW")
)
// constPropSheetPagePointer (PROPSHEETPAGEW* in/out)
r1, _, err := procCreatePropertySheetPageW.Call(
uintptr(constPropSheetPagePointer),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HPROPSHEETPAGEfunction CreatePropertySheetPageW(
constPropSheetPagePointer: Pointer // PROPSHEETPAGEW* in/out
): THandle; stdcall;
external 'COMCTL32.dll' name 'CreatePropertySheetPageW';result := DllCall("COMCTL32\CreatePropertySheetPageW"
, "Ptr", constPropSheetPagePointer ; PROPSHEETPAGEW* in/out
, "Ptr") ; return: HPROPSHEETPAGE●CreatePropertySheetPageW(constPropSheetPagePointer) = DLL("COMCTL32.dll", "void* CreatePropertySheetPageW(void*)")
# 呼び出し: CreatePropertySheetPageW(constPropSheetPagePointer)
# constPropSheetPagePointer : PROPSHEETPAGEW* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※-W(Unicode)関数。なでしこ1はANSIのため -A 版の利用を推奨。const std = @import("std");
extern "comctl32" fn CreatePropertySheetPageW(
constPropSheetPagePointer: [*c]PROPSHEETPAGEW // PROPSHEETPAGEW* in/out
) callconv(std.os.windows.WINAPI) ?*anyopaque;
// Unicode(-W): UTF-16LE のヌル終端バッファ([*c]const u16)を渡す。proc CreatePropertySheetPageW(
constPropSheetPagePointer: ptr PROPSHEETPAGEW # PROPSHEETPAGEW* in/out
): pointer {.importc: "CreatePropertySheetPageW", stdcall, dynlib: "COMCTL32.dll".}
# Unicode(-W): WideCString は newWideCString("...") で生成。pragma(lib, "comctl32");
extern(Windows)
void* CreatePropertySheetPageW(
PROPSHEETPAGEW* constPropSheetPagePointer // PROPSHEETPAGEW* in/out
);ccall((:CreatePropertySheetPageW, "COMCTL32.dll"), stdcall, Ptr{Cvoid},
(Ptr{PROPSHEETPAGEW},),
constPropSheetPagePointer)
# constPropSheetPagePointer : PROPSHEETPAGEW* in/out -> Ptr{PROPSHEETPAGEW}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
# Unicode(-W): Cwstring には transcode(UInt16, "...") 等で UTF-16 を渡す。local ffi = require("ffi")
ffi.cdef[[
void* CreatePropertySheetPageW(
void* constPropSheetPagePointer);
]]
local comctl32 = ffi.load("comctl32")
-- comctl32.CreatePropertySheetPageW(constPropSheetPagePointer)
-- constPropSheetPagePointer : PROPSHEETPAGEW* in/out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
-- Unicode(-W): uint16_t* には UTF-16LE のバッファ(ffi.new("uint16_t[?]", ...))を渡す。const koffi = require('koffi');
const lib = koffi.load('COMCTL32.dll');
const CreatePropertySheetPageW = lib.func('__stdcall', 'CreatePropertySheetPageW', 'void *', ['void *']);
// CreatePropertySheetPageW(constPropSheetPagePointer)
// constPropSheetPagePointer : PROPSHEETPAGEW* in/out -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("COMCTL32.dll", {
CreatePropertySheetPageW: { parameters: ["pointer"], result: "pointer" },
});
// lib.symbols.CreatePropertySheetPageW(constPropSheetPagePointer)
// constPropSheetPagePointer : PROPSHEETPAGEW* in/out -> "pointer"
// 文字列は "buffer"。Unicode(-W) は new TextEncoder() ではなく UTF-16LE のバイト列(末尾に \x00\x00)を Uint8Array で渡す。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
void* CreatePropertySheetPageW(
void* constPropSheetPagePointer);
C, "COMCTL32.dll");
// $ffi->CreatePropertySheetPageW(constPropSheetPagePointer);
// constPropSheetPagePointer : PROPSHEETPAGEW* in/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 Comctl32 extends StdCallLibrary {
Comctl32 INSTANCE = Native.load("comctl32", Comctl32.class, W32APIOptions.UNICODE_OPTIONS);
Pointer CreatePropertySheetPageW(
Pointer constPropSheetPagePointer // PROPSHEETPAGEW* in/out
);
}
// Unicode(-W): WString(入力)/char[](出力)で UTF-16 をマーシャリング。@[Link("comctl32")]
lib LibCOMCTL32
fun CreatePropertySheetPageW = CreatePropertySheetPageW(
constPropSheetPagePointer : PROPSHEETPAGEW* # PROPSHEETPAGEW* in/out
) : Void*
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef CreatePropertySheetPageWNative = Pointer<Void> Function(Pointer<Void>);
typedef CreatePropertySheetPageWDart = Pointer<Void> Function(Pointer<Void>);
final CreatePropertySheetPageW = DynamicLibrary.open('COMCTL32.dll')
.lookupFunction<CreatePropertySheetPageWNative, CreatePropertySheetPageWDart>('CreatePropertySheetPageW');
// constPropSheetPagePointer : PROPSHEETPAGEW* in/out -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function CreatePropertySheetPageW(
constPropSheetPagePointer: Pointer // PROPSHEETPAGEW* in/out
): THandle; stdcall;
external 'COMCTL32.dll' name 'CreatePropertySheetPageW';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "CreatePropertySheetPageW"
c_CreatePropertySheetPageW :: Ptr () -> IO (Ptr ())
-- constPropSheetPagePointer : PROPSHEETPAGEW* in/out -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let createpropertysheetpagew =
foreign "CreatePropertySheetPageW"
((ptr void) @-> returning (ptr void))
(* constPropSheetPagePointer : PROPSHEETPAGEW* in/out -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library comctl32 (t "COMCTL32.dll"))
(cffi:use-foreign-library comctl32)
(cffi:defcfun ("CreatePropertySheetPageW" create-property-sheet-page-w :convention :stdcall) :pointer
(const-prop-sheet-page-pointer :pointer)) ; PROPSHEETPAGEW* in/out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $CreatePropertySheetPageW = Win32::API::More->new('COMCTL32',
'HANDLE CreatePropertySheetPageW(LPVOID constPropSheetPagePointer)');
# my $ret = $CreatePropertySheetPageW->Call($constPropSheetPagePointer);
# constPropSheetPagePointer : PROPSHEETPAGEW* in/out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。
# Unicode(-W): LPCWSTR/LPWSTR は Win32::API が UTF-16 変換を行う。関連項目
文字セット違い
- f CreatePropertySheetPageA (ANSI版) — プロパティシートページを作成する(ANSI版)。
使用する型