什么是IDL文件中使用的HANDLE的等价物。 [英] What is an equivalent of HANDLE to be used in the IDL files.

查看:75
本文介绍了什么是IDL文件中使用的HANDLE的等价物。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我想将HANDLE传递给该函数。数据类型应该使用什么。



在C ++中,

我可以使用

Hi,
I want to pass a HANDLE to the function. What the data types should be using.

In the C++,
I can use

uintptr_t

这对两者都有用win32和x64。



IDL应该使用哪种数据类型?



什么我试过了:



在IDL中使用

which will work for both win32 and x64.

What data type should be used in the IDL?

What I have tried:

Tried using

unsigned int

数据类型尝试。它适用于win32。



但是对于x64而言,由于HANDLE的大小大于unsigned int,因此它可以正常工作。简而言之,HANDLE无法适应

data type in the IDL. It does work for win32.

But for x64 it doesent work as size of HANDLE is greater than the unsigned int. In short, HANDLE cant just fit into the

unsigned int

。如何解决这个问题?

推荐答案

使用最大的本机数据类型,所以一些原生的64位数据为

Use the biggest native data type, so some native 64-bit data as
long long

应该适合。



句柄是一些由操作系统管理的系统资源,所以要小心使用tem。句柄是 NOT(真的不是)指针。 可以,但永远不要假设它。始终使用系统功能并且从不完成清理(关闭或释放)阅读维基百科更好地理解它。并且不要在不同的过程中使用句柄!!!

should fit.

A handle is some a system resource managed by the operating system, so be careful with tem. A handle is NOT (REALLY NOT) a pointer. It can be, but never assume it. Always use system functions and NEVER ferget the cleanup (close or release) when done Read the article on wikipedia to understand it better. And dont use handles in different processes!!!


这篇关于什么是IDL文件中使用的HANDLE的等价物。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆