begin process at 2010 02 09 19:48:16
  Trouver un code source :
 
dans
 
Accueil > 

Code

 > 

API

 > TREMBLEMENT DE TERRE (EUH, DE FENÊTRES PLUTÔT)

TREMBLEMENT DE TERRE (EUH, DE FENÊTRES PLUTÔT)


 Information sur la source

Note :
5,5 / 10 - par 2 personnes
5,50 / 10

  • 1

  • 2

  • 3

  • 4

  • 5

  • 6

  • 7

  • 8

  • 9

  • 10
Catégorie :API Niveau :Initié Date de création :15/10/2002 Date de mise à jour :16/10/2002 13:30:33 Vu / téléchargé :1 736 / 161

Auteur : Bricomix

Ecrire un message privé
Commentaire sur cette source (4)
Ajouter un commentaire et/ou une note

 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

 Fichier Zip

Les Membres Club peuvent télécharger directement un fichier contenu dans le zip sans télécharger le zip en entier !

Télécharger le zip


 Sources du même auteur

Source avec Zip Source avec une capture SCANNER DE PORTS ULTRA-RAPIDE V2 (150 PORTS / S) ;)
Source avec Zip Source avec une capture VBTOHTML V2 (PLEIN DE FONCTIONS ET RAPIDE !!)
Source avec Zip Source avec une capture CONVERTISSEUR DE CODE VB > HTML RAPIDE !
Source avec Zip Source avec une capture NET SCAN - SCANNER DE PORTS RAPIDE QUI MARCHE :-)
Source avec Zip Source avec une capture JEU DE DAMES MULTI (BEAU GRAPHIQUEMENT...)

 Sources de la même categorie

Source avec Zip Source avec une capture Source .NET (Dotnet) FAIRE LA DIFFÉRENCE ENTRE UNE ADRESSE EMAIL QUI EXISTE D'UNE... par lesinfosdugeek
ENVOYER UN MESSAGE SUR SON COMPTE TWITTER par lesinfosdugeek
Source avec Zip Source avec une capture TROUVER LES CLÉS DE REGISTRE QUI CHANGENT par Flocreate
Source avec Zip IP_PUBLIQUE_INTERNETGETCONNECTEDSTATE par marco62118
Source avec Zip TOUTES LES RÉSOLUTIONS D'ÉCRAN ET TAILLE MAXI DE LA FORM AUD... par marco62118

Commentaires et avis

Commentaire de Alan71 le 15/10/2002 22:49:00

Sans dek ! J'croyait que tu allais faire tremblé mon écran !

Perso, G aucun collègue à faire chier !

Commentaire de DARKSIDIOUS le 16/10/2002 07:52:17 administrateur CS

Ca me rapelle vaguement une bonne dizaine de source déjà publiée sur ce site.... (je n'en fait pas partie heureusement)

DARK SIDIOUS

Commentaire de Tr0m le 16/10/2002 08:42:00

c nul...  a la fin du temps,  il remete meme pas les fenêtre à leur place initial...

Commentaire de Dark_Shadow le 07/09/2004 08:53:35

Tr0m ca tu pux l'ajouter tt seul c'est pas très dur !!^^

 Ajouter un commentaire




Nos sponsors


Sondage...

CalendriCode

Février 2010
LMMJVSD
1234567
891011121314
15161718192021
22232425262728

Consulter la suite du CalendriCode

 
Développement réalisé par Nicolas SOREL (Nix) avec l'aide de : Cyril DURAND et Emmanuel (EBArtSoft), Merci à Vincent pour ses précieux conseils.
CodeS-SourceS.com© Toute reproduction même partielle est interdite sauf accord écrit du Webmaster
CodeS-SourceS.com© est une marque déposée tous droits réservés

Google Coop CodeS-SourceS Google Coop CodeS-SourceS
Temps d'éxécution de la page : 0,718 sec (4)

Nous contacter | Annoncer sur CodeS-SourceS | Mentions légales