GetProcessHandleFromHwnd

GetProcessHandleFromHwnd

本文介绍了如何在Delphi 7中调用GetProcessHandleFromHwnd?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在Delphi 7中调用GetProcessHandleFromHwnd?

How can I call GetProcessHandleFromHwnd in Delphi 7?

显然这是XP引入的Windows API函数。

Apparently it is an XP-introduced Windows API function.

推荐答案

不可能直接调用该函数。但是您可以进行引用:

It's not possible to call the function directly. But you can make a reference:

// reference to the Windows function:
function GetProcessHandleFromHwnd(hwnd: HWND): THandle; external 'oleacc.dll' name 'GetProcessHandleFromHwnd'; stdcall;

// and you can call it from your own function:
function TryGetProcessHandle(const WindowHandle: THandle; var ProcessHandle: THandle): Boolean;
begin
  ProcessHandle := GetProcessHandleFromHwnd(WindowHandle);
  Result := (ProcessHandle <> 0);
end;

这篇关于如何在Delphi 7中调用GetProcessHandleFromHwnd?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-19 00:36