[英]JNA CreatePseudoConsole declaration
What is correct JNA declaration of CreatePseudoConsole
function? 什么是CreatePseudoConsole
函数的正确JNA声明?
Windows API declaration is following: Windows API声明如下:
HRESULT WINAPI CreatePseudoConsole(
_In_ COORD size,
_In_ HANDLE hInput,
_In_ HANDLE hOutput,
_In_ DWORD dwFlags,
_Out_ HPCON* phPC
);
HRESULT is a 32-bit integer , so your function declaration would be int CreatePseudoConsole()
. HRESULT是一个32位整数 ,因此您的函数声明应为int CreatePseudoConsole()
。
As for the arguments, you can extend Structure
to create your own COORD structure, mapping the two Windows SHORT s to Java's 16-bit integer short
. 至于参数,您可以扩展Structure
来创建自己的COORD结构,将两个Windows SHORT映射到Java的16位整数short
。
JNA already has a mapping for WinNT.HANDLE
, so just use that. JNA已经具有WinNT.HANDLE
的映射,因此只需使用它即可。 You can optionally use JNA's DWORD
mapping, but most of the time I just map those directly to an int
. 您可以选择使用JNA的DWORD
映射,但是大多数时候我只是将它们直接映射到int
。
So the only thing left is the pointer to HPCON
, which is not directly mapped. 因此,剩下的唯一内容就是指向HPCON
的指针,该指针未直接映射。 The docs describe this as a pointer to a HANDLE
. 文档将其描述为指向HANDLE
的指针。 You can use HANDLEByReference
here, or extend that to your own more narrowly typed class. 您可以在此处使用HANDLEByReference
,或将其扩展到您自己的更窄类型的类。 This mapping of HGLRCByReference is a good example to use if you want to create an HPCONByReference. 如果要创建HPCONByReference ,HGLRCByReference的此映射是一个很好的示例。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.