我正在使用JNA来使用user32.dll和kernel32.dll。如果我指定title
的过程,我有示例代码可以给我的句柄。我可以通过可执行文件名得到处理过程吗?
hWnd = User32.FindWindowA(null, "Call of Duty®: Modern Warfare® 3 Multiplayer");
我真的不想搜索Title
的进程句柄。有没有任何方法需要exe名字?像这样:
hWnd = User32.FindWindowByExecutable ("iw5mp.exe");
因此,如果该进程没有运行,它将返回0否则句柄。
另外,当使用JNA时,eclipse显然不能自动提示User32或Kernel32 dll中存在的方法。那么,你在这种情况下做了什么。只是谷歌可能的方法?
可能相关:http://stackoverflow.com/questions/2719756/find-window-with-specific-text-for-a-process – assylias 2012-04-08 11:22:35
@assylias:我不认为java中没有像'Process.GetProcesses'这样的东西。 – 2012-04-08 11:24:03
接受的答案建议枚举使用user32的进程。这可能是你可以使用的东西。 – assylias 2012-04-08 12:49:14