Win32 API 日本語リファレンス
ホームUI.Controls › CreatePropertySheetPageA

CreatePropertySheetPageA

関数
プロパティシートページを作成する(ANSI版)。
DLLCOMCTL32.dll文字セットANSI (-A)呼出規約winapi対応OSWindows Vista 以降

シグネチャ

// COMCTL32.dll  (ANSI / -A)
#include <windows.h>

HPROPSHEETPAGE CreatePropertySheetPageA(
    PROPSHEETPAGEA* constPropSheetPagePointer
);

パラメーター

名前方向説明
constPropSheetPagePointerPROPSHEETPAGEA*inoutプロパティシートに含めるページを定義する PROPSHEETPAGE 構造体へのポインターです。

戻り値の型: HPROPSHEETPAGE

公式ドキュメント

プロパティシートに追加する新しいページを作成します。(ANSI)

戻り値

型: HPROPSHEETPAGE

成功した場合は新しいプロパティページのハンドルを返します。失敗した場合は NULL を返します。

解説(Remarks)

注意 common controls バージョン 7.0 より前では、この関数はビジュアルスタイルをサポートしていませんでした。
アプリケーションは PropertySheet 関数を使用して、新しいページを含むプロパティシートを作成します。Aero ウィザードスタイル(PSH_AEROWIZARD)を使用していない場合は、PSM_ADDPAGE メッセージを使用して既存のプロパティシートに新しいページを追加できます。

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)

各言語での呼び出し定義

// COMCTL32.dll  (ANSI / -A)
#include <windows.h>

HPROPSHEETPAGE CreatePropertySheetPageA(
    PROPSHEETPAGEA* constPropSheetPagePointer
);
[DllImport("COMCTL32.dll", CharSet = CharSet.Ansi, ExactSpelling = true)]
static extern IntPtr CreatePropertySheetPageA(
    IntPtr constPropSheetPagePointer   // PROPSHEETPAGEA* in/out
);
<DllImport("COMCTL32.dll", CharSet:=CharSet.Ansi, ExactSpelling:=True)>
Public Shared Function CreatePropertySheetPageA(
    constPropSheetPagePointer As IntPtr   ' PROPSHEETPAGEA* in/out
) As IntPtr
End Function
' constPropSheetPagePointer : PROPSHEETPAGEA* in/out
Declare PtrSafe Function CreatePropertySheetPageA Lib "comctl32" ( _
    ByVal constPropSheetPagePointer As LongPtr) As LongPtr
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

CreatePropertySheetPageA = ctypes.windll.comctl32.CreatePropertySheetPageA
CreatePropertySheetPageA.restype = ctypes.c_void_p
CreatePropertySheetPageA.argtypes = [
    ctypes.c_void_p,  # constPropSheetPagePointer : PROPSHEETPAGEA* in/out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('COMCTL32.dll')
CreatePropertySheetPageA = Fiddle::Function.new(
  lib['CreatePropertySheetPageA'],
  [
    Fiddle::TYPE_VOIDP,  # constPropSheetPagePointer : PROPSHEETPAGEA* in/out
  ],
  Fiddle::TYPE_VOIDP)
#[link(name = "comctl32")]
extern "system" {
    fn CreatePropertySheetPageA(
        constPropSheetPagePointer: *mut PROPSHEETPAGEA  // PROPSHEETPAGEA* in/out
    ) -> *mut core::ffi::c_void;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("COMCTL32.dll", CharSet = CharSet.Ansi)]
public static extern IntPtr CreatePropertySheetPageA(IntPtr constPropSheetPagePointer);
"@
$api = Add-Type -MemberDefinition $sig -Name 'COMCTL32_CreatePropertySheetPageA' -Namespace Win32 -PassThru
# $api::CreatePropertySheetPageA(constPropSheetPagePointer)
#uselib "COMCTL32.dll"
#func global CreatePropertySheetPageA "CreatePropertySheetPageA" sptr
; CreatePropertySheetPageA varptr(constPropSheetPagePointer)   ; 戻り値は stat
; constPropSheetPagePointer : PROPSHEETPAGEA* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "COMCTL32.dll"
#cfunc global CreatePropertySheetPageA "CreatePropertySheetPageA" var
; res = CreatePropertySheetPageA(constPropSheetPagePointer)
; constPropSheetPagePointer : PROPSHEETPAGEA* in/out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; HPROPSHEETPAGE CreatePropertySheetPageA(PROPSHEETPAGEA* constPropSheetPagePointer)
#uselib "COMCTL32.dll"
#cfunc global CreatePropertySheetPageA "CreatePropertySheetPageA" var
; res = CreatePropertySheetPageA(constPropSheetPagePointer)
; constPropSheetPagePointer : PROPSHEETPAGEA* in/out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	comctl32 = windows.NewLazySystemDLL("COMCTL32.dll")
	procCreatePropertySheetPageA = comctl32.NewProc("CreatePropertySheetPageA")
)

// constPropSheetPagePointer (PROPSHEETPAGEA* in/out)
r1, _, err := procCreatePropertySheetPageA.Call(
	uintptr(constPropSheetPagePointer),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // HPROPSHEETPAGE
function CreatePropertySheetPageA(
  constPropSheetPagePointer: Pointer   // PROPSHEETPAGEA* in/out
): THandle; stdcall;
  external 'COMCTL32.dll' name 'CreatePropertySheetPageA';
result := DllCall("COMCTL32\CreatePropertySheetPageA"
    , "Ptr", constPropSheetPagePointer   ; PROPSHEETPAGEA* in/out
    , "Ptr")   ; return: HPROPSHEETPAGE
●CreatePropertySheetPageA(constPropSheetPagePointer) = DLL("COMCTL32.dll", "void* CreatePropertySheetPageA(void*)")
# 呼び出し: CreatePropertySheetPageA(constPropSheetPagePointer)
# constPropSheetPagePointer : PROPSHEETPAGEA* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
const std = @import("std");

extern "comctl32" fn CreatePropertySheetPageA(
    constPropSheetPagePointer: [*c]PROPSHEETPAGEA // PROPSHEETPAGEA* in/out
) callconv(std.os.windows.WINAPI) ?*anyopaque;
proc CreatePropertySheetPageA(
    constPropSheetPagePointer: ptr PROPSHEETPAGEA  # PROPSHEETPAGEA* in/out
): pointer {.importc: "CreatePropertySheetPageA", stdcall, dynlib: "COMCTL32.dll".}
pragma(lib, "comctl32");
extern(Windows)
void* CreatePropertySheetPageA(
    PROPSHEETPAGEA* constPropSheetPagePointer   // PROPSHEETPAGEA* in/out
);
ccall((:CreatePropertySheetPageA, "COMCTL32.dll"), stdcall, Ptr{Cvoid},
      (Ptr{PROPSHEETPAGEA},),
      constPropSheetPagePointer)
# constPropSheetPagePointer : PROPSHEETPAGEA* in/out -> Ptr{PROPSHEETPAGEA}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
void* CreatePropertySheetPageA(
    void* constPropSheetPagePointer);
]]
local comctl32 = ffi.load("comctl32")
-- comctl32.CreatePropertySheetPageA(constPropSheetPagePointer)
-- constPropSheetPagePointer : PROPSHEETPAGEA* in/out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('COMCTL32.dll');
const CreatePropertySheetPageA = lib.func('__stdcall', 'CreatePropertySheetPageA', 'void *', ['void *']);
// CreatePropertySheetPageA(constPropSheetPagePointer)
// constPropSheetPagePointer : PROPSHEETPAGEA* in/out -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("COMCTL32.dll", {
  CreatePropertySheetPageA: { parameters: ["pointer"], result: "pointer" },
});
// lib.symbols.CreatePropertySheetPageA(constPropSheetPagePointer)
// constPropSheetPagePointer : PROPSHEETPAGEA* in/out -> "pointer"
// 文字列は "buffer"。ANSI(-A) は new TextEncoder() で UTF-8/ANSI バイト列(末尾に \x00)を渡す。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
void* CreatePropertySheetPageA(
    void* constPropSheetPagePointer);
C, "COMCTL32.dll");
// $ffi->CreatePropertySheetPageA(constPropSheetPagePointer);
// constPropSheetPagePointer : PROPSHEETPAGEA* 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.ASCII_OPTIONS);
    Pointer CreatePropertySheetPageA(
        Pointer constPropSheetPagePointer   // PROPSHEETPAGEA* in/out
    );
}
@[Link("comctl32")]
lib LibCOMCTL32
  fun CreatePropertySheetPageA = CreatePropertySheetPageA(
    constPropSheetPagePointer : PROPSHEETPAGEA*   # PROPSHEETPAGEA* 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 CreatePropertySheetPageANative = Pointer<Void> Function(Pointer<Void>);
typedef CreatePropertySheetPageADart = Pointer<Void> Function(Pointer<Void>);
final CreatePropertySheetPageA = DynamicLibrary.open('COMCTL32.dll')
    .lookupFunction<CreatePropertySheetPageANative, CreatePropertySheetPageADart>('CreatePropertySheetPageA');
// constPropSheetPagePointer : PROPSHEETPAGEA* in/out -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function CreatePropertySheetPageA(
  constPropSheetPagePointer: Pointer   // PROPSHEETPAGEA* in/out
): THandle; stdcall;
  external 'COMCTL32.dll' name 'CreatePropertySheetPageA';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "CreatePropertySheetPageA"
  c_CreatePropertySheetPageA :: Ptr () -> IO (Ptr ())
-- constPropSheetPagePointer : PROPSHEETPAGEA* in/out -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let createpropertysheetpagea =
  foreign "CreatePropertySheetPageA"
    ((ptr void) @-> returning (ptr void))
(* constPropSheetPagePointer : PROPSHEETPAGEA* 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 ("CreatePropertySheetPageA" create-property-sheet-page-a :convention :stdcall) :pointer
  (const-prop-sheet-page-pointer :pointer))   ; PROPSHEETPAGEA* in/out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $CreatePropertySheetPageA = Win32::API::More->new('COMCTL32',
    'HANDLE CreatePropertySheetPageA(LPVOID constPropSheetPagePointer)');
# my $ret = $CreatePropertySheetPageA->Call($constPropSheetPagePointer);
# constPropSheetPagePointer : PROPSHEETPAGEA* in/out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。

関連項目

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