ホーム › System.DataExchange › DdeCreateStringHandleA
DdeCreateStringHandleA
関数文字列からDDE文字列ハンドルを作成する(ANSI版)。
シグネチャ
// USER32.dll (ANSI / -A)
#include <windows.h>
HSZ DdeCreateStringHandleA(
DWORD idInst,
LPCSTR psz,
INT iCodePage
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| idInst | DWORD | in |
| psz | LPCSTR | in |
| iCodePage | INT | in |
戻り値の型: HSZ
各言語での呼び出し定義
// USER32.dll (ANSI / -A)
#include <windows.h>
HSZ DdeCreateStringHandleA(
DWORD idInst,
LPCSTR psz,
INT iCodePage
);[DllImport("USER32.dll", CharSet = CharSet.Ansi, ExactSpelling = true)]
static extern IntPtr DdeCreateStringHandleA(
uint idInst, // DWORD
[MarshalAs(UnmanagedType.LPStr)] string psz, // LPCSTR
int iCodePage // INT
);<DllImport("USER32.dll", CharSet:=CharSet.Ansi, ExactSpelling:=True)>
Public Shared Function DdeCreateStringHandleA(
idInst As UInteger, ' DWORD
<MarshalAs(UnmanagedType.LPStr)> psz As String, ' LPCSTR
iCodePage As Integer ' INT
) As IntPtr
End Function' idInst : DWORD
' psz : LPCSTR
' iCodePage : INT
Declare PtrSafe Function DdeCreateStringHandleA Lib "user32" ( _
ByVal idInst As Long, _
ByVal psz As String, _
ByVal iCodePage As Long) As LongPtr
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
DdeCreateStringHandleA = ctypes.windll.user32.DdeCreateStringHandleA
DdeCreateStringHandleA.restype = ctypes.c_void_p
DdeCreateStringHandleA.argtypes = [
wintypes.DWORD, # idInst : DWORD
wintypes.LPCSTR, # psz : LPCSTR
ctypes.c_int, # iCodePage : INT
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('USER32.dll')
DdeCreateStringHandleA = Fiddle::Function.new(
lib['DdeCreateStringHandleA'],
[
-Fiddle::TYPE_INT, # idInst : DWORD
Fiddle::TYPE_VOIDP, # psz : LPCSTR
Fiddle::TYPE_INT, # iCodePage : INT
],
Fiddle::TYPE_VOIDP)#[link(name = "user32")]
extern "system" {
fn DdeCreateStringHandleA(
idInst: u32, // DWORD
psz: *const u8, // LPCSTR
iCodePage: i32 // INT
) -> *mut core::ffi::c_void;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("USER32.dll", CharSet = CharSet.Ansi)]
public static extern IntPtr DdeCreateStringHandleA(uint idInst, [MarshalAs(UnmanagedType.LPStr)] string psz, int iCodePage);
"@
$api = Add-Type -MemberDefinition $sig -Name 'USER32_DdeCreateStringHandleA' -Namespace Win32 -PassThru
# $api::DdeCreateStringHandleA(idInst, psz, iCodePage)#uselib "USER32.dll"
#func global DdeCreateStringHandleA "DdeCreateStringHandleA" sptr, sptr, sptr
; DdeCreateStringHandleA idInst, psz, iCodePage ; 戻り値は stat
; idInst : DWORD -> "sptr"
; psz : LPCSTR -> "sptr"
; iCodePage : INT -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "USER32.dll"
#cfunc global DdeCreateStringHandleA "DdeCreateStringHandleA" int, str, int
; res = DdeCreateStringHandleA(idInst, psz, iCodePage)
; idInst : DWORD -> "int"
; psz : LPCSTR -> "str"
; iCodePage : INT -> "int"; HSZ DdeCreateStringHandleA(DWORD idInst, LPCSTR psz, INT iCodePage)
#uselib "USER32.dll"
#cfunc global DdeCreateStringHandleA "DdeCreateStringHandleA" int, str, int
; res = DdeCreateStringHandleA(idInst, psz, iCodePage)
; idInst : DWORD -> "int"
; psz : LPCSTR -> "str"
; iCodePage : INT -> "int"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
user32 = windows.NewLazySystemDLL("USER32.dll")
procDdeCreateStringHandleA = user32.NewProc("DdeCreateStringHandleA")
)
// idInst (DWORD), psz (LPCSTR), iCodePage (INT)
r1, _, err := procDdeCreateStringHandleA.Call(
uintptr(idInst),
uintptr(unsafe.Pointer(windows.BytePtrFromString(psz))),
uintptr(iCodePage),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HSZfunction DdeCreateStringHandleA(
idInst: DWORD; // DWORD
psz: PAnsiChar; // LPCSTR
iCodePage: Integer // INT
): THandle; stdcall;
external 'USER32.dll' name 'DdeCreateStringHandleA';result := DllCall("USER32\DdeCreateStringHandleA"
, "UInt", idInst ; DWORD
, "AStr", psz ; LPCSTR
, "Int", iCodePage ; INT
, "Ptr") ; return: HSZ●DdeCreateStringHandleA(idInst, psz, iCodePage) = DLL("USER32.dll", "void* DdeCreateStringHandleA(dword, char*, int)")
# 呼び出し: DdeCreateStringHandleA(idInst, psz, iCodePage)
# idInst : DWORD -> "dword"
# psz : LPCSTR -> "char*"
# iCodePage : INT -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。