|
begin process at 2008 08 20 17:25:58
Derniers logiciels
|
Trouver une ressource (Nouvelle version du moteur, plus rapide & pertinent, essayez le !)
Vous ne trouvez pas de réponse à votre problème ? Alors posez la question dans le forum.
Souvenez-vous qu'il n'y a jamais de question bête, mais rester dans l'ignorance parce que l'on n'ose pas poser une question, ça c'est une erreur !
Sujet : Programme bloqué [ Archives / Au secours ] (goutbouyo)
|
Programme bloqué
le 30/10/2004 18:01:34

goutbouyo
Membre Club 
|
Salut, J'ai l'impression que mon programme se bloque au niveau d'un case WM_USER+1: J'ai ma dll : LRESULT CALLBACK kbdWinAmp(int nCode, WPARAM wParam, LPARAM lParam) { if(nCode >= 0) { //quand une fenetre est activé if(nCode == HCBT_ACTIVATE) //ACTIVATE { if (hDlg = FindWindow(g_val,NULL)) { if (Dlg=FindWindow(NULL,"Protection activée")) { PostMessage(Dlg, WM_USER+1, 0, 0); } } } } return CallNextHookEx(hhk, nCode, wParam, lParam); }
extern "C" __declspec(dllexport) int __stdcall Intercepte(char val[256]) { if(!hhk) { sprintf(g_val,"%s",val); hhk = SetWindowsHookEx(WH_CBT, kbdWinAmp, thismod, 0); }
return (int) hhk; }
extern "C" __declspec(dllexport) void __stdcall FinIntercepte() { if(hhk) { UnhookWindowsHookEx(hhk); hhk = 0; } }
|
Dans mon programme, je demande d'intercepter: //Bouton activer case IDC_ACTIVER: GetDlgItemText(hwnd,IDC_EDIT2,ligne2,sizeof ligne2); //récupère mot passe saisi //si mot de passe bon if (strcmp(ligne2,pass)==0) { MessageBox(NULL, "Mot de passe accepté\nProtection activée ", "Succés",MB_OK| MB_ICONINFORMATION);
if(!actif) actif = TRUE; Intercepte("Outlook Express Browser Class"); SetWindowText(hwnd,"Protection activée"); } else MessageBox(NULL, "Mot de passe erroné\nDésolé ...", "Erreur",MB_OK| MB_ICONWARNING); return TRUE;
|
Je traite le WM_USER+1 case WM_USER+1: FinIntercepte(); //arrête la recherche de la fenêtre MessageBox(NULL, "Mot de passe accepté\nProtection activée ", "Succés",MB_OK| MB_ICONINFORMATION); return TRUE;
|
Le problème c'est que la messagebox dans WM_USER+1 n'apparait que si outlook est là(normal) et squand je clique sur mon programme(pas normal...). Pouvez vous m'aider SVP ???
|
|
|
|
Re : Programme bloqué
le 30/10/2004 18:42:25
|
|
Re : Programme bloqué
le 30/10/2004 19:22:09
|
|
Re : Programme bloqué
le 30/10/2004 19:37:32

goutbouyo
Membre Club 
|
En fait ça vient encore de ma dll. Comme ça ça marche pas : #include <windows.h> #include <stdio.h>
#define WM_ALERTE (WM_USER+3) HINSTANCE thismod; HINSTANCE hInstance; HHOOK hhk; HWND hDlg; HWND Dlg; char g_val[256]; char val[256]; int debut;
BOOL WINAPI DllMain(HINSTANCE hDll, DWORD dwReason, LPVOID Reserved) { if(dwReason == DLL_PROCESS_ATTACH) thismod = hDll;
return 1; }
LRESULT CALLBACK kbdWinAmp(int nCode, WPARAM wParam, LPARAM lParam) { if(nCode >= 0) { //quand une fenetre est activé if(nCode == HCBT_ACTIVATE) //ACTIVATE { if (hDlg = FindWindow(g_val,NULL)) { if (Dlg = FindWindow(NULL,"Protection activée")) { PostMessage(Dlg, WM_ALERTE, 0, 0); } }
} } return CallNextHookEx(hhk, nCode, wParam, lParam); }
extern "C" __declspec(dllexport) int __stdcall Intercepte(char val[256]) { if(!hhk) { sprintf(g_val,"%s",val); hhk = SetWindowsHookEx(WH_CBT, kbdWinAmp, thismod, 0); } return (int) hhk; }
extern "C" __declspec(dllexport) void __stdcall FinIntercepte() { if(hhk) { UnhookWindowsHookEx(hhk); hhk = 0; } } Par contre là ça marche :
strcpy(g_val,"Outlook Express Browser Class"); if (hDlg = FindWindow(g_val,NULL));
|
|
|
|
|
Re : Programme bloqué
le 30/10/2004 23:20:16
|
|
Re : Programme bloqué
le 31/10/2004 02:07:19
|
|
Re : Programme bloqué
le 31/10/2004 02:36:28
|
|
Re : Programme bloqué
le 31/10/2004 02:40:28
|
|
Re : Programme bloqué
le 31/10/2004 10:31:06
|
|
Re : Programme bloqué
le 31/10/2004 11:44:49
|
Classé sous : programme, code, wm, mb, hhk
|
Téléchargements
Logiciels à télécharger sur le même thème :
|
|
|