HELP ME PLEASE!!!! PROBLEME KE JE NE COMPRENDS PAS!!!!!!!

cs_bouba Messages postés 518 Date d'inscription dimanche 2 décembre 2001 Statut Membre Dernière intervention 10 novembre 2007 - 20 févr. 2003 à 17:36
cedb002 Messages postés 151 Date d'inscription jeudi 27 février 2003 Statut Membre Dernière intervention 15 juin 2003 - 27 févr. 2003 à 17:36
Bonjour, je rencontre un gros problème dans mon programme que je n'arrive pas a résoudre,
je ne comprends vraiment pas!!!

1. std::string strcat2(LPSTR chaine1,LPSTR chaine2,LPSTR chaine3)
2. {
3. std::string temp;
4. temp = chaine1;
5. temp.append(chaine2);
6. temp.append(chaine3);
7. return temp;
8. }
9.
10. LRESULT CALLBACK WndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
11. {
12. switch(uMsg)
13. {
14. case WM_CREATE:
15. ................................
16. ................................
17.
18. SetProp(hWnd,"Title",(HANDLE)"Texteditor version 1.0");
19. break;
20.
21. case WM_COMMAND:
22. switch(LOWORD(wParam))
23. {
24. case FICHIER_OUVRIR:
25. SetProp(hWnd,"Path",(HANDLE)(char*)OuvrirFichier(hWnd).c_str());
26. SetProp(hWnd,"EstSauvegarde",(HANDLE)true);
27. MessageBoxEx(NULL,(char*)GetProp(hWnd,"Path"),"Error",MB_OK|MB_ICONERROR,0x040c);
28. SetProp(hWnd,"TitlePathEtoile",
29. (HANDLE)strcat2((const char*)GetProp(hWnd,"Title"),(const char*)GetProp(hWnd,"Path"),"").c_str());
30. MessageBoxEx(NULL,(char*)GetProp(hWnd,"Path"),"Error",MB_OK|MB_ICONERROR,0x040c);
31. MessageBoxEx(NULL,(char*)GetProp(hWnd,"Title"),"Error",MB_OK|MB_ICONERROR,0x040c);
32. SetWindowText(hWnd,(char*)GetProp(hWnd,"TitlePathEtoile"));
33. break;
34. .............
35. }
36. ........
37. }
38. }

Voila, a la ligne 26 je défini une nouvelle propriété pour ma fenêtre, ensuite a la ligne 27
pour vérifier si c ok j'affiche cette propriété, ici pas de problème, le chemin que jé souhaitais
s'affiche correctement.
Voici ce qui s'affiche:
C:\Documents and Settings\Baptiste Gaillard\Mes documents\C++\Borland\Windows\texteditor\texteditor.exe

Mais le problème vient ensuite, a la ligne 28,29 je définie une autre propriété qui me permettra
dévoir une chaine de caractère en regroupant trois autres. Et la je ne comprends vraiment pas,
a la ligne 30 j'affiche la propriété "Path", elle a changé!!!! Voici ce qui s'affiche:
Texteditore version 1.(

Et bien sûr "TitlePathEtoile" est elle aussi incorrecte!!!
Voici ce qui s'affiche:
Texteditore version 1.(

Merci de m'expliquer pourquoi j'ai ce problème, et bien sûr si possible trouver quelque
chose pour obtenir l'effet souhaité.

1 réponse

cedb002 Messages postés 151 Date d'inscription jeudi 27 février 2003 Statut Membre Dernière intervention 15 juin 2003 1
27 févr. 2003 à 17:36
vérifie le handle
0
Rejoignez-nous