基本上我有一个自动全屏显示的表单。但是当Inet运行时,这不会发生。在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 :(得分:1)
它并不是特别关于Inet - 只有在Form_Load方法完成后才重绘表单 - VB6有时间做自己的东西并更新用户界面。
你可以尝试像这个例子中的DoEvents,我认为它应该有所帮助: http://www.daniweb.com/forums/thread65362.html
答案 1 :(得分: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