L
lostlove2005
Unregistered / Unconfirmed
GUEST, unregistred user!
.....................<br>//函数CreateProcess()中的si参数设置<br> si.cb := sizeof(si);<br> si.cbReserved2 := 0;<br> si.lpReserved2 := nil;<br> si.lpReserved := nil;<br> si.lpDesktop := nil;<br> si.lpTitle := PChar('childprocess');<br> si.dwX := 100;<br> si.dwY := 100;<br> si.dwXSize := 300;<br> si.dwYSize := 200;<br> si.dwFlags := STARTF_USESHOWWINDOW;<br> si.wShowWindow := SW_HIDE<br><br> <br>CreateProcess(PChar('security.exe'),nil,nil,nil,TRUE,CREATE_DEFAULT_ERROR_MODE,<br> nil,nil,si,pi);<br> sleep(600);<br><br> hChildWnd := FindWindow(nil, '安全管理子系统-用户登录');<br> showwindow(hChildWnd,SW_HIDE);<br><br>............................<br>1.需求:<br>利用CreateProcess()函数调度security.exe登录程序,并让它隐藏显示,即用户看不到该窗体,但实际上改窗体已被调度,并运行。<br>2.以上用函数showwindow(hChildWnd,SW_HIDE)处理虽然能隐藏该窗体,但还是会有很短暂的显示过程(<1s)<br><br>现在看来只能在CreateProcess()里面设置了,但是在参数里面我加了si.wShowWindow <br>:= SW_HIDE,但还是无法满足。<br><br>咨询高人答案如下:<br>wShowWindow<br>If dwFlags specifies STARTF_USESHOWWINDOW, this member can be any of <br>the SW_ constants defined in Winuser.h. Otherwise, this member is <br>ignored.<br>For GUI processes, wShowWindow specifies the default value the first <br>time ShowWindow is called. The nCmdShow parameter of ShowWindow is <br>ignored. In subsequent calls to ShowWindow, the wShowWindow member is used if <br>the nCmdShow parameter of ShowWindow is set to SW_SHOWDEFAULT<br>所以这个参数只是在child第一次调用ShowWindow函数时才起作用,如果child再次调用ShowWindow函数,而且参数不是SW_SHOWDEFAULT,则窗口还是会显示出来。<br><br>注: 没有security.exe 程序代码,所以无法在子程序里面实现Hide。