Voici mon code
Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
Private Declare Function SendMessageByString Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As String) As Long
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
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
Private Declare Function SendMessageLong Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Private Declare Function SendNotifyMessage Lib "user32.dll" Alias "SendNotifyMessageA" (ByVal hwnd As Long, ByVal Msg As Long, wParam As Any, lParam As Any) As Long
Private Declare Sub Sleep Lib "kernel32.dll" (ByVal dwMilliseconds As Long)
Private Const WM_SETTEXT = &HC
Private Const WM_COMMAND = &H111
Private Const WM_NCLBUTTONDOWN = &HA1
Private Const WM_KEYDOWN = &H100
Private Const WM_KEYUP = &H101
Private Sub Command1_Click()
Dim dameware&
Dim mrccclass&
Dim appli&
Dim edit&
dameware& = FindWindow("MRCC_v7Class", vbNullString)
If dameware& = 0 Then
If MsgBox("L'application Dameware n'est pas encore lancé " & vbCrLf & vbCrLf & "Voullez Vous lancer l'application Dameware ?", vbYesNo + 32 + 0, "Confirmation !") = vbYes Then
Command3_Click
Else
MsgBox "Dameware n'est pas lancé! ", vbInformation, "Information !!!"
End If
Else
'mrccclass& = FindWindow("mrcc_class", vbNullString)
appli& = FindWindow("#32770", vbNullString)
edit& = FindWindowEx(appli&, ByVal 0&, "edit", vbNullString)
Call SendMessageByString(edit&, WM_SETTEXT, ByVal 0&, Text1)
edit& = FindWindowEx(appli&, edit&, "edit", vbNullString)
edit& = FindWindowEx(appli&, edit&, "edit", vbNullString)
Call SendMessageByString(edit&, WM_SETTEXT, ByVal 0&, Text2)
edit& = FindWindowEx(appli&, edit&, "edit", vbNullString)
Call SendMessageByString(edit&, WM_SETTEXT, ByVal 0&, Text3)
edit& = FindWindowEx(appli&, edit&, "edit", vbNullString)
Call SendMessageByString(edit&, WM_SETTEXT, ByVal 0&, Text4)
SendMessage appli&, WM_COMMAND, 32801, ByVal 0& '32801 handle connect
Me.WindowState = 1
End If
End Sub
sa marche tres bien avec windows XP mais sur windows 7 tous les SendMessageByString ne marche pas
une solution ???
+---------------------++ prog_sofiane ++---------------------+