Djzlouk
Messages postés70Date d'inscriptionjeudi 26 juillet 2007StatutMembreDernière intervention20 janvier 2011
-
31 juil. 2007 à 15:29
Djzlouk
Messages postés70Date d'inscriptionjeudi 26 juillet 2007StatutMembreDernière intervention20 janvier 2011
-
7 août 2007 à 17:23
Bonjour,
Depuis quelque jour j'essai de trouver comment deplacer des fenetres ouvertes depuis une petite application VB6.
Pour cela je récupere les process en cours, et j'ai comme ca le nom de chaque fenetre lancé.
C'est la que le souci arrive, selon l'application j'aimerais effectué un traitement pour mettre tel ou tel fenetre à tel ou tel endroit.
Je ne sais pas du tout dans quel domaine chercher, pour controler une application.
1) Es que quelqu'un peut me mettre sur le voie ?
2) Si j'ai 2 ecrans, comment je peux lui dire de mettre mon appli sur le 2eme ecran ?
merci de me lancer sur une ou des solutions possibles...
Djzlouk
Messages postés70Date d'inscriptionjeudi 26 juillet 2007StatutMembreDernière intervention20 janvier 2011 7 août 2007 à 17:23
Voilà, j’ai trouvé un bon petit début :
<?xml:namespace prefix o ns "urn:schemas-microsoft-com:office:office" /??>
Etape 1 – Chercher les différents process en cour
Public Declare Function EnumWindows& Lib "user32" (ByVal lpEnumFunc As Long, _
ByVal lParam As Long)
Public Declare Function GetWindowText Lib "user32" _
Alias "GetWindowTextA" (ByVal hwnd As Long, _
ByVal lpString As String, _
ByVal cch As Long) As Long
Public Declare Function GetClassName Lib "user32" Alias "GetClassNameA" (ByVal hwnd As Long, ByVal lpClassName As String, ByVal nMaxCount As Long) As Long
Public Declare Function GetWindow Lib "user32" (ByVal hwnd As Long, ByVal wFlag As Long) As Long
Public Declare Function GetWindowTextLength Lib "user32" Alias "GetWindowTextLengthA" (ByVal hwnd As Long) As Long
Public Declare Function GetDesktopWindow Lib "user32" () As Long
Public 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
Public Declare Function IsWindow Lib "user32" (ByVal hwnd As Long) As Long
' GetWindow() Constants
Const GW_HWNDFIRST = 0
Const GW_HWNDLAST = 1
Const GW_HWNDNEXT = 2
Const GW_HWNDPREV = 3
Const GW_OWNER = 4
Const GW_CHILD = 5
Const GW_MAX = 5
' SetWindowPos Flags
Const SWP_NOSIZE = &H1
Const SWP_NOMOVE = &H2
Const SWP_NOZORDER = &H4
Const SWP_NOREDRAW = &H8
Const SWP_NOACTIVATE = &H10
Const SWP_FRAMECHANGED = &H20 ' The frame changed: send WM_NCCALCSIZE
Const SWP_SHOWWINDOW = &H40
Const SWP_HIDEWINDOW = &H80
Const SWP_NOCOPYBITS = &H100
Const SWP_NOOWNERZORDER = &H200 ' Don't do owner Z ordering
' SetWindowPos() hwndInsertAfter values
Const HWND_TOP = 0
Const HWND_BOTTOM = 1
Const HWND_TOPMOST = -1
Const HWND_NOTOPMOST = -2
Public Sub GetWinHandles()
' permet de connaitre toutes les applications en cours