A l'ouverture, WLM demandera les mots de passe, il suffira de lancer ce code, le programme est prévu pour s'arrêter au bout de deux minutes mais c'est configurable.
Ensuite si vous ne fermez pas WLM, il ne redemandera plus les mots de passe jusqu'àu prochain lancement.
Maintenant, c'est nickel!

Code du logiciel Mail (A compiler en mode unicode):
Code : Tout sélectionner
Prog.s = "_mail_"
SetLastError_(#NO_ERROR)
Global hMutex.i = CreateMutex_(#Null, #False, @Prog)
Erreur.l = GetLastError_()
If(Erreur = #ERROR_ALREADY_EXISTS) Or (Erreur = #ERROR_ACCESS_DENIED)
MessageRequester("Info", "Vous ne pouvez lancer qu'une seule instance du programme: mail.exe")
End
EndIf
Structure mail
Login.s
MotdePasse.s
EndStructure
Global Dim mail.mail(10), nbLogin.l
nbLogin = 1 ; Nombre de compte ( pensez à le modifier)
mail(0)\Login = "nico" ; ici c'est le nom du compte, tel qu'il apparait dans WLM (dans le Treeview)
mail(0)\MotdePasse = "Password" ; mot de passe du compte
#KEYEVENTF_UNICODE = 4
Procedure SendInput(Text.s)
Protected j.l, k.l, *char.UNICODE, Dim SendInputData.INPUT(0)
k = Len(Text) * 2
If k
ReDim SendInputData(k)
For j = 0 To k - 2 Step 2
*char = @Text + j
SendInputData(j)\type = #INPUT_KEYBOARD
SendInputData(j)\ki\wVk = 0
SendInputData(j)\ki\dwExtraInfo = 0
SendInputData(j)\ki\dwFlags = #KEYEVENTF_UNICODE
SendInputData(j)\ki\time = 0
SendInputData(j)\ki\wScan = *char\u
SendInputData(j + 1)\Type = #INPUT_KEYBOARD
SendInputData(j + 1)\ki\wVk = 0
SendInputData(j + 1)\ki\dwExtraInfo = 0
SendInputData(j + 1)\ki\dwFlags = #KEYEVENTF_UNICODE | #KEYEVENTF_KEYUP
SendInputData(j + 1)\ki\time = 0
SendInputData(j + 1)\ki\wScan = *char\u
Next j
SendInput_(k, SendInputData(0), SizeOf(INPUT))
EndIf
EndProcedure
Procedure KeyCombi(Ctrl.l, Alt.l, Shift.l, key.a)
Protected Extended.l = 0, Scan.l, Scancode.w, j.l = -1, Nb.l
Protected Dim SendInputData.INPUT(0)
If MapVirtualKey_(key, 2) = 0 ; MAPVK_VK_TO_CHAR=2
Extended.l = #KEYEVENTF_EXTENDEDKEY
; get scan code
Scan.l = MapVirtualKey_(key, 0) ; MAPVK_VK_TO_VSC=0
Scancode.w = Scan & $FFFF
Else
Extended = 0
Scancode = 0
EndIf
Nb = (Ctrl + Alt + Shift) * 2
If Key
Nb = Nb + 2
EndIf
ReDim SendInputData.INPUT(Nb)
If Ctrl
j = j + 1
SendInputData(j)\type = #INPUT_KEYBOARD
SendInputData(j)\ki\wVk = #VK_CONTROL
SendInputData(j)\ki\dwExtraInfo = 0
SendInputData(j)\ki\dwFlags = 0
SendInputData(j)\ki\time = 0
SendInputData(j)\ki\wScan = 0
EndIf
If Alt
j = j + 1
SendInputData(j)\type = #INPUT_KEYBOARD
SendInputData(j)\ki\wVk = #VK_MENU
SendInputData(j)\ki\dwExtraInfo = 0
SendInputData(j)\ki\dwFlags = 0
SendInputData(j)\ki\time = 0
SendInputData(j)\ki\wScan = 0
EndIf
If Shift
j = j + 1
SendInputData(j)\type = #INPUT_KEYBOARD
SendInputData(j)\ki\wVk = #VK_SHIFT
SendInputData(j)\ki\dwExtraInfo = 0
SendInputData(j)\ki\dwFlags = 0
SendInputData(j)\ki\time = 0
SendInputData(j)\ki\wScan = 0
EndIf
If Key
j = j + 1
SendInputData(j)\type = #INPUT_KEYBOARD
SendInputData(j)\ki\wVk = Key
SendInputData(j)\ki\dwExtraInfo = 0
SendInputData(j)\ki\dwFlags = Extended
SendInputData(j)\ki\time = 0
SendInputData(j)\ki\wScan = Scancode
j = j + 1
SendInputData(j)\Type = #INPUT_KEYBOARD
SendInputData(j)\ki\wVk = Key
SendInputData(j)\ki\dwExtraInfo = 0
SendInputData(j)\ki\dwFlags = #KEYEVENTF_KEYUP | Extended
SendInputData(j)\ki\time = 0
SendInputData(j)\ki\wScan = Scancode
EndIf
If Shift
j = j + 1
SendInputData(j)\type = #INPUT_KEYBOARD
SendInputData(j)\ki\wVk = #VK_SHIFT
SendInputData(j)\ki\dwExtraInfo = 0
SendInputData(j)\ki\dwFlags = #KEYEVENTF_KEYUP
SendInputData(j)\ki\time = 0
SendInputData(j)\ki\wScan = 0
EndIf
If Alt
j = j + 1
SendInputData(j)\type = #INPUT_KEYBOARD
SendInputData(j)\ki\wVk = #VK_MENU
SendInputData(j)\ki\dwExtraInfo = 0
SendInputData(j)\ki\dwFlags = #KEYEVENTF_KEYUP
SendInputData(j)\ki\time = 0
SendInputData(j)\ki\wScan = 0
EndIf
If Ctrl
j = j + 1
SendInputData(j)\type = #INPUT_KEYBOARD
SendInputData(j)\ki\wVk = #VK_CONTROL
SendInputData(j)\ki\dwExtraInfo = 0
SendInputData(j)\ki\dwFlags = #KEYEVENTF_KEYUP
SendInputData(j)\ki\time = 0
SendInputData(j)\ki\wScan = 0
EndIf
SendInput_(Nb, SendInputData(0), SizeOf(INPUT))
EndProcedure
Procedure Traitement(lparam.i)
Protected compte.s, TempsDepart.l
TempsDepart = ElapsedMilliseconds()
Repeat
For a = 0 To nbLogin-1
hwnd = FindWindowEx_(0,0,"#32770","Ouverture de session - "+mail(a)\Login)
If hwnd <> 0
If compte <> mail(a)\Login
compte = mail(a)\Login
SetForegroundWindow_(hwnd)
Delay(50)
SendInput(mail(a)\MotdePasse)
Delay(50)
KeyCombi(0, 0, 0, #VK_RETURN)
EndIf
EndIf
Next
Delay(500)
Until ElapsedMilliseconds() - TempsDepart > 2 * 60000 ; (Correspond à 2 minutes)
PostMessage_(WindowID(0), #PB_Event_CloseWindow, 0, 0) ; (Après 2 minutes, le programme se ferme tout seul)
EndProcedure
If OpenWindow(0, 0, 0, 800, 400, "Info", #PB_Window_ScreenCentered |#PB_Window_SystemMenu | #PB_Window_Invisible)
If CreatePopupMenu(10)
MenuItem(11, "Quitter")
EndIf
AddSysTrayIcon(1, WindowID(0), CatchImage(0, ?Icon))
Thread.i = CreateThread(@Traitement(), 0)
Repeat
event = WaitWindowEvent()
Select event
Case #PB_Event_SysTray
Select EventType()
Case #PB_EventType_RightClick
DisplayPopupMenu(10, WindowID(0))
EndSelect
Case #PB_Event_Menu
Select EventMenu()
Case 11
Quit = 1
EndSelect
Case #PB_Event_CloseWindow
quit = 1
EndSelect
Until quit = 1
EndIf
CloseHandle_(hMutex)
DataSection
Icon:
IncludeBinary "mail.ico"
EndDataSection