VB窗口挂起

来源:百度知道 编辑:UC知道 时间:2024/06/25 15:37:52
如何使我用VB生成的EXE程序的窗口挂起,即不能在桌面其他地方单击一下就自动被小化到任务栏?

加一个timer1控件设置interval(越小间隔越少建议设为1)
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'使用api
Private Sub Timer1_Timer()
SetWindowPos Me.hwnd, -1, 0, 0, 0, 0, 3'设置到最顶层
End Sub

Private Sub Timer1_Timer()
Me.WindowState = 0
End Sub

窗口总在最前?
Option Explicit
Const Hwndx = -1
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 Sub Form_Load()
Dim XX As Long
XX = SetWindowPos(Me.Hwnd, Hwndx, 0, 0, 0, 0, 3)
End Sub