begin process at 2012 02 17 05:28:36
  Trouver un code source :
 
dans
 
Accueil > Forum > 

Archive Visual Basic & VB.NET

 > 

Archives Visual Basic

 > 

J'AI BESOIN D'AIDE !!!! :)

 > 

Application active


Derniers messages déposésPoser une question dans le forum ou lancer une discussion

Application active

mardi 30 juillet 2002 à 21:01:24 | Application active

ypelissier

Bonjour,
J'aimerai pouvoir connaitre l'application qui à le focus dans windows ?

Merci

Yann
mardi 30 juillet 2002 à 22:58:09 | Re : Application active

Charlie


Y'a un API de window qui fait ca.... voici la description... Mais il reste qu'il ne te retourne que le Handle!!!


Declare Function GetActiveWindow Lib "user32" Alias "GetActiveWindow" () As Long

The GetActiveWindow function retrieves the window handle to the active window associated with the thread that calls the function.

If the function succeeds, the return value is the handle to the active window associated with the thread that calls the function. If the calling thread does not have an active window, the return value is NULL.



Exemple...

'This Project needs
'- two timers, interval=100
'- a button

'in general section
Private Type POINTAPI
x As Long
y As Long
End Type

Private Declare Function GetActiveWindow Lib "user32" () As Long
Private Declare Function GetWindowDC Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function Ellipse Lib "gdi32" (ByVal hdc As Long, ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long

Private Declare Function TextOut Lib "gdi32" Alias "TextOutA" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal lpString As String, ByVal nCount As Long) As Long
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Private Sub Form_Load()
Timer1.Interval = 100
Timer1.Enabled = True
Timer2.Interval = 100
Timer2.Enabled = True
Command1.Caption = "Draw Text"
End Sub
'This will draw an Ellipse on the active window
Sub Timer1_Timer()
Dim Position As POINTAPI
'Get the cursor position
GetCursorPos Position
'Draw the Ellipse on the Screen's DC
Ellipse GetWindowDC(0), Position.x - 5, Position.y - 5, Position.x + 5, Position.y + 5
End Sub
Sub Command1_Click()
'KPD-Team 1998
'URL: http://www.allapi.net/
'E-Mail: KPDTeam@Allapi.net

Dim intCount As Integer, strString As String
strString = "Cool, text on screen !"
For intCount = 0 To 30
'Draw the text on the screen
TextOut GetWindowDC(0), intCount * 20, intCount * 20, strString, Len(strString)
Next intCount
End Sub
Private Sub Timer2_Timer()
'Draw the text to the active window
TextOut GetWindowDC(GetActiveWindow), 50, 50, "This is a form", 14
End Sub



-------------------------------
Réponse au message :
-------------------------------

Bonjour,
J'aimerai pouvoir connaitre l'application qui à le focus dans windows ?

Merci

Yann
mercredi 21 août 2002 à 11:31:00 | Re : Application active

ypelissier

Merci beaucoup...



-------------------------------
Réponse au message :
-------------------------------


Y'a un API de window qui fait ca.... voici la description... Mais il reste qu'il ne te retourne que le Handle!!!


Declare Function GetActiveWindow Lib "user32" Alias "GetActiveWindow" () As Long

The GetActiveWindow function retrieves the window handle to the active window associated with the thread that calls the function.

If the function succeeds, the return value is the handle to the active window associated with the thread that calls the function. If the calling thread does not have an active window, the return value is NULL.



Exemple...

'This Project needs
'- two timers, interval=100
'- a button

'in general section
Private Type POINTAPI
x As Long
y As Long
End Type

Private Declare Function GetActiveWindow Lib "user32" () As Long
Private Declare Function GetWindowDC Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function Ellipse Lib "gdi32" (ByVal hdc As Long, ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long

Private Declare Function TextOut Lib "gdi32" Alias "TextOutA" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal lpString As String, ByVal nCount As Long) As Long
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Private Sub Form_Load()
Timer1.Interval = 100
Timer1.Enabled = True
Timer2.Interval = 100
Timer2.Enabled = True
Command1.Caption = "Draw Text"
End Sub
'This will draw an Ellipse on the active window
Sub Timer1_Timer()
Dim Position As POINTAPI
'Get the cursor position
GetCursorPos Position
'Draw the Ellipse on the Screen's DC
Ellipse GetWindowDC(0), Position.x - 5, Position.y - 5, Position.x + 5, Position.y + 5
End Sub
Sub Command1_Click()
'KPD-Team 1998
'URL: http://www.allapi.net/
'E-Mail: KPDTeam@Allapi.net

Dim intCount As Integer, strString As String
strString = "Cool, text on screen !"
For intCount = 0 To 30
'Draw the text on the screen
TextOut GetWindowDC(0), intCount * 20, intCount * 20, strString, Len(strString)
Next intCount
End Sub
Private Sub Timer2_Timer()
'Draw the text to the active window
TextOut GetWindowDC(GetActiveWindow), 50, 50, "This is a form", 14
End Sub



-------------------------------
Réponse au message :
-------------------------------

Bonjour,
J'aimerai pouvoir connaitre l'application qui à le focus dans windows ?

Merci

Yann



Cette discussion est classée dans : application, active


Répondre à ce message

Sujets en rapport avec ce message

Faut il des active X specifique a Win2000 ou NT pour une application Internet?? [ par Aktarez ] Faut il des active X specifique a Win2000 ou NT pour une application Internet??je veux envoyer des info vers un ftp et avec win 2000, le prog me fais trouver l'application active en VB .net [ par bb85 ] En VB6 je sais le faire avec les API GetForegroundWindow et GetWindowText.Mon souci : refaire en VB .Net une petite application qui envoie par SendKey détécter la form active de mon application [ par zmaai ] Je cherche à détecter la form active dans mon application(par exemple en cliquant sur une command le nom de la form s'affiche dans une zone de text ou APPLICATION ACTIVE [ par planchon_a ] Bonjour, Je cherche à pouvoir détecter en VB6, quelle application de Windows est actuellement active... fenetre active [ par Mekhanik ] Salut je cherche une api qui me permette de determiner au sein d'une application mutlifenetre laquelle est active (genre photoshop lorsque plusieurs f application active [ par GEX RIDER ] je cherche le moyen de recupererune api qui peut donner le titre de la fenetre ou de l'application activemerci de m'aiderje veux veux bien aider aussi rendre une application active à partir de son handle [ par kiakia ] Voilà tout est presque dans le titre :Dsauf qu' il s'agit d'une console dos :p j'ai essayé plusieur fonction comme set.focus, put.focus mais j'arrive Déterminer La form active dans Une Application MDI [ par VPNVB ] Salutje veux developper un editeur de text (en mode MDI)mais comon déterminer le formulaire de document active par exempledans VB6, en peux écrir:Acti Besoin de suggestion [ par djief ] Salut Je suis à la recherche d'une suggestion. J'ai 3 combobox dans mon application. La premiere active la 2e qui active la 3e. La 3 dépend de la 2 et Telecharger un fichier sans ACTIVE X [ par nicodada ] J'ai fais une rechercher sur le SITE. Il me faut télécharger un fichier sur un HTTP, en utilisans un API mais qu'il ne fasse pas plante


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 : 1,498 sec (4)

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