CCJ
Messages postés565Date d'inscriptionmercredi 19 mai 2004StatutMembreDernière intervention30 avril 2008
-
12 févr. 2005 à 19:14
cs_CanisLupus
Messages postés3757Date d'inscriptionmardi 23 septembre 2003StatutMembreDernière intervention13 mars 2006
-
16 févr. 2005 à 20:47
Voila le code :
Private Declare Function GetWindowTextLength Lib "USER32" Alias "GetWindowTextLengthA" (ByVal hwnd As Long) As Long
Private Declare Function GetForegroundWindow Lib "USER32" () As Long
Private Declare Function BringWindowToTop Lib "USER32" (ByVal hwnd As Long) As Long
Private Declare Function SetWindowText Lib "USER32" Alias "SetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String) As Long
Private Declare Function GetWindowText Lib "USER32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
Private Declare Function GetWindowLong Lib "USER32" Alias "GetWindowLongA" _
(ByVal hwnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SetWindowLong Lib "USER32" Alias "SetWindowLongA" _
(ByVal hwnd As Long, ByVal nIndex As Long, _
ByVal dwNewLong As Long) As Long
Private Const GWL_STYLE = (-16)
Private Const GWL_EXSTYLE = (-20)
Private Const WS_EX_LAYERED = &H80000
Private Declare Function SetLayeredWindowAttributes Lib "USER32" _
(ByVal hwnd As Long, ByVal crKey As Long, _
ByVal bAlpha As Byte, ByVal dwFlags As Long) As Long
Private Const LWA_COLORKEY = &H1
Private Const LWA_ALPHA = &H2
Private hwnd1 As Long
Public Sub MakeWindowTransparent(ByVal hwnd As Long, ByVal alphaAmount As Byte)
Dim lStyle As Long
lStyle = GetWindowLong(hwnd, GWL_EXSTYLE)
lStyle = lStyle Or WS_EX_LAYERED
SetWindowLong hwnd, GWL_EXSTYLE, lStyle
SetLayeredWindowAttributes hwnd, 0, alphaAmount, LWA_ALPHA
End Sub
Private Sub Fenetre_Timer()
Dim PP As Long
Dim Deja As Boolean
Dim Text As String
Dim Length As Long
Deja = False
PP = GetForegroundWindow
For i = 1 To Fenetres.ListCount - 1
If Fenetres.List(i) = PP Then
Deja = True
End If
Next i
If Deja = False Then
Fenetres.AddItem PP
Length = GetWindowTextLength(PP)
List1.AddItem GetWindowText(PP, Text, Length + 1)
End If
End Sub
Private Sub Form_Load()
Open App.Path & "" & "Parametre.zvx" For Input As #2
Input #2, i
Close #2
Call VirusManModifications.MakeWindowTransparent(Me.hwnd, i)
End Sub
Private Sub Invisible_Click()
If Transparance.Text <> "" Then
Call MakeWindowTransparent(Fenetres.Text, Transparance.Text)
Else
MsgBox "Erreur texte vide !", vbCritical, "Erreur"
End If
End Sub
Private Sub Premier_Plan_Click()
If Premier_Plan.Caption = "Garder au premier plan" Then
If Frequence.Text <> "" Then
Premier_Plan.Caption = "Arreter"
hwnd1 = Fenetres.Text
PremierPlan.Interval = Frequence.Text
PremierPlan.Enabled = True
Else
MsgBox "Erreur texte vide !", vbCritical, "Erreur"
End If
Else
Premier_Plan.Caption = "Garder au premier plan"
PremierPlan.Enabled = False
End If
End Sub
Private Sub PremierPlan_Timer()
BringWindowToTop hwnd1
End Sub
Private Sub Renommer_Click()
If Nom.Text <> "" Then
SetWindowText Fenetres.Text, Nom.Text
Else
MsgBox "Erreur textet vide !", vbCritical, "Erreur"
End If
End Sub
dans ma liste de nom , y a que des zero (0) comme nom
help!
VirusMan
une idée est un chose ,la dire en est une autre
cs_Jack
Messages postés14006Date d'inscriptionsamedi 29 décembre 2001StatutModérateurDernière intervention28 août 201579 12 févr. 2005 à 20:27
Salut
La prochaine fois, évite de tout copier coller, ça sert à rien. D'autant que ta question n'est pas assez précise.
Je pense que c'est ta fonction GetWindowText qui ne te renvoie rien ?
As-tu débuggé pour le savoir ?
Repose ta question en ciblant les quelques lignes qui posent problème, parce que là, tu fais peur à tout le monde (personne n'a vraiment le temps d'analyser toutes tes lignes)
Vala
Jack
NB : Je ne répondrai pas aux messages privés
Le savoir est la seule matière qui s'accroit quand on la partage. (Socrate)
cs_CanisLupus
Messages postés3757Date d'inscriptionmardi 23 septembre 2003StatutMembreDernière intervention13 mars 200620 13 févr. 2005 à 12:49
Salut,
Suis un peu OK avec jack, mais bon, à la lecture rapide de ton code j'ai remarqué un prob avec ton api GetWindowText.
En codant :
List1.AddItem GetWindowText(PP, Text, Length + 1)
tu ne fais qu'ajouter dans ta liste le numéro d'erreur de la fonction.
Essaie plutôt ça :