Win32 API 日本語リファレンス
ホームData.HtmlHelp › HtmlHelpA

HtmlHelpA

関数
HTMLヘルプを表示・制御する(ANSI版)。
DLLhhctrl.ocx文字セットANSI (-A)呼出規約winapi

シグネチャ

// hhctrl.ocx  (ANSI / -A)
#include <windows.h>

HWND HtmlHelpA(
    HWND hwndCaller,   // optional
    LPCSTR pszFile,
    DWORD uCommand,
    UINT_PTR dwData
);

パラメーター

名前方向説明
hwndCallerHWNDinoptionalヘルプを要求する呼び出し元ウィンドウのハンドル。通知の送信先となる。NULL可。
pszFileLPCSTRin対象のCHMヘルプファイルパスまたはウィンドウ種別を示すANSI文字列。コマンドにより意味が変わる。
uCommandDWORDin実行するヘルプ操作を示すコマンド値。HH_DISPLAY_TOPIC等を指定する。
dwDataUINT_PTRinコマンド固有の追加データ。ポインタや整数値としてコマンドに応じ解釈される。

戻り値の型: HWND

各言語での呼び出し定義

// hhctrl.ocx  (ANSI / -A)
#include <windows.h>

HWND HtmlHelpA(
    HWND hwndCaller,   // optional
    LPCSTR pszFile,
    DWORD uCommand,
    UINT_PTR dwData
);
[DllImport("hhctrl.ocx", CharSet = CharSet.Ansi, ExactSpelling = true)]
static extern IntPtr HtmlHelpA(
    IntPtr hwndCaller,   // HWND optional
    [MarshalAs(UnmanagedType.LPStr)] string pszFile,   // LPCSTR
    uint uCommand,   // DWORD
    UIntPtr dwData   // UINT_PTR
);
<DllImport("hhctrl.ocx", CharSet:=CharSet.Ansi, ExactSpelling:=True)>
Public Shared Function HtmlHelpA(
    hwndCaller As IntPtr,   ' HWND optional
    <MarshalAs(UnmanagedType.LPStr)> pszFile As String,   ' LPCSTR
    uCommand As UInteger,   ' DWORD
    dwData As UIntPtr   ' UINT_PTR
) As IntPtr
End Function
' hwndCaller : HWND optional
' pszFile : LPCSTR
' uCommand : DWORD
' dwData : UINT_PTR
Declare PtrSafe Function HtmlHelpA Lib "hhctrl.ocx" ( _
    ByVal hwndCaller As LongPtr, _
    ByVal pszFile As String, _
    ByVal uCommand As Long, _
    ByVal dwData As LongPtr) As LongPtr
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

HtmlHelpA = ctypes.windll.LoadLibrary("hhctrl.ocx").HtmlHelpA
HtmlHelpA.restype = ctypes.c_void_p
HtmlHelpA.argtypes = [
    wintypes.HANDLE,  # hwndCaller : HWND optional
    wintypes.LPCSTR,  # pszFile : LPCSTR
    wintypes.DWORD,  # uCommand : DWORD
    ctypes.c_size_t,  # dwData : UINT_PTR
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('hhctrl.ocx')
HtmlHelpA = Fiddle::Function.new(
  lib['HtmlHelpA'],
  [
    Fiddle::TYPE_VOIDP,  # hwndCaller : HWND optional
    Fiddle::TYPE_VOIDP,  # pszFile : LPCSTR
    -Fiddle::TYPE_INT,  # uCommand : DWORD
    Fiddle::TYPE_UINTPTR_T,  # dwData : UINT_PTR
  ],
  Fiddle::TYPE_VOIDP)
#[link(name = "hhctrl.ocx")]
extern "system" {
    fn HtmlHelpA(
        hwndCaller: *mut core::ffi::c_void,  // HWND optional
        pszFile: *const u8,  // LPCSTR
        uCommand: u32,  // DWORD
        dwData: usize  // UINT_PTR
    ) -> *mut core::ffi::c_void;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("hhctrl.ocx", CharSet = CharSet.Ansi)]
public static extern IntPtr HtmlHelpA(IntPtr hwndCaller, [MarshalAs(UnmanagedType.LPStr)] string pszFile, uint uCommand, UIntPtr dwData);
"@
$api = Add-Type -MemberDefinition $sig -Name 'hhctrl.ocx_HtmlHelpA' -Namespace Win32 -PassThru
# $api::HtmlHelpA(hwndCaller, pszFile, uCommand, dwData)
#uselib "hhctrl.ocx"
#func global HtmlHelpA "HtmlHelpA" sptr, sptr, sptr, sptr
; HtmlHelpA hwndCaller, pszFile, uCommand, dwData   ; 戻り値は stat
; hwndCaller : HWND optional -> "sptr"
; pszFile : LPCSTR -> "sptr"
; uCommand : DWORD -> "sptr"
; dwData : UINT_PTR -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "hhctrl.ocx"
#cfunc global HtmlHelpA "HtmlHelpA" sptr, str, int, sptr
; res = HtmlHelpA(hwndCaller, pszFile, uCommand, dwData)
; hwndCaller : HWND optional -> "sptr"
; pszFile : LPCSTR -> "str"
; uCommand : DWORD -> "int"
; dwData : UINT_PTR -> "sptr"
; HWND HtmlHelpA(HWND hwndCaller, LPCSTR pszFile, DWORD uCommand, UINT_PTR dwData)
#uselib "hhctrl.ocx"
#cfunc global HtmlHelpA "HtmlHelpA" intptr, str, int, intptr
; res = HtmlHelpA(hwndCaller, pszFile, uCommand, dwData)
; hwndCaller : HWND optional -> "intptr"
; pszFile : LPCSTR -> "str"
; uCommand : DWORD -> "int"
; dwData : UINT_PTR -> "intptr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	hhctrl_ocx = windows.NewLazySystemDLL("hhctrl.ocx")
	procHtmlHelpA = hhctrl_ocx.NewProc("HtmlHelpA")
)

// hwndCaller (HWND optional), pszFile (LPCSTR), uCommand (DWORD), dwData (UINT_PTR)
r1, _, err := procHtmlHelpA.Call(
	uintptr(hwndCaller),
	uintptr(unsafe.Pointer(windows.BytePtrFromString(pszFile))),
	uintptr(uCommand),
	uintptr(dwData),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // HWND
function HtmlHelpA(
  hwndCaller: THandle;   // HWND optional
  pszFile: PAnsiChar;   // LPCSTR
  uCommand: DWORD;   // DWORD
  dwData: NativeUInt   // UINT_PTR
): THandle; stdcall;
  external 'hhctrl.ocx' name 'HtmlHelpA';
result := DllCall("hhctrl.ocx\HtmlHelpA"
    , "Ptr", hwndCaller   ; HWND optional
    , "AStr", pszFile   ; LPCSTR
    , "UInt", uCommand   ; DWORD
    , "UPtr", dwData   ; UINT_PTR
    , "Ptr")   ; return: HWND
●HtmlHelpA(hwndCaller, pszFile, uCommand, dwData) = DLL("hhctrl.ocx", "void* HtmlHelpA(void*, char*, dword, int)")
# 呼び出し: HtmlHelpA(hwndCaller, pszFile, uCommand, dwData)
# hwndCaller : HWND optional -> "void*"
# pszFile : LPCSTR -> "char*"
# uCommand : DWORD -> "dword"
# dwData : UINT_PTR -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
const std = @import("std");

extern "hhctrl.ocx" fn HtmlHelpA(
    hwndCaller: ?*anyopaque, // HWND optional
    pszFile: [*c]const u8, // LPCSTR
    uCommand: u32, // DWORD
    dwData: usize // UINT_PTR
) callconv(std.os.windows.WINAPI) ?*anyopaque;
proc HtmlHelpA(
    hwndCaller: pointer,  # HWND optional
    pszFile: cstring,  # LPCSTR
    uCommand: uint32,  # DWORD
    dwData: uint  # UINT_PTR
): pointer {.importc: "HtmlHelpA", stdcall, dynlib: "hhctrl.ocx".}
pragma(lib, "hhctrl.ocx");
extern(Windows)
void* HtmlHelpA(
    void* hwndCaller,   // HWND optional
    const(char)* pszFile,   // LPCSTR
    uint uCommand,   // DWORD
    size_t dwData   // UINT_PTR
);
ccall((:HtmlHelpA, "hhctrl.ocx"), stdcall, Ptr{Cvoid},
      (Ptr{Cvoid}, Cstring, UInt32, Csize_t),
      hwndCaller, pszFile, uCommand, dwData)
# hwndCaller : HWND optional -> Ptr{Cvoid}
# pszFile : LPCSTR -> Cstring
# uCommand : DWORD -> UInt32
# dwData : UINT_PTR -> Csize_t
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
void* HtmlHelpA(
    void* hwndCaller,
    const char* pszFile,
    uint32_t uCommand,
    uintptr_t dwData);
]]
local hhctrl.ocx = ffi.load("hhctrl.ocx")
-- hhctrl.ocx.HtmlHelpA(hwndCaller, pszFile, uCommand, dwData)
-- hwndCaller : HWND optional
-- pszFile : LPCSTR
-- uCommand : DWORD
-- dwData : UINT_PTR
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('hhctrl.ocx');
const HtmlHelpA = lib.func('__stdcall', 'HtmlHelpA', 'void *', ['void *', 'str', 'uint32_t', 'uintptr_t']);
// HtmlHelpA(hwndCaller, pszFile, uCommand, dwData)
// hwndCaller : HWND optional -> 'void *'
// pszFile : LPCSTR -> 'str'
// uCommand : DWORD -> 'uint32_t'
// dwData : UINT_PTR -> 'uintptr_t'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("hhctrl.ocx", {
  HtmlHelpA: { parameters: ["pointer", "buffer", "u32", "usize"], result: "pointer" },
});
// lib.symbols.HtmlHelpA(hwndCaller, pszFile, uCommand, dwData)
// hwndCaller : HWND optional -> "pointer"
// pszFile : LPCSTR -> "buffer"
// uCommand : DWORD -> "u32"
// dwData : UINT_PTR -> "usize"
// 文字列は "buffer"。ANSI(-A) は new TextEncoder() で UTF-8/ANSI バイト列(末尾に \x00)を渡す。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
void* HtmlHelpA(
    void* hwndCaller,
    const char* pszFile,
    uint32_t uCommand,
    size_t dwData);
C, "hhctrl.ocx");
// $ffi->HtmlHelpA(hwndCaller, pszFile, uCommand, dwData);
// hwndCaller : HWND optional
// pszFile : LPCSTR
// uCommand : DWORD
// dwData : UINT_PTR
// 構造体/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 Hhctrl.ocx extends StdCallLibrary {
    Hhctrl.ocx INSTANCE = Native.load("hhctrl.ocx", Hhctrl.ocx.class, W32APIOptions.ASCII_OPTIONS);
    Pointer HtmlHelpA(
        Pointer hwndCaller,   // HWND optional
        String pszFile,   // LPCSTR
        int uCommand,   // DWORD
        long dwData   // UINT_PTR
    );
}
@[Link("hhctrl.ocx")]
lib Libhhctrl.ocx
  fun HtmlHelpA = HtmlHelpA(
    hwndCaller : Void*,   # HWND optional
    pszFile : UInt8*,   # LPCSTR
    uCommand : UInt32,   # DWORD
    dwData : LibC::SizeT   # UINT_PTR
  ) : Void*
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef HtmlHelpANative = Pointer<Void> Function(Pointer<Void>, Pointer<Utf8>, Uint32, UintPtr);
typedef HtmlHelpADart = Pointer<Void> Function(Pointer<Void>, Pointer<Utf8>, int, int);
final HtmlHelpA = DynamicLibrary.open('hhctrl.ocx')
    .lookupFunction<HtmlHelpANative, HtmlHelpADart>('HtmlHelpA');
// hwndCaller : HWND optional -> Pointer<Void>
// pszFile : LPCSTR -> Pointer<Utf8>
// uCommand : DWORD -> Uint32
// dwData : UINT_PTR -> UintPtr
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function HtmlHelpA(
  hwndCaller: THandle;   // HWND optional
  pszFile: PAnsiChar;   // LPCSTR
  uCommand: DWORD;   // DWORD
  dwData: NativeUInt   // UINT_PTR
): THandle; stdcall;
  external 'hhctrl.ocx' name 'HtmlHelpA';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "HtmlHelpA"
  c_HtmlHelpA :: Ptr () -> CString -> Word32 -> CUIntPtr -> IO (Ptr ())
-- hwndCaller : HWND optional -> Ptr ()
-- pszFile : LPCSTR -> CString
-- uCommand : DWORD -> Word32
-- dwData : UINT_PTR -> CUIntPtr
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let htmlhelpa =
  foreign "HtmlHelpA"
    ((ptr void) @-> string @-> uint32_t @-> size_t @-> returning (ptr void))
(* hwndCaller : HWND optional -> (ptr void) *)
(* pszFile : LPCSTR -> string *)
(* uCommand : DWORD -> uint32_t *)
(* dwData : UINT_PTR -> size_t *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library hhctrl.ocx (t "hhctrl.ocx"))
(cffi:use-foreign-library hhctrl.ocx)

(cffi:defcfun ("HtmlHelpA" html-help-a :convention :stdcall) :pointer
  (hwnd-caller :pointer)   ; HWND optional
  (psz-file :string)   ; LPCSTR
  (u-command :uint32)   ; DWORD
  (dw-data :uint64))   ; UINT_PTR
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $HtmlHelpA = Win32::API::More->new('hhctrl.ocx',
    'HANDLE HtmlHelpA(HANDLE hwndCaller, LPCSTR pszFile, DWORD uCommand, WPARAM dwData)');
# my $ret = $HtmlHelpA->Call($hwndCaller, $pszFile, $uCommand, $dwData);
# hwndCaller : HWND optional -> HANDLE
# pszFile : LPCSTR -> LPCSTR
# uCommand : DWORD -> DWORD
# dwData : UINT_PTR -> WPARAM
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。

関連項目

文字セット違い