API 问题(急!!!)(50分)

  • 主题发起人 主题发起人 wujun
  • 开始时间 开始时间
W

wujun

Unregistered / Unconfirmed
GUEST, unregistred user!
我在DELPHI中用winexec运行一个VC编的可执行文件,我怎样才能<br>获得VC可执行文件的句柄,以及怎样控制他的最大化和怎样在程序<br>中关闭他?
 
use findwindow to find the VC program handle,<br>findwindow('class or null','title or null')<br>sendmessage(handle,wm_close,0,0) to close it<br>sendmessage(handle,wm_minmax???,0,0) to ...<br>
 
to keyes:<br>&nbsp; &nbsp;findwindow中我怎么才知道VC程序的title呢?
 
用spy++或winsight来看呀:-)
 
同意cytown
 
用CreateProcess启动应用程序, 这样可以获得程序的ProcessID和ThreadID,<br>然后用EnumThreadWindow列举主线程的窗口, 如果列出的窗口没有父窗口, <br>就可以肯定是主窗口了.
 
to cytown:<br>&nbsp; &nbsp; 那spy++或winsight具体怎么使用呢?
 
spy++好用一些,执行后,有一个find window选项,选择执行后,用鼠标将<br>那个十字图标拖到你要捕捉的窗口上,然后你就全明白了.
 
用CreateProcess执行<br>BOOL CreateProcess(<br><br>&nbsp; &nbsp; LPCTSTR lpApplicationName, // pointer to name of executable module <br>&nbsp; &nbsp; LPTSTR lpCommandLine, // pointer to command line string<br>&nbsp; &nbsp; LPSECURITY_ATTRIBUTES lpProcessAttributes, // pointer to process security attributes <br>&nbsp; &nbsp; LPSECURITY_ATTRIBUTES lpThreadAttributes, // pointer to thread security attributes <br>&nbsp; &nbsp; BOOL bInheritHandles, // handle inheritance flag <br>&nbsp; &nbsp; DWORD dwCreationFlags, // creation flags <br>&nbsp; &nbsp; LPVOID lpEnvironment, // pointer to new environment block <br>&nbsp; &nbsp; LPCTSTR lpCurrentDirectory, // pointer to current directory name <br>&nbsp; &nbsp; LPSTARTUPINFO lpStartupInfo, // pointer to STARTUPINFO <br>&nbsp; &nbsp; LPPROCESS_INFORMATION lpProcessInformation // pointer to PROCESS_INFORMATION &nbsp;<br>&nbsp; &nbsp;);<br><br>lpProcessInformation-&gt;hProcess为该进程的句柄<br>具体可查delphi或VC的帮助
 
谁有spy++,能给我一份吗?
 
来晚了!!<br>如wrench所说,用CreateProcess()<br>createprocess(nil,'zq010.exe',nil,nil,false,0,nil,nil,info,pinfo)<br>句柄:pinfo.hprocess
 
接受答案了.
 
后退
顶部