2010-02-09 39 views
2

基本上我有一个自动进入全屏的形式。但是,当Inet运行时,这不会发生。 Inet完成后,应用程序将全屏显示。VB6:为什么不能全屏的负载,同时Inet电子运行?

 Private Declare Function SetWindowPos Lib "user32" _ 
       (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, _ 
       ByVal x As Long, ByVal Y As Long, ByVal cx As Long, _ 
       ByVal cy As Long, ByVal wFlags As Long) As Long 

     Private Declare Function ShowCursor Lib "user32" _ 
       (ByVal bShow As Long) As Long 

Private Sub Form_Load() 

Dim x As Integer 

Call AlwaysOnTop(Me, True) 

x = ShowCursor(True) 


Dim Download() As Byte 

Download() = Inet1.OpenURL("http://www.site.com/23423/server.txt) 
Open ("server.txt") For Binary Access Write As #1 
Put #1, , DownloadData() 
Close #1 

End Sub 

Sub AlwaysOnTop(FrmID As Form, OnTop As Boolean) 

     Const SWP_NOMOVE = 2 

     Const SWP_NOSIZE = 1 

     Const FLAGS = SWP_NOMOVE Or SWP_NOSIZE 

     Const HWND_TOPMOST = -1 

     Const HWND_NOTOPMOST = -2 



     If OnTop Then 

      OnTop = SetWindowPos(FrmID.hwnd, HWND_TOPMOST, 0, 0, 0, 0, FLAGS) 

     Else 

      OnTop = SetWindowPos(FrmID.hwnd, HWND_TOPMOST, 0, 0, 0, 0, FLAGS) 

     End If 
End Sub 

回答

0
Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, _ 
    ByVal x As Long, ByVal Y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long 

Private Declare Function ShowCursor Lib "user32" (ByVal bShow As Long) As Long 

Private Sub Form_Load() 
    AlwaysOnTop Me, True 
    ShowCursor True 
    DoEvents '' <---- This is what you need. 

    Dim Download() As Byte 
    Dim FileHandle As Long 
    Download() = Inet1.OpenURL("http://www.site.com/23423/server.txt") 
    FileHandle = FreeFile() 
    Open ("server.txt") For Binary Access Write As FileHandle 
    Put FileHandle, , DownloadData() 
    Close FileHandle 
End Sub 

Sub AlwaysOnTop(FrmID As Form, OnTop As Boolean) 
    Const SWP_NOMOVE = 2 
    Const SWP_NOSIZE = 1 
    Const FLAGS = SWP_NOMOVE Or SWP_NOSIZE 
    Const HWND_TOPMOST = -1 
    Const HWND_NOTOPMOST = -2 
    SetWindowPos FrmID.hwnd, Iif(OnTop, HWND_TOPMOST, HWND_NOTOPMOST), 0, 0, 0, 0, FLAGS 
End Sub 
1

它不是专门关于的Inet - 只有当在Form_Load方法完成形式重绘 - VB6有时间做自己的东西,并更新用户界面。

你可以尝试的DoEvents就像这个例子,我想它应该帮助: http://www.daniweb.com/forums/thread65362.html

相关问题