| Ce projet nécessite - 2 timers, intervalle 100 - 1 bouton 'Dans la section générale de la feuille Private Type POINTAPI x As Long y As Long End Type Private Declare Function GetActiveWindow Lib "user32" () As Long Private Declare Function GetWindowDC Lib "user32" (ByVal hwnd As Long) As Long Private Declare Function Ellipse Lib "gdi32" (ByVal hdc As Long, ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long Private Declare Function TextOut Lib "gdi32" Alias "TextOutA" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal lpString As String, ByVal nCount As Long) As Long Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long Private Sub Form_Load() Timer1.Interval = 100 Timer1.Enabled = True Timer2.Interval = 100 Timer2.Enabled = True Command1.Caption = "Draw Text" End Sub Sub Timer1_Timer() 'Cela dessine une ellipse sur la fenêtre active Dim Position As POINTAPI GetCursorPos Position Ellipse GetWindowDC(0), Position.x - 5, Position.y - 5, Position.x + 5, Position.y + 5 End Sub Sub Command1_Click() 'VbAndJava 1999/2000 'Guerrault Yonni 'E-Mail : Yonni4@iFrance.com Dim intCount As Integer, strString As String strString = "Cool, text on screen !" For intCount = 0 To 30 TextOut GetWindowDC(0), intCount * 20, intCount * 20, strString, Len(strString) Next intCount End Sub Private Sub Timer2_Timer() TextOut GetWindowDC(GetActiveWindow), 50, 50, "Coucou !", 14 End Sub |