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

SetWindowContextHelpId

関数
ウィンドウにコンテキストヘルプIDを設定する。
DLLUSER32.dll呼出規約winapiSetLastErrorあり対応OSWindows XP 以降

シグネチャ

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

BOOL SetWindowContextHelpId(
    HWND param0,
    DWORD param1
);

パラメーター

名前方向
param0HWNDin
param1DWORDin

戻り値の型: BOOL

各言語での呼び出し定義

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

BOOL SetWindowContextHelpId(
    HWND param0,
    DWORD param1
);
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("USER32.dll", SetLastError = true, ExactSpelling = true)]
static extern bool SetWindowContextHelpId(
    IntPtr param0,   // HWND
    uint param1   // DWORD
);
<DllImport("USER32.dll", SetLastError:=True, ExactSpelling:=True)>
Public Shared Function SetWindowContextHelpId(
    param0 As IntPtr,   ' HWND
    param1 As UInteger   ' DWORD
) As Boolean
End Function
' param0 : HWND
' param1 : DWORD
Declare PtrSafe Function SetWindowContextHelpId Lib "user32" ( _
    ByVal param0 As LongPtr, _
    ByVal param1 As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

SetWindowContextHelpId = ctypes.windll.user32.SetWindowContextHelpId
SetWindowContextHelpId.restype = wintypes.BOOL
SetWindowContextHelpId.argtypes = [
    wintypes.HANDLE,  # param0 : HWND
    wintypes.DWORD,  # param1 : DWORD
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('USER32.dll')
SetWindowContextHelpId = Fiddle::Function.new(
  lib['SetWindowContextHelpId'],
  [
    Fiddle::TYPE_VOIDP,  # param0 : HWND
    -Fiddle::TYPE_INT,  # param1 : DWORD
  ],
  Fiddle::TYPE_INT)
#[link(name = "user32")]
extern "system" {
    fn SetWindowContextHelpId(
        param0: *mut core::ffi::c_void,  // HWND
        param1: u32  // DWORD
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("USER32.dll", SetLastError = true)]
public static extern bool SetWindowContextHelpId(IntPtr param0, uint param1);
"@
$api = Add-Type -MemberDefinition $sig -Name 'USER32_SetWindowContextHelpId' -Namespace Win32 -PassThru
# $api::SetWindowContextHelpId(param0, param1)
#uselib "USER32.dll"
#func global SetWindowContextHelpId "SetWindowContextHelpId" sptr, sptr
; SetWindowContextHelpId param0, param1   ; 戻り値は stat
; param0 : HWND -> "sptr"
; param1 : DWORD -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "USER32.dll"
#cfunc global SetWindowContextHelpId "SetWindowContextHelpId" sptr, int
; res = SetWindowContextHelpId(param0, param1)
; param0 : HWND -> "sptr"
; param1 : DWORD -> "int"
; BOOL SetWindowContextHelpId(HWND param0, DWORD param1)
#uselib "USER32.dll"
#cfunc global SetWindowContextHelpId "SetWindowContextHelpId" intptr, int
; res = SetWindowContextHelpId(param0, param1)
; param0 : HWND -> "intptr"
; param1 : DWORD -> "int"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	user32 = windows.NewLazySystemDLL("USER32.dll")
	procSetWindowContextHelpId = user32.NewProc("SetWindowContextHelpId")
)

// param0 (HWND), param1 (DWORD)
r1, _, err := procSetWindowContextHelpId.Call(
	uintptr(param0),
	uintptr(param1),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // BOOL
function SetWindowContextHelpId(
  param0: THandle;   // HWND
  param1: DWORD   // DWORD
): BOOL; stdcall;
  external 'USER32.dll' name 'SetWindowContextHelpId';
result := DllCall("USER32\SetWindowContextHelpId"
    , "Ptr", param0   ; HWND
    , "UInt", param1   ; DWORD
    , "Int")   ; return: BOOL
●SetWindowContextHelpId(param0, param1) = DLL("USER32.dll", "bool SetWindowContextHelpId(void*, dword)")
# 呼び出し: SetWindowContextHelpId(param0, param1)
# param0 : HWND -> "void*"
# param1 : DWORD -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。