Win32 API 日本語リファレンス
ホームGlobalization › MIMECSETINFO

MIMECSETINFO

構造体
サイズx64: 108 バイト / x86: 108 バイト

サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。

フィールド

フィールドサイズx64x86説明
uiCodePageDWORD4+0+0コードページ番号。
uiInternetEncodingDWORD4+4+4インターネット送信に適したエンコーディングのコードページ番号。
wszCharsetWCHAR100+8+8文字セット名文字列(Unicode)。

各言語での定義

#include <windows.h>

// MIMECSETINFO  (x64 108 / x86 108 バイト)
typedef struct MIMECSETINFO {
    DWORD uiCodePage;
    DWORD uiInternetEncoding;
    WCHAR wszCharset[50];
} MIMECSETINFO;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct MIMECSETINFO
{
    public uint uiCodePage;
    public uint uiInternetEncoding;
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 50)] public string wszCharset;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure MIMECSETINFO
    Public uiCodePage As UInteger
    Public uiInternetEncoding As UInteger
    <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=50)> Public wszCharset As String
End Structure
import ctypes
from ctypes import wintypes

class MIMECSETINFO(ctypes.Structure):
    _fields_ = [
        ("uiCodePage", wintypes.DWORD),
        ("uiInternetEncoding", wintypes.DWORD),
        ("wszCharset", ctypes.c_wchar * 50),
    ]
#[repr(C)]
pub struct MIMECSETINFO {
    pub uiCodePage: u32,
    pub uiInternetEncoding: u32,
    pub wszCharset: [u16; 50],
}
import "golang.org/x/sys/windows"

type MIMECSETINFO struct {
	uiCodePage uint32
	uiInternetEncoding uint32
	wszCharset [50]uint16
}
type
  MIMECSETINFO = record
    uiCodePage: DWORD;
    uiInternetEncoding: DWORD;
    wszCharset: array[0..49] of WideChar;
  end;
const MIMECSETINFO = extern struct {
    uiCodePage: u32,
    uiInternetEncoding: u32,
    wszCharset: [50]u16,
};
type
  MIMECSETINFO {.bycopy.} = object
    uiCodePage: uint32
    uiInternetEncoding: uint32
    wszCharset: array[50, uint16]
struct MIMECSETINFO
{
    uint uiCodePage;
    uint uiInternetEncoding;
    wchar[50] wszCharset;
}

HSP用 定義

HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; MIMECSETINFO サイズ: 108 バイト(x64)
dim st, 27    ; 4byte整数×27(構造体サイズ 108 / 4 切り上げ)
; uiCodePage : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; uiInternetEncoding : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; wszCharset : WCHAR (+8, 100byte)  varptr(st)+8 を基点に操作(100byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global MIMECSETINFO
    #field int uiCodePage
    #field int uiInternetEncoding
    #field wchar wszCharset 50
#endstruct

stdim st, MIMECSETINFO        ; NSTRUCT 変数を確保
st->uiCodePage = 100
mes "uiCodePage=" + st->uiCodePage