www.pudn.com > 通用库存管理系统 vb.rar > ModuleWinTop.bas


Attribute VB_Name = "ModuleWinTop" 
'使窗体始终保持在最前面 
Public 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 
Const HWND_TOPMOST = -1 
Const SWP_NOMOVE = &H2 
Const SWP_NOSIZE = &H1 
Public Function PutWindowOnTop(pFrm As Form) 
  Dim lngWindowPosition As Long 
  lngWindowPosition = SetWindowPos(pFrm.hWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE) 
End Function 
Sub delay(ByVal n As Single) 
    Dim tm1 As Single, tm2 As Single 
    tm1 = Timer 
    Do 
        tm2 = Timer 
        If tm2 < tm1 Then tm2 = tm2 + 86400 
        If tm2 - tm1 > n Then Exit Do 
        DoEvents 
    Loop 
End Sub 
Sub Main() 
    ' 显示"标志",并且等待 2 秒 
  MDIFrmMain.Show 
    delay 0.9 
  FrmHY.Show 
    delay 2 
    Unload FrmHY 
    ' 显示"登录"窗体,采取强制响应方式 
 '   frmLogin.Show vbModal 
 ' If Not frmLogin.cmdOK Then 
 '       MsgBox "未完成用户名称和密码输入", vbCritical 
 '       End 
 '  End If 
 '   Unload frmLogin 
     
    ' 显示"主"窗体 
  '  Form1.Show 
     
    ' Sub Main() 的工作大功告成 
End Sub