Option Explicit 'Private hwnd As Long Private AuSommet As Long Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" _ (ByVal lpClassName As String, ByVal lpWindowName As String) As Long Private Const SWP_NOMOVE = 2 Private Const SWP_NOSIZE = 1 Private Const FLAGS = SWP_NOMOVE Or SWP_NOSIZE Private Const HWND_TOPMOST = -1 Private Const SW_HIDE = 0 Private Const SW_MAXIMIZE = 3 Private Const SW_MINIMIZE = 6 Private Const SW_RESTORE = 9 Private Const SW_SHOW = 5 Private Const SW_SHOWDEFAULT = 10 Private Const SW_SHOWMAXIMIZED = 3 Private Const SW_SHOWMINIMIZED = 2 Private Const SW_SHOWMINNOACTIVE = 7 Private Const SW_SHOWNA = 8 Private Const SW_SHOWNOACTIVATE = 4 Private Const SW_SHOWNORMAL = 1 Private Declare Function SetForegroundWindow Lib "user32" (ByVal hwnd As Long) As Long Private Declare Function SetCursorPos Lib "user32" (ByVal x As Long, ByVal Y As Long) As Long 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 mRet As Long Dim mPID As Long Dim bRet As Boolean mRet = FindWindow(vbNullString, "Ariane Application") If mRet <> 0 Then MsgBox "Programme déja ouvert !", vbCritical, "ATTENTION !" ' info à l'utilsteur qu'il manque des cdes secteurs GoTo cgt End If Me.Show Me.BorderStyle = 0 Me.WindowState = 2 AuSommet = SetForegroundWindow(Me.hwnd) SetCursorPos 700, 250 Image1.Picture = LoadPicture("C:\Users\Administrateur\Pictures\BOURSE\2009_05_18\argent billets.jpg") Image1.Top = 0 Image1.Left = 0 Image1.Width = Me.ScaleWidth Image1.Height = Me.ScaleHeight mPID = Shell("C:\Program Files\Microsoft Office\Office12\excel.exe F:\BOURSE\PROGRAMES\ARIANE22.xlsm", SW_MINIMIZE) AuSommet = SetForegroundWindow(Me.hwnd) Do mRet = FindWindow(vbNullString, "Ariane Application") 'FENETRE PARENT If mRet <> 0 Then Exit Do Loop cgt: Unload Me End Sub
Public Sub DEMAR() 'Stop Sheets("Feuil1").Select Application.DisplayFullScreen = True Ct = DateAdd("S", 20, Now) Do While Ct > Now hparent = FindWindow(vbNullString, "Microsoft Excel - ARIANE22.xlsm") 'FENETRE PARENT If hparent <> 0 Then Exit Do Loop DoEvents ret = FindWindow(vbNullString, "Gardien") DoEvents SetCursorPos 700, 250 ret1 = hparent 'Stop SetWindowText hparent, "Ariane Application" 'ret2 = SetWindowPos(hparent, HWND_TOPMOST, 0, 0, 0, 0, SW_SHOWMAXIMIZED) 'ret2 = BringWindowToTop(hparent) 'ret2 = SetForegroundWindow(hparent) If ret <> 0 Then FORMATAGE End Sub
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question