Advertisement
Guest User

Popup-Test_Form1

a guest
Aug 6th, 2013
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Option Explicit
  2. 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
  3. Private Declare Function FlashWindow Lib "user32.dll" (ByVal Hwnd As Long, ByVal bInvert As Long) As Long
  4.  
  5. Const SWP_NOMOVE = &H2&
  6. Const SWP_NOSIZE = &H1&
  7. Const HWND_TOP As Long = 0
  8. Const HWND_TOPMOST = -1
  9. Const HWND_NOTOPMOST = -2
  10.  
  11. Private Sub cmdTestPopup_Click()
  12.     Me.WindowState = 1
  13.     Me.Caption = "Minimized..."
  14.     tmrPopup.Interval = txtPopupDelay
  15.     tmrPopup = True
  16. End Sub
  17.  
  18. Private Sub tmrPopup_Timer()
  19.     tmrPopup = False
  20.     Me.WindowState = 0
  21.     BringWindowOnTop Me.Hwnd
  22.     FlashWindow Me.Hwnd, True
  23.     Me.Caption = "Popped up"
  24. End Sub
  25.  
  26. Public Sub BringWindowOnTop(Hwnd As Long)
  27.     SetWindowPos Hwnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE
  28.     SetWindowPos Hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE
  29.     SetWindowPos Hwnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE
  30. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement