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
Option Explicit 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 Const HWND_TOPMOST = -1 Private Const SWP_SHOWWINDOWS = &H40
Private Sub Form_Load() Dim retValue As Long retValue = SetWindowPos(Me.hwnd, HWND_TOPMOST, Me.CurrentX, _ Me.CurrentY, 300, 300, SWP_SHOWWINDOWS) End Sub
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long Private Declare Function SetParent Lib "user32" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long
Private Sub Form_Load() Dim rtn& rtn = FindWindow(vbNullString, "Program Manager") SetParent Me.hWnd, rtn End Sub
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long Private Declare Function SetParent Lib "user32" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long Dim starttm& Private Sub Form_Load() Dim rtn& rtn = FindWindow(vbNullString, "Program Manager") SetParent Me.hWnd, rtn Timer1.Enabled = True Timer1.Interval = 100 If App.PrevInstance Then End End Sub
Private Sub Timer1_Timer() If Me.WindowState = 1 Then Timer1.Enabled = False Me.SetFocus: SendKeys Chr(13) starttm = Timer Do DoEvents Loop Until Timer >= starttm + 1 Timer1.Enabled = True End If End Sub