Une petite technique pour communiquer avec la préinstance
Tu mets un text invisible dans ta form (TextedeCommunication)
Tu récupères TextedeCommunication.hwnd et le place dans la base de registre ou dans un ini au démarrage de l'appli.
Private Sub TextTransitoire_Change()
msgbox("jai eu un enfant" )
End sub
et pis quand tu démarres la second application tu récupères le hwnd de l'application (Lehwnd) dans la base de registre ou l'ini
et tu envois
SendMessage Lehwnd, &HC, 0, ByVal "Coucou maman"
dont voilà la déclaration à faire avant
Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
récapitlatif:
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 Sub Form_Load()
If App.PrevInstance Then
SendMessage GetSetting(App.EXEName, "Hwnd", "TextedeCommunication" ), &HC, 0, ByVal "Coucou maman"
End
End If
SaveSetting App.EXEName, "Hwnd", "TextedeCommunication", TextedeCommunication.hwnd
End Sub
Private Sub TextedeCommunication_Change()
MsgBox ("jai eu un enfant" )
End Sub
si tu prends les précautions de rigueur ça doit rouler
Bonne chance pour ton prog