begin process at 2012 02 16 11:26:39
  Trouver un code source :
 
dans
 
Accueil > 

Code

 > 

Tutoriaux

 > PROGRAMME PERMETTANT DE GARDER UNE FORME AU PREMIER PLAN

PROGRAMME PERMETTANT DE GARDER UNE FORME AU PREMIER PLAN


 Information sur la source

Note :
10 / 10 - par 1 personne
10,00 / 10

  • 1

  • 2

  • 3

  • 4

  • 5

  • 6

  • 7

  • 8

  • 9

  • 10
Catégorie :Tutoriaux Niveau :Débutant Date de création :18/02/2004 Vu / téléchargé :6 580 / 585

Auteur : cuq

Ecrire un message privé
Site perso
Ce membre participe au partage de revenus publicitaires
Commentaire sur cette source (8)
Ajouter un commentaire et/ou une note


 Description

C'est un petit programme qui permet de charger une image et de l'afficher en la laissant toujours au premier plan.

Ce programme permet par exemple d'avoir pendant une présentation votre logo au premier plan avec une autre application qui fonctionne derrière.

Click droit de la souris sur l'image = déplacement de la forme sur l'écran
Click avec autre bouton fermeture de l'application.

Source

  • ' Ce projet a besoin d'un controle PictureBox
  • Option Explicit
  • 'The SetWindowPos function changes the size, position, and Z order of a child, pop-up, or top-level window. Child, pop-up, and top-level windows are ordered according to their appearance on the screen. The topmost window receives the highest rank and is the first window in the Z order.
  • Private Declare Sub 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)
  • 'Fonctions pour déplacer la fenetre
  • 'The ReleaseCapture function releases the mouse capture from a window in the current thread and restores normal mouse input processing.
  • Private Declare Function ReleaseCapture Lib "USER32" () As Long
  • 'The SendMessage function sends the specified message to a window or windows. The function calls the window procedure for the specified window and does not return until the window procedure has processed the message. The PostMessage function, in contrast, posts a message to a thread's message queue and returns immediately.
  • Private Declare Function SendMessage Lib "USER32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
  • 'declaration des constantes
  • Const WM_NCLBUTTONDOWN = &HA1
  • Const HTCAPTION = 2
  • Const RGN_OR = 2
  • Const HWND_TOPMOST = -1
  • Const HWND_NOTOPMOST = -2
  • Const SWP_NOSIZE = &H1
  • Const SWP_NOMOVE = &H2
  • Const SWP_NOACTIVATE = &H10
  • Const SWP_SHOWWINDOW = &H40
  • Private Sub Form_Load()
  • ' si erreur continue ( par exemple si pas de fichier logo.bmp alors on a l'image déjà présente dans le controle
  • ' picture box
  • On Error Resume Next
  • 'Repositionnne l'image
  • Picture1.Left = 0
  • Picture1.Top = 0
  • Picture1.Appearance = 0 ' apparence=Flat
  • Picture1.AutoSize = True ' Redimensionne le controle picture box à la taille de l'image
  • 'Charge L'image avec le fichier image.bmp présent dans le répertoire de l'apli
  • Picture1 = LoadPicture(App.Path + "\Logo.bmp")
  • 'Redimensione la forme selon la taille de l'image
  • Me.Height = Picture1.Height
  • Me.Width = Picture1.Width
  • ' la fenetre est mise toujours au premier plan
  • SetWindowPos Me.hWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE
  • End Sub
  • ' click bouton droit = deplacement de la forme
  • ' click autre bouton = fin application
  • Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
  • 'Pour déplacer la form
  • If Button = 1 Then
  • ReleaseCapture
  • SendMessage Me.hWnd, WM_NCLBUTTONDOWN, HTCAPTION, 0&
  • Else
  • ' un autre bouton ferme l'application
  • Unload Me
  • End If
  • End Sub
' Ce projet a besoin d'un controle PictureBox
Option Explicit

'The SetWindowPos function changes the size, position, and Z order of a child, pop-up, or top-level window. Child, pop-up, and top-level windows are ordered according to their appearance on the screen. The topmost window receives the highest rank and is the first window in the Z order.
Private Declare Sub 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)

'Fonctions pour déplacer la fenetre
'The ReleaseCapture function releases the mouse capture from a window in the current thread and restores normal mouse input processing.
Private Declare Function ReleaseCapture Lib "USER32" () As Long
'The SendMessage function sends the specified message to a window or windows. The function calls the window procedure for the specified window and does not return until the window procedure has processed the message. The PostMessage function, in contrast, posts a message to a thread's message queue and returns immediately.
Private Declare Function SendMessage Lib "USER32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long

'declaration des constantes
 Const WM_NCLBUTTONDOWN = &HA1
 Const HTCAPTION = 2
 Const RGN_OR = 2

 Const HWND_TOPMOST = -1
 Const HWND_NOTOPMOST = -2
 Const SWP_NOSIZE = &H1
 Const SWP_NOMOVE = &H2
 Const SWP_NOACTIVATE = &H10
 Const SWP_SHOWWINDOW = &H40

Private Sub Form_Load()

' si erreur continue ( par exemple si pas de fichier logo.bmp alors on a l'image déjà présente dans le controle
' picture box
On Error Resume Next

'Repositionnne l'image
Picture1.Left = 0
Picture1.Top = 0
Picture1.Appearance = 0 ' apparence=Flat
Picture1.AutoSize = True ' Redimensionne le controle picture box à la taille de l'image


'Charge L'image avec le fichier image.bmp présent dans le répertoire de l'apli
Picture1 = LoadPicture(App.Path + "\Logo.bmp")

'Redimensione  la forme selon la taille de l'image
 Me.Height = Picture1.Height
 Me.Width = Picture1.Width

' la fenetre est mise toujours au premier plan
SetWindowPos Me.hWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE

End Sub


' click bouton droit = deplacement de la forme
' click autre bouton = fin application
Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
'Pour déplacer la form
If Button = 1 Then
      ReleaseCapture
      SendMessage Me.hWnd, WM_NCLBUTTONDOWN, HTCAPTION, 0&
Else
    ' un autre bouton ferme l'application
    Unload Me
End If
End Sub


 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 PILOTER GOOGLEEARTH AVEC SES API
Source avec Zip Source avec une capture VISUALISATEUR / EDITEUR OPENGL
Source avec Zip Source avec une capture FORCER LE "." POINT COMME PARAMÈTRE DÉCIMAL DANS LES PARAMÈT...
Source avec Zip Source avec une capture JEUX DE COMBAT OPENGL
Source avec Zip Source avec une capture ROTATION 3D

 Sources de la même categorie

Source avec Zip DLL PERSONNALISÉ AVEC ÉVÈNEMENTS ET PROPRIÉTÉS EN VB6. par Number7
Source avec Zip Source .NET (Dotnet) EXEMPLE DU TUTORAIL "CLASSES MÉTIER" par Adn56
Source avec Zip Source avec une capture Source .NET (Dotnet) GESTION DES LISTES : RANGEMENT (LIST.SORT) ET FILTRAGE (LIST... par kbalist
Source avec Zip EXEMPLE SUR LES MENUS POUR AIDER LES DÉBUTANTS COMME MOI ;-) par viragoloco
LES OPÉRATIONS DE LA LISTE CHAINÉE par smaili

Commentaires et avis

Commentaire de azerty25 le 19/02/2004 07:02:04

On l'a déja vu plein de fois ici ;)

Commentaire de azerty25 le 19/02/2004 07:02:22

On l'a déja vu plein de fois ici ;)

Commentaire de cuq le 19/02/2004 09:40:16

Ha !

Commentaire de ana_adil le 19/02/2004 23:28:00

bah moi c est la 1 er fois que je la voi.
merci cuq.

Commentaire de Salaminovitch le 27/10/2004 10:25:53

Super! ça me dépanne ton truc. Merci!

Commentaire de Salaminovitch le 27/10/2004 10:26:01

Super! ça me dépanne ton truc. Merci!

Commentaire de sitemo le 02/07/2005 16:08:14

comment on peut afficher un logo en premier plan a un temps donnée et puis mettre un boutonMeric

Commentaire de Sator1 le 05/06/2008 02:02:18 10/10

C'est simple et sympat et bien commenté... merci à toi.

@+ Sator

 Ajouter un commentaire




Nos sponsors


Sondage...

CalendriCode

Février 2012
LMMJVSD
  12345
6789101112
13141516171819
20212223242526
272829    

Consulter la suite du CalendriCode

Photothèque

 
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,858 sec (4)

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