PB avec CreateWindow ?!

ElectricalMan Messages postés 39 Date d'inscription samedi 20 mars 2004 Statut Membre Dernière intervention 5 novembre 2008 - 30 oct. 2008 à 11:55
lectpe Messages postés 162 Date d'inscription lundi 12 novembre 2007 Statut Membre Dernière intervention 17 juillet 2010 - 20 août 2009 à 15:08
 Bjr, J'ai l'impression que j'ai un probleme avec CreateWindow, car je n'arrive pas à afficher dans la fenêtre principale un objet "edit", "bouton" et autres.
 J'ai tout essayé, y'a rien qui s'affiche :(

Avez vous des suggestions ?!

Merci d'avance.

HWND boutim;
HBITMAP hBmp;

HWND hWndEdit;
HANDLE hImg;

...

case WM_CREATE:
   //hBmp = LoadBitmap(hInst,(LPCWSTR)"IDB_BITMAP1");

   //hBmp = LoadBitmap(hInst,MAKEINTRESOURCE(IDB_BITMAP1));

   hImg = LoadImage(hInst, MAKEINTRESOURCE(IDB_BITMAP1), IMAGE_BITMAP, 0, 0, 0);

   if

(!hImg){ 
      MessageBox(NULL, (LPCWSTR)
"Chargement des îcones", (LPCWSTR)"Erreur", 0); 
      return
NULL; 
   }   boutim = CreateWindow((LPCWSTR)
"button", 
                                                            NULL, WS_CHILD | WS_VISIBLE | SS_BITMAP, 
                                             50, 50, 300, 225, 
                       hWnd, 0, hInst, NULL);

   SendMessage(boutim,STM_SETIMAGE,IMAGE_BITMAP,(LPARAM)hImg); // hBmp

   /*hWndEdit = CreateWindow((LPCWSTR)"EDIT", // We are creating an Edit control 
                                                      NULL, // Leave the control empty 
                                                      WS_CHILD | WS_VISIBLE | WS_HSCROLL | 
                                                      WS_VSCROLL | ES_LEFT | ES_MULTILINE | 
                                                      ES_AUTOHSCROLL | ES_AUTOVSCROLL, 
                                                      0, 0, 0, 0, // Let the WM_SIZE messge below take care of the size 
                                                      hWnd, 
                                                      0,   
                                                      hInst, 
                                                      NULL);*/ 
               break
;

/*case WM_SETFOCUS: 
   SetFocus(hWndEdit); 
      break;

case WM_SIZE: 
      MoveWindow(hWndEdit, 0, 0, LOWORD(lParam), HIWORD(lParam), TRUE); 
      break;*/

...

1 réponse

lectpe Messages postés 162 Date d'inscription lundi 12 novembre 2007 Statut Membre Dernière intervention 17 juillet 2010 3
20 août 2009 à 15:08
Bonjour.

Bah déjà, tu crées un champ avec comme dimensions 0x0 que tu redimensionnes à la bonne taille dans le WM_SIZE.

Là, tu y a mis en commentaires. Je ne sais pas si c'est la même chose dans ton programme, mais si c'est le cas, enlèves juste les /* et */ de commentaires.

Cordialement, Grégory.
0
Rejoignez-nous