Accueil > > > TREMBLEMENT DE TERRE (EUH, DE FENÊTRES PLUTÔT)
TREMBLEMENT DE TERRE (EUH, DE FENÊTRES PLUTÔT)
Information sur la source
Description
Toutes les fenêtres tremblent.
On peut choisir la durée du tremblement (idéal pour faire une blague).
Pour les paresseux j'ai mit le ZIP.
Source
- 'Faut faire un module, pas de form, et en démarrage le submain
-
- Private Type RECT
- Left As Long
- Top As Long
- Right As Long
- Bottom As Long
- End Type
- Private Type POINTAPI
- x As Long
- y As Long
- End Type
- Private Declare Function EnumWindows Lib "user32" (ByVal lpEnumFunc As Long, ByVal Lparam As Long) As Long
- Private Declare Function GetDesktopWindow Lib "user32" () As Long
- Private Declare Function GetWindowRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT) 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 Declare Function GetWindow Lib "user32" (ByVal hwnd As Long, ByVal wCmd As Long) As Long
- Private Declare Function IsWindowVisible Lib "user32" (ByVal hwnd As Long) As Long
- Dim tabwin(1000) As Long, numwin As Integer
-
- Private Sub Main()
- App.TaskVisible = False
- Dim starttime As Long
- starttime = Timer + InputBox("Durée du tremblement")
- Do Until Timer >= starttime
- Call GetWindowsList
- Call MoveWindow
- DoEvents
- Loop
- End Sub
-
- Private Function GetWindowsList()
- numwin = 0
- EnumWindows AddressOf EnumWindowsProc, 0
- End Function
-
- Private Function EnumWindowsProc(ByVal lgHwnd As Long, ByVal lgParam As Long) As Long
- If lgHwnd <> 0 And IsWindowVisible(lgHwnd) Then numwin = numwin + 1: tabwin(numwin) = lgHwnd
- EnumWindowsProc = 1
- End Function
-
- Private Sub MoveWindow()
- Dim winpos As RECT, newwinpos As POINTAPI, movewin As Integer
- Static toposx As Integer, toposy As Integer
- For movewin = 1 To numwin
- GetWindowRect tabwin(movewin), winpos
- newwinpos.x = winpos.Left + Fix(Rnd * 40) - 20
- newwinpos.y = winpos.Top + Fix(Rnd * 40) - 20
- If newwinpos.x > (Screen.Width / Screen.TwipsPerPixelX) Or newwinpos.x < 0 Or newwinpos.y > (Screen.Height / Screen.TwipsPerPixelY) Or newwinpos.y < 0 Then newwinpos.x = winpos.Left: newwinpos.y = winpos.Top
- SetWindowPos tabwin(movewin), 0, newwinpos.x, newwinpos.y, 0, 0, &H1
- Next movewin
- End Sub
'Faut faire un module, pas de form, et en démarrage le submain
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Private Type POINTAPI
x As Long
y As Long
End Type
Private Declare Function EnumWindows Lib "user32" (ByVal lpEnumFunc As Long, ByVal Lparam As Long) As Long
Private Declare Function GetDesktopWindow Lib "user32" () As Long
Private Declare Function GetWindowRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT) 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 Declare Function GetWindow Lib "user32" (ByVal hwnd As Long, ByVal wCmd As Long) As Long
Private Declare Function IsWindowVisible Lib "user32" (ByVal hwnd As Long) As Long
Dim tabwin(1000) As Long, numwin As Integer
Private Sub Main()
App.TaskVisible = False
Dim starttime As Long
starttime = Timer + InputBox("Durée du tremblement")
Do Until Timer >= starttime
Call GetWindowsList
Call MoveWindow
DoEvents
Loop
End Sub
Private Function GetWindowsList()
numwin = 0
EnumWindows AddressOf EnumWindowsProc, 0
End Function
Private Function EnumWindowsProc(ByVal lgHwnd As Long, ByVal lgParam As Long) As Long
If lgHwnd <> 0 And IsWindowVisible(lgHwnd) Then numwin = numwin + 1: tabwin(numwin) = lgHwnd
EnumWindowsProc = 1
End Function
Private Sub MoveWindow()
Dim winpos As RECT, newwinpos As POINTAPI, movewin As Integer
Static toposx As Integer, toposy As Integer
For movewin = 1 To numwin
GetWindowRect tabwin(movewin), winpos
newwinpos.x = winpos.Left + Fix(Rnd * 40) - 20
newwinpos.y = winpos.Top + Fix(Rnd * 40) - 20
If newwinpos.x > (Screen.Width / Screen.TwipsPerPixelX) Or newwinpos.x < 0 Or newwinpos.y > (Screen.Height / Screen.TwipsPerPixelY) Or newwinpos.y < 0 Then newwinpos.x = winpos.Left: newwinpos.y = winpos.Top
SetWindowPos tabwin(movewin), 0, newwinpos.x, newwinpos.y, 0, 0, &H1
Next movewin
End Sub
Conclusion
geJe pense pas qu'il ait de Bugs (on dit bogues en French)
J'ai mit Niveau 2, dites-le moi si ca vaut pas
Sources du même auteur
Sources de la même categorie
Commentaires et avis
|
Derniers Blogs
COMMENT MAPPER UNE VUE SQL SUR UNE COLLECTION DE COMPLEX TYPE?COMMENT MAPPER UNE VUE SQL SUR UNE COLLECTION DE COMPLEX TYPE? par Matthieu MEZIL
Avec EF, les vues doivent être mappées sur des entity types. Le problème c'est que les entity types doivent avoir une clé. Avec EF, nous avons les complex type qui n'ont pas de clé mais les vues ne peuvent pas être mappées dessus. Avec EF4, il est possibl...
Cliquez pour lire la suite de l'article par Matthieu MEZIL [WF4] UN BINDING ACTIVITY/ACTIVITYDESIGNER QUI PASSE MAL?[WF4] UN BINDING ACTIVITY/ACTIVITYDESIGNER QUI PASSE MAL? par JeremyJeanson
Certain d'entre vous on peut être vécu cette situation embarrassante après quelques temps passer avec WF4 : Au début avec mon " ActivityDesigner" , tout allait bien. Et puis un jour j'ai au des problèmes de " Binding" . Alors nous sommes allé sur le site ...
Cliquez pour lire la suite de l'article par JeremyJeanson MYTIC - SHAREPOINT 2010 : DéJà UN MYTHE MICROSOFT ?MYTIC - SHAREPOINT 2010 : DéJà UN MYTHE MICROSOFT ? par junarnoalg
La prochaine session de MyTIC aura lieu à Namur, le 23 mars prochain. Pendant presque une heure, nous parlerons de SharePoint 2010. Voici un aperçu du programme.
Accueil : 17h30 Début de la session : 18h00 - Les nouvelles int...
Cliquez pour lire la suite de l'article par junarnoalg
Logiciels
Academy System (10.9.4.0)ACADEMY SYSTEM (10.9.4.0)Logiciel de gestion des établissements.
- élèves/étudiants (inscription, dossier, absence...)
-... Cliquez pour télécharger Academy System Xilisoft Convertisseur Vidéo Ultimate (5.1.39.0305)XILISOFT CONVERTISSEUR VIDéO ULTIMATE (5.1.39.0305)Xilisoft Convertisseur Vidéo Ultimate est un outil puissant de conversion vidéo, facile à utilise... Cliquez pour télécharger Xilisoft Convertisseur Vidéo Ultimate Xilisoft DVD Ripper Ultimate (5.0.64.0304)XILISOFT DVD RIPPER ULTIMATE (5.0.64.0304)Xilisoft DVD Ripper Ultimate est un logiciel excellent pour copier et convertir DVD vers presque ... Cliquez pour télécharger Xilisoft DVD Ripper Ultimate Rigs of Rods (63.3)RIGS OF RODS (63.3)c'est un jeu de multi-simulation camions,autobus voitures, avions, bateaux, hélicoptère avec défo... Cliquez pour télécharger Rigs of Rods
|