Click here to Skip to main content
15,881,938 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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
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
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
C++
unsigned int
. How to resolve this issue?
Posted
Updated 20-Jan-18 7:01am
v2

1 solution

Use the biggest native data type, so some native 64-bit data as
C++
long long
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!!!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900