Win32 API 日本語リファレンス
ホームDevices.Display › STROBJ_dwGetCodePage

STROBJ_dwGetCodePage

関数
文字列オブジェクトのコードページを取得する。
DLLGDI32.dll呼出規約winapi対応OSWindows 2000 以降

シグネチャ

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

DWORD STROBJ_dwGetCodePage(
    STROBJ* pstro
);

パラメーター

名前方向
pstroSTROBJ*inout

戻り値の型: DWORD

各言語での呼び出し定義

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

DWORD STROBJ_dwGetCodePage(
    STROBJ* pstro
);
[DllImport("GDI32.dll", ExactSpelling = true)]
static extern uint STROBJ_dwGetCodePage(
    IntPtr pstro   // STROBJ* in/out
);
<DllImport("GDI32.dll", ExactSpelling:=True)>
Public Shared Function STROBJ_dwGetCodePage(
    pstro As IntPtr   ' STROBJ* in/out
) As UInteger
End Function
' pstro : STROBJ* in/out
Declare PtrSafe Function STROBJ_dwGetCodePage Lib "gdi32" ( _
    ByVal pstro As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

STROBJ_dwGetCodePage = ctypes.windll.gdi32.STROBJ_dwGetCodePage
STROBJ_dwGetCodePage.restype = wintypes.DWORD
STROBJ_dwGetCodePage.argtypes = [
    ctypes.c_void_p,  # pstro : STROBJ* in/out
]
require 'fiddle'
require 'fiddle/import'

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

var (
	gdi32 = windows.NewLazySystemDLL("GDI32.dll")
	procSTROBJ_dwGetCodePage = gdi32.NewProc("STROBJ_dwGetCodePage")
)

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