Private Const KEYEVENTF_KEYUP = &H2 Private Declare Function CharToOem& Lib "USER32" Alias "CharToOemA" (ByVal lpszSrc As String, ByVal lpszDst As String) Private Declare Function GetAsyncKeyState% Lib "USER32" (ByVal vKey As Long) Private Declare Function GetKeyState Lib "USER32" (ByVal nVirtKey As Long) As Integer Private Declare Sub keybd_event Lib "USER32" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long) Private Declare Function MapVirtualKey Lib "USER32" Alias "MapVirtualKeyA" (ByVal wCode As Long, ByVal wMapType As Long) As Long Private Declare Function OemKeyScan& Lib "USER32" (ByVal wOemChar As Integer) Private Declare Function ShowCursor Lib "USER32" (ByVal bShow As Long) As Long Private Declare Function SystemParametersInfo Lib "USER32" Alias "SystemParametersInfoA" (ByVal uAction As Long, ByVal uParam As Long, lpvParam As Any, ByVal fuWinIni As Long) As Long Private Declare Function VkKeyScan% Lib "USER32" Alias "VkKeyScanA" (ByVal cChar As Byte) Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hWnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long Dim rtn As Long Public st As Long Public val As Long Public amb As Long Public temp As Long Public rest As Integer Public comp As Integer 'convertir une valeur en seconde Public Function ConvertSeconds(lSeconds As Long) As String 'Declare variables temporaires Dim lTmpMinutes As Long Dim lTmpSeconds As Long Dim lTmpHours As Long If lSeconds > 59 Then lTmpSeconds = lSeconds Mod 60 If lSeconds > 3599 Then lTmpHours = Fix(lSeconds / 3600) lTmpMinutes = lSeconds / 60 - (60 * lTmpHours) ConvertSeconds = lTmpHours & ":" & Format _ (lTmpMinutes, "00") & ":" & Format(lTmpSeconds, "00") Else lTmpMinutes = Fix(lSeconds / 60) ConvertSeconds = lTmpMinutes & ":" & _ Format(lTmpSeconds, "00") End If Else ConvertSeconds = "0:" & Format(lSeconds, "00") End If End Function 'comande pour quitter l'application Private Sub Command1_Click() Form2.Enabled = False Timer1.Enabled = False End Sub 'commande pour lancer le site Private Sub Label1_Click() 'juste un exemple de site ShellExecute Me.hWnd, "open", "http://www.yahoo.fr/", vbNullString, vbNullString, SW_SHOWNORMAL End Sub 'timer de la valeur du temps Private Sub Timer1_Timer() val = val + 1 rest = val Mod 3600 comp = (val \ 3600) * 1000 Text2.Text = ConvertSeconds(val) Timer2.Enabled = True 'Form2.Enabled = False 'Timer1.Enabled = False 'End If 'If Text1.Text = 0 Then End Sub 'pour se connecter au serveur, j'ai pas encore terminer Private Sub Winsockx_Error(ByVal Number As Integer, Description As String, ByVal Scode As Long, ByVal Source As String, ByVal HelpFile As String, ByVal HelpContext As Long, CancelDisplay As Boolean) Winsockx.Close Winsockx.Connect host, Port End Sub Private Sub Timer2_Timer() 'pour détecter les différent clic (quand on relève la touche) lbdroit.Caption = NbClcDrt lbgauche.Caption = NbClcGche g = g - 1 h = h - 1 'amb est la Caption temporaire du Label NbClc amb = 10000 lbdroit.Caption = NbClcDrt lbgauche.Caption = NbClcGche 'detecter clic droit If GetKeyState(&H2) < 0 Then g = 1 If g 0 Then NbClcDrt NbClcDrt + 1 'detecter clic gauche If GetKeyState(&H1) < 0 Then h = 1 If h 0 Then NbClcGche NbClcGche + 1 'le nombre de clic NbClc = NbClcGche + NbClcDrt 'le montant à afficher If NbClc <> 0 Then amb = amb - 50 Label11.Caption = amb Label11.Caption = amb End Sub
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question