takeiteasy 发表于 2011-4-1 15:14:27

Delphi里用Findwindow之类的需不需要写声明啊?

在VB里使用到Findwindow,就得声明 Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long

使用GetWindowThreadProcessId,就得声明 Public Declare Function GetWindowThreadProcessId Lib "user32" (ByVal hwnd As Long, lpdwProcessId As Long) As Long

那么在Delphi里使用这些的时候,需要先进行声明吗?或者需要加载些什么?

莪照视频上写出来的一模一样的代码,却怎么也读不出正确的数值,游戏不开,程序还照样能运行。

很郁闷,不知道哪儿出了错。

程序的内容在本版的不远的地方。望高手解答

gaofeng 发表于 2011-4-1 15:14:37

已经包含在windows单元里了

tony_sun76421 发表于 2011-4-1 15:14:47

...........
gthwnd:=findwindow(nil,'Name');
if gthwnd<>0 then
GetWindowThreadProcessId(gthwnd,pid);
hws:=OpenProcess(PROCESS_ALL_ACCESS, False,pid);
................
页: [1]
查看完整版本: Delphi里用Findwindow之类的需不需要写声明啊?