Question

If I needed to translate to types in the Delphi framework, I would use:

  • For DWORD: the Cardinal type, used to identify the PID of a process. (tagPROCESSENTRY32)
WinAPI DataType | Delphi Translated DataType | Automation Object Compatible DataType

DWORD           | Cardinal                   | ?????
  • For HANDLE, the HWND type, used to map the Handle returned from AllocatedHWND. This will be used latter for Inter Process Communication (IPC)
WinAPI DataType | Delphi Translated DataType | Automation Object Compatible DataType

HANDLE(HWND)    | HWND                       | ?????

However, I need to translate these types to pass them via a COM (type library) interface.

Which are the correct types should I use?

Note: The types needs to be 100% compatible with automation objects.

Was it helpful?

Solution

Choose one from Automation-compatible types.

SYSUINT (ie. VT_UINT, unsigned int) seem to be your best bet for both if the target platform includes both 32-bit and 64-bit architectures. For 32-bit-only, you can choose LongWord (VT_UI4).

If you don't need an automation-compatible COM library you can also choose Pointer for THandle.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top