![]()  | 
		
			
  | 	
	
	
		
		|||||||
| 論壇說明 | 
| 
				歡迎您來到『史萊姆論壇』  ^___^ 您目前正以訪客的身份瀏覽本論壇,訪客所擁有的權限將受到限制,您可以瀏覽本論壇大部份的版區與文章,但您將無法參與任何討論或是使用私人訊息與其他會員交流。若您希望擁有完整的使用權限,請註冊成為我們的一份子,註冊的程序十分簡單、快速,而且最重要的是--註冊是完全免費的! 請點擊這裡:『註冊成為我們的一份子!』  | 
		
     
![]()  | 
    
    
| 
         | 
    主題工具 | 顯示模式 | 
| 
			
			 | 
		#1 | 
| 
			
			 註冊會員 
			
			
			
			
			
			
			 | 
	
	
	
		
		
			
			 請問各位: 如何用vb的語法呼叫Internet Explorer至前景出現,當Internet Explorer未被呼叫出來的時候(不管按幾次就是只能執行1次),謝謝! ![]()  | 
| 
		 | 
	
	
	
		
	
	 
		送花文章: 2,
		
			
		 
	
 
	
		
	
				 
		
		
		
		
		
		
			
		
		
		
		
		
			
					
			
		
		
		
		
		
			
				
			
		
		
		
	 | 
| 
			
			 | 
		#2 (permalink) | 
| 
			
			 管理版主 
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()  | 
	
	
	
		
		
			
			 IE 視窗上的標題列是 *** - Microsoft Internet Explorer 
		
		
		
		
			所以只要搜一次系統內的視窗是否已有 這種標題出現 且是 顯性視窗 來決定是否 呼叫Internet Explorer 至於如何呼叫其它應用程式 可以使用 Shell "C:\Program Files\Internet Explorer\iexplore.exe " & strURL, VbNormalFocus strURL 是網址或欲下載的地址 語法: 
	Sub FindWindowsText()
dim hCurrentWindow as Long
Dim buff As String * 255
Dim CaptionIs As String, strText As String, strURL As String
    CaptionIs = " - Microsoft Internet Explorer"
    hCurrentWindow = GetWindow(Me.hwnd, GW_HWNDFIRST)
    Do While hCurrentWindow <> 0
        If ((GetWindowText(hCurrentWindow, buff, 255) > 0) And IsWindowVisible(hCurrentWindow)) Then
            strText = Left(buff, InStr(buff, Chr$(0)) - 1)
            If InStr(1, strText, CaptionIs, vbTextCompare) > 0 Then Exit Sub
        End If
        hCurrentWindow = GetWindow(hCurrentWindow, GW_HWNDNEXT)
    Loop
    
    'VbNormalFocus 是 視窗具有駐點,且會還原到它原來的大小和位置。
    Shell "C:\Program Files\Internet Explorer\iexplore.exe " & strURL, VbNormalFocus
End Sub
語法: 
	Global Const GW_HWNDFIRST = 0 '從最上層的視窗開始找
'得到視窗 執掌ID
Public Declare Function GetWindow Lib "user32" ( _
    ByVal hwnd As Long, _
    ByVal wCmd As Long) As Long
'得到視窗標題列文字 至lpString
Public Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" ( _
    ByVal hwnd As Long, _
    ByVal lpString As String, _
    ByVal cch As Long) As Long
'判斷此視窗是否為可視狀態
Public Declare Function IsWindowVisible Lib "user32" (ByVal hwnd As Long) As Long
此帖於 2007-05-28 02:55 PM 被 mini 編輯. 原因: 修正一處  | 
| 
		 | 
	
	
	
		
	
	 
		送花文章: 2058,
		
			
		 
	
 
	
		
	
				 
		
		
		
		
		
		
			
		
		
		
		
		
		
		
		
		
			
				
						
				
			
		
		
		
	 | 
| 
向 mini 送花的會員:
 |