一个关于shellexecute很菜的小问题!!(50分)

  • 主题发起人 主题发起人 编程菜菜鸟
  • 开始时间 开始时间

编程菜菜鸟

Unregistered / Unconfirmed
GUEST, unregistred user!
&nbsp;最近小弟在编写一个小程序时,遇到一个关于API的问题,恳请各位大侠能够指点迷津,万分感谢!!![:)]<br>具体情况如下:用shellexecute打开网页时,能否用另一个窗口打开,而不是占用原来的那个窗口。<br>例如,如何实现用shellexecute(handle,nil,pchar('http://www.sohoo.com'),nil,nil,sw_shownormal);<br>打开的搜狐不占用原来已打开的网页,而是新开一个窗口。。
 
当然可以了!<br>--------------<br>uses<br>&nbsp; &nbsp;Windows, OLEAuto;<br>procedure OpenInternetExplorer(sURL : string);//sURL参数为你要浏览的网址<br>&nbsp;const<br>&nbsp; &nbsp;csOLEObjName = 'InternetExplorer.Application';<br>&nbsp;var<br>&nbsp; &nbsp;IE : Variant;<br>&nbsp; &nbsp;WinHandle : HWnd;<br>&nbsp;begin<br>&nbsp; &nbsp;if VarIsEmpty(IE) then<br>&nbsp; &nbsp;begin<br>&nbsp; &nbsp; &nbsp;IE := CreateOleObject(csOLEObjName);<br>&nbsp; &nbsp; &nbsp;IE.Visible := true;<br>&nbsp; &nbsp; &nbsp;IE.Navigate(sURL);<br>&nbsp; &nbsp;end<br>&nbsp; &nbsp;else<br>&nbsp; &nbsp;begin<br>&nbsp; &nbsp; &nbsp;WinHandle := FindWindow('IEFrame', nil);<br>&nbsp; &nbsp; &nbsp;if WinHandle &lt;&gt; 0 then<br>&nbsp; &nbsp; &nbsp;begin<br>&nbsp; &nbsp; &nbsp; &nbsp;IE.Navigate(sURL);<br>&nbsp; &nbsp; &nbsp; &nbsp;SetForegroundWindow(WinHandle);<br>&nbsp; &nbsp; &nbsp;end<br>&nbsp; &nbsp; &nbsp;else<br>&nbsp; &nbsp; &nbsp;begin<br>&nbsp; &nbsp; &nbsp; &nbsp;// handle error ...<br>&nbsp; &nbsp; &nbsp;end;<br>&nbsp; &nbsp;end;<br>&nbsp;end;
 
快给分吧[8D] 就是他了[^]
 
能否只用shellexecute函数解决该问题?[?]
 
用这种方法试试<br>ShellExecute(handle,'open','iexplore.exe','http://www.sohoo.com',nil,SW_MAXIMIZE);
 
[:)]谢谢zhangkan、小人物的帮助!!!我更喜欢zhangkan的答案(因为其比较简单、易懂)。[:D]
 
后退
顶部