Accueil > Forum > > > > probleme de compilation (débutant)
probleme de compilation (débutant)
lundi 23 mai 2005 à 19:00:28 |
probleme de compilation (débutant)

cddvdcopy
|
je suis débutant, merci de m'éclairer !! ce code marche : #include <windows.h> #define ID_SFC 100 #define ID_RECHERCHE 200 #define ID_EXIT 300 #define ID_PROPOS 400 /* Declare Windows procedure */ LRESULT CALLBACK WindowProcedure (HWND, UINT, WPARAM, LPARAM); /* Make the class name into a global variable */ char szClassName[ ] = "Windows App"; int WINAPI WinMain (HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPSTR lpszArgument, int nFunsterStil) { HWND hwnd; /* This is the handle for our window */ MSG messages; /* Here messages to the application are saved */ WNDCLASSEX wincl; /* Data structure for the windowclass */ /* The Window structure */ wincl.hInstance = hThisInstance; wincl.lpszClassName = szClassName; wincl.lpfnWndProc = WindowProcedure; /* This function is called by windows */ wincl.style = CS_DBLCLKS; /* Catch double-clicks */ wincl.cbSize = sizeof (WNDCLASSEX); /* Use default icon and mouse-pointer */ wincl.hIcon = LoadIcon (NULL, IDI_APPLICATION); wincl.hIconSm = LoadIcon (NULL, IDI_APPLICATION); wincl.hCursor = LoadCursor (NULL, IDC_ARROW); wincl.lpszMenuName = NULL; /* No menu */ wincl.cbClsExtra = 0; /* No extra bytes after the window class */ wincl.cbWndExtra = 0; /* structure or the window instance */ /* Use Windows's default color as the background of the window */ wincl.hbrBackground = (HBRUSH) COLOR_BACKGROUND; /* Register the window class, and if it fails quit the program */ if (!RegisterClassEx (&wincl)) return 0; /* The class is registered, let's create the program*/ hwnd = CreateWindowEx ( 0, /* Extended possibilites for variation */ szClassName, /* Classname */ "RepairWinXP", /* Title Text */ WS_OVERLAPPEDWINDOW, /* default window */ CW_USEDEFAULT, /* Windows decides the position */ CW_USEDEFAULT, /* where the window ends up on the screen */ 600, /* The programs width */ 400, /* and height in pixels */ HWND_DESKTOP, /* The window is a child-window to desktop */ NULL, /* No menu */ hThisInstance, /* Program Instance handler */ NULL /* No Window Creation data */ ); HWND sfc; HWND recherche; HWND quitter; HWND propos; sfc = CreateWindowEx(0, "BUTTON", NULL, WS_VISIBLE|WS_CHILD , 10,10, 350, 30, hwnd, (HMENU)ID_SFC, hThisInstance, NULL); recherche = CreateWindowEx(0, "BUTTON", NULL, WS_VISIBLE|WS_CHILD, 370, 10, 210, 30, hwnd, (HMENU)ID_RECHERCHE, hThisInstance, NULL); propos = CreateWindowEx(0, "BUTTON", NULL, WS_VISIBLE|WS_CHILD , 10, 330, 70, 30,hwnd, (HMENU) ID_PROPOS, hThisInstance, NULL); quitter= CreateWindowEx(0, "BUTTON", NULL, WS_VISIBLE|WS_CHILD ,90 ,330, 150,30,hwnd, (HMENU) ID_EXIT, hThisInstance , NULL); SetWindowText(sfc,"Restaurer Les fichiers système et les fichiers d'aide"); SetWindowText(recherche,"Retablir la fonction Rechercher"); SetWindowText(propos, "A propos"); SetWindowText(quitter, "Quitter RepairWinXP"); /* Make the window visible on the screen */ ShowWindow (hwnd, nFunsterStil); UpdateWindow(sfc); UpdateWindow(recherche); UpdateWindow(propos); UpdateWindow(quitter); /* Run the message loop. It will run until GetMessage() returns 0 */ while (GetMessage (&messages, NULL, 0, 0)) { /* Translate virtual-key messages into character messages */ TranslateMessage(&messages); /* Send message to WindowProcedure */ DispatchMessage(&messages); } /* The program return-value is 0 - The value that PostQuitMessage() gave */ return messages.wParam; } /* This function is called by the Windows function DispatchMessage() */ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { switch (message) /* handle the messages */ { case WM_DESTROY: PostQuitMessage (0); /* send a WM_QUIT to the message queue */ break; default: /* for messages that we don't deal with */ return DefWindowProc (hwnd, message, wParam, lParam); case WM_COMMAND : switch (LOWORD(wParam)) { case ID_EXIT : PostQuitMessage (0); break; case ID_PROPOS : MessageBox(NULL, " Merci d'utiliser RepairWinXP . \n Programme créé par griffin dans le but de vous faciliter WinXp" , "RepairWinXP", MB_OK); break; case ID_SFC : int box1 = MessageBox(NULL, " Voulez-vous vraiment rétablir \n les fichiers systèmes et les fichiers d'aide ? \n Veuillez inserer le CD de Windows XP pour continuer." , "RepairWinXP", MB_YESNO | MB_ICONINFORMATION ); if( box1 == IDYES ) { ShellExecute(NULL,NULL,"sfc","/scannow",NULL,SW_SHOWNORMAL); } break; } } return 0; }
mais des que je rajoute quelque chose et donc le code devient ca: #include <windows.h> #define ID_SFC 100 #define ID_RECHERCHE 200 #define ID_EXIT 300 #define ID_PROPOS 400 /* Declare Windows procedure */ LRESULT CALLBACK WindowProcedure (HWND, UINT, WPARAM, LPARAM); /* Make the class name into a global variable */ char szClassName[ ] = "Windows App"; int WINAPI WinMain (HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPSTR lpszArgument, int nFunsterStil) { HWND hwnd; /* This is the handle for our window */ MSG messages; /* Here messages to the application are saved */ WNDCLASSEX wincl; /* Data structure for the windowclass */ /* The Window structure */ wincl.hInstance = hThisInstance; wincl.lpszClassName = szClassName; wincl.lpfnWndProc = WindowProcedure; /* This function is called by windows */ wincl.style = CS_DBLCLKS; /* Catch double-clicks */ wincl.cbSize = sizeof (WNDCLASSEX); /* Use default icon and mouse-pointer */ wincl.hIcon = LoadIcon (NULL, IDI_APPLICATION); wincl.hIconSm = LoadIcon (NULL, IDI_APPLICATION); wincl.hCursor = LoadCursor (NULL, IDC_ARROW); wincl.lpszMenuName = NULL; /* No menu */ wincl.cbClsExtra = 0; /* No extra bytes after the window class */ wincl.cbWndExtra = 0; /* structure or the window instance */ /* Use Windows's default color as the background of the window */ wincl.hbrBackground = (HBRUSH) COLOR_BACKGROUND; /* Register the window class, and if it fails quit the program */ if (!RegisterClassEx (&wincl)) return 0; /* The class is registered, let's create the program*/ hwnd = CreateWindowEx ( 0, /* Extended possibilites for variation */ szClassName, /* Classname */ "RepairWinXP", /* Title Text */ WS_OVERLAPPEDWINDOW, /* default window */ CW_USEDEFAULT, /* Windows decides the position */ CW_USEDEFAULT, /* where the window ends up on the screen */ 600, /* The programs width */ 400, /* and height in pixels */ HWND_DESKTOP, /* The window is a child-window to desktop */ NULL, /* No menu */ hThisInstance, /* Program Instance handler */ NULL /* No Window Creation data */ ); HWND sfc; HWND recherche; HWND quitter; HWND propos; sfc = CreateWindowEx(0, "BUTTON", NULL, WS_VISIBLE|WS_CHILD , 10,10, 350, 30, hwnd, (HMENU)ID_SFC, hThisInstance, NULL); recherche = CreateWindowEx(0, "BUTTON", NULL, WS_VISIBLE|WS_CHILD, 370, 10, 210, 30, hwnd, (HMENU)ID_RECHERCHE, hThisInstance, NULL); propos = CreateWindowEx(0, "BUTTON", NULL, WS_VISIBLE|WS_CHILD , 10, 330, 70, 30,hwnd, (HMENU) ID_PROPOS, hThisInstance, NULL); quitter= CreateWindowEx(0, "BUTTON", NULL, WS_VISIBLE|WS_CHILD ,90 ,330, 150,30,hwnd, (HMENU) ID_EXIT, hThisInstance , NULL); SetWindowText(sfc,"Restaurer Les fichiers système et les fichiers d'aide"); SetWindowText(recherche,"Retablir la fonction Rechercher"); SetWindowText(propos, "A propos"); SetWindowText(quitter, "Quitter RepairWinXP"); /* Make the window visible on the screen */ ShowWindow (hwnd, nFunsterStil); UpdateWindow(sfc); UpdateWindow(recherche); UpdateWindow(propos); UpdateWindow(quitter); /* Run the message loop. It will run until GetMessage() returns 0 */ while (GetMessage (&messages, NULL, 0, 0)) { /* Translate virtual-key messages into character messages */ TranslateMessage(&messages); /* Send message to WindowProcedure */ DispatchMessage(&messages); } /* The program return-value is 0 - The value that PostQuitMessage() gave */ return messages.wParam; } /* This function is called by the Windows function DispatchMessage() */ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { switch (message) /* handle the messages */ { case WM_DESTROY: PostQuitMessage (0); /* send a WM_QUIT to the message queue */ break; default: /* for messages that we don't deal with */ return DefWindowProc (hwnd, message, wParam, lParam); case WM_COMMAND : switch (LOWORD(wParam)) { case ID_EXIT : PostQuitMessage (0); break; case ID_PROPOS : MessageBox(NULL, " Merci d'utiliser RepairWinXP . \n Programme créé par griffin dans le but de vous faciliter WinXp" , "RepairWinXP", MB_OK); break; case ID_SFC : int box1 = MessageBox(NULL, " Voulez-vous vraiment rétablir \n les fichiers systèmes et les fichiers d'aide ? \n Veuillez inserer le CD de Windows XP pour continuer." , "RepairWinXP", MB_YESNO | MB_ICONINFORMATION ); if( box1 == IDYES ) { ShellExecute(NULL,NULL,"sfc","/scannow",NULL,SW_SHOWNORMAL); } break; case ID_RECHERCHE : int box = MessageBox(NULL, " Voulez-vous vraiment rétablir la fonction Rechercher ?" , "RepairWinXP", MB_YESNO | MB_ICONINFORMATION ); if( box == IDYES ) { ShellExecute(NULL,NULL,"regsvr32","%systemroot%\\srchasst\\srchui.dll",NULL,SW_SHOWNORMAL); } break; } } return 0; } merci de vous pencher dessus
|
|
lundi 23 mai 2005 à 19:04:59 |
oups

cddvdcopy
|
excusez moi mais j'ai oublier de préciser que le 2eme code ne voulait pas se compiler
|
|
lundi 23 mai 2005 à 19:12:05 |
Re : probleme de compilation (débutant)

DeAtHCrAsH
|
Dis nous exactement qu'elle est le bout de code que tu as ajouté ca sera plus simple parceque la ca fait beaucoup a lire.
Shell
|
|
lundi 23 mai 2005 à 19:20:04 |
Re : probleme de compilation (débutant)

cddvdcopy
|
voila le code que jai rajouté case ID_RECHERCHE : int box = MessageBox(NULL, " Voulez-vous vraiment rétablir la fonction Rechercher ?" , "RepairWinXP", MB_YESNO | MB_ICONINFORMATION ); if( box == IDYES ) { ShellExecute(NULL,NULL,"regsvr32","%systemroot%\\srchasst\\srchui.dll",NULL,SW_SHOWNORMAL); } break; juste apres : case ID_SFC : int box1 = MessageBox(NULL, " Voulez-vous vraiment rétablir \n les fichiers systèmes et les fichiers d'aide ? \n Veuillez inserer le CD de Windows XP pour continuer." , "RepairWinXP", MB_YESNO | MB_ICONINFORMATION ); if( box1 == IDYES ) { ShellExecute(NULL,NULL,"sfc","/scannow",NULL,SW_SHOWNORMAL); } break;
|
|
lundi 23 mai 2005 à 19:48:23 |
Re : probleme de compilation (débutant)

DeAtHCrAsH
|
Réponse acceptée !
Yep, Bon je t'explique tes erreurs: box1 et box ne doivent pas être déclarées dans les case. Mets les soit en globales, soit au debut de ta fonction, juste avant le premier switch. Sinon voila le code corrigé et indenté correctement: #include <windows.h> #define ID_SFC 100 #define ID_RECHERCHE 200 #define ID_EXIT 300 #define ID_PROPOS 400 /* Declare Windows procedure */ LRESULT CALLBACK WindowProcedure (HWND, UINT, WPARAM, LPARAM); /* Make the class name into a global variable */ char szClassName[ ] = "Windows App"; int WINAPI WinMain (HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPSTR lpszArgument, int nFunsterStil) { HWND hwnd; /* This is the handle for our window */ MSG messages; /* Here messages to the application are saved */ WNDCLASSEX wincl; /* Data structure for the windowclass */ /* The Window structure */ wincl.hInstance = hThisInstance; wincl.lpszClassName = szClassName; wincl.lpfnWndProc = WindowProcedure; /* This function is called by windows */ wincl.style = CS_DBLCLKS; /* Catch double-clicks */ wincl.cbSize = sizeof (WNDCLASSEX); /* Use default icon and mouse-pointer */ wincl.hIcon = LoadIcon (NULL, IDI_APPLICATION); wincl.hIconSm = LoadIcon (NULL, IDI_APPLICATION); wincl.hCursor = LoadCursor (NULL, IDC_ARROW); wincl.lpszMenuName = NULL; /* No menu */ wincl.cbClsExtra = 0; /* No extra bytes after the window class */ wincl.cbWndExtra = 0; /* structure or the window instance */ /* Use Windows's default color as the background of the window */ wincl.hbrBackground = (HBRUSH) COLOR_BACKGROUND; /* Register the window class, and if it fails quit the program */ if (!RegisterClassEx (&wincl)) return 0; /* The class is registered, let's create the program*/ hwnd = CreateWindowEx ( 0, /* Extended possibilites for variation */ szClassName, /* Classname */ "RepairWinXP", /* Title Text */ WS_OVERLAPPEDWINDOW, /* default window */ CW_USEDEFAULT, /* Windows decides the position */ CW_USEDEFAULT, /* where the window ends up on the screen */ 600, /* The programs width */ 400, /* and height in pixels */ HWND_DESKTOP, /* The window is a child-window to desktop */ NULL, /* No menu */ hThisInstance, /* Program Instance handler */ NULL /* No Window Creation data */ ); HWND sfc; HWND recherche; HWND quitter; HWND propos; sfc = CreateWindowEx(0, "BUTTON", NULL, WS_VISIBLE|WS_CHILD , 10,10, 350, 30, hwnd, (HMENU)ID_SFC, hThisInstance, NULL); recherche = CreateWindowEx(0, "BUTTON", NULL, WS_VISIBLE|WS_CHILD, 370, 10, 210, 30, hwnd, (HMENU)ID_RECHERCHE, hThisInstance, NULL); propos = CreateWindowEx(0, "BUTTON", NULL, WS_VISIBLE|WS_CHILD , 10, 330, 70, 30,hwnd, (HMENU) ID_PROPOS, hThisInstance, NULL); quitter= CreateWindowEx(0, "BUTTON", NULL, WS_VISIBLE|WS_CHILD ,90 ,330, 150,30,hwnd, (HMENU) ID_EXIT, hThisInstance , NULL); SetWindowText(sfc,"Restaurer Les fichiers système et les fichiers d'aide"); SetWindowText(recherche,"Retablir la fonction Rechercher"); SetWindowText(propos, "A propos"); SetWindowText(quitter, "Quitter RepairWinXP"); /* Make the window visible on the screen */ ShowWindow (hwnd, nFunsterStil); UpdateWindow(sfc); UpdateWindow(recherche); UpdateWindow(propos); UpdateWindow(quitter); /* Run the message loop. It will run until GetMessage() returns 0 */ while (GetMessage (&messages, NULL, 0, 0)) { /* Translate virtual-key messages into character messages */ TranslateMessage(&messages); /* Send message to WindowProcedure */ DispatchMessage(&messages); } /* The program return-value is 0 - The value that PostQuitMessage() gave */ return messages.wParam; } /* This function is called by the Windows function DispatchMessage() */ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { int box, box1; switch (message) /* handle the messages */ { case WM_DESTROY: PostQuitMessage (0); /* send a WM_QUIT to the message queue */ break; default: /* for messages that we don't deal with */ return DefWindowProc (hwnd, message, wParam, lParam); case WM_COMMAND : switch (LOWORD(wParam)) { case ID_EXIT : PostQuitMessage (0); break; case ID_PROPOS : MessageBox(NULL, " Merci d'utiliser RepairWinXP . \n Programme créé par griffin dans le but de vous faciliter WinXp" , "RepairWinXP", MB_OK); break; case ID_SFC : box1 = MessageBox(NULL, " Voulez-vous vraiment rétablir \n les fichiers systèmes et les fichiers d'aide ? \n Veuillez inserer le CD de Windows XP pour continuer." , "RepairWinXP", MB_YESNO | MB_ICONINFORMATION ); if( box1 == IDYES ) { ShellExecute(NULL,NULL,"sfc","/scannow",NULL,SW_SHOWNORMAL); } break; case ID_RECHERCHE : box = MessageBox(NULL, " Voulez-vous vraiment rétablir la fonction Rechercher ?" , "RepairWinXP", MB_YESNO | MB_ICONINFORMATION ); if( box == IDYES ) { ShellExecute(NULL,NULL,"regsvr32","%systemroot%\\srchasst\\srchui.dll",NULL,SW_SHOWNORMAL); } break; } break; } return 0; } Shell
|
|
lundi 23 mai 2005 à 19:59:25 |
merci

cddvdcopy
|
encore merci pour ta réponse qui marche et pour ta rapidité
|
|
lundi 23 mai 2005 à 20:02:44 |
Re : probleme de compilation (débutant)
|
Cette discussion est classée dans : messages, id, wincl, hwnd, window
Répondre à ce message
Sujets en rapport avec ce message
Je debute: [ par phpman ]
Bonjour,je debute avec devc++, quand je creer un nouveau projet il me génère le code d'une form windows:#include /* Declare Windows procedure */LRESUL
Problème d'initailisation objet IDirect3DDevice9 [ par olivierpot2 ]
Bonjour à tous,je débutes en c++ directx et j'avoue que j'ai un peu (beaucoup) de mal...Dans le code suivant je n'arrives pas à initilalisé la variabl
siouplait la charite pour un pov newbie [ par seichettmorru ]
je compile, ca marcheje lance ca me dit "impossible de communiquer avec la carte"j'ai une geforce ti+directx 8.vous etes mon dernier recours:#include
Application [ par Arnauti ]
Bonjour, je suis nul et j'ai presque jamais fait de C/C++. Enfin, si quelque truc sous dos. Mais j'aimerais créé une aplication mais pas sous dos. Al
insertion d'une phrase [ par chinois57 ]
ou doige mettre une phrase du style sa va#include /* Declare Windows procedure */LRESULT CALLBACK WindowProcedure (HWND, UINT, WPARAM, LPARAM); /*
tjr aide applications windows [ par chinois57 ]
je suis desoler de denouveau vous enbeteer avec sa mais je ne comprend pas comment afficher un message dans une fenetre windows applicatios j'utilise
C++ windows [ par notour ]
bonjourj'ai réalyser un programme de cryptage de texte sous page DOS mais pour des raison pratique je souh
couleur fond appli win32 [ par fredsor ]
Salu a vous,Je créé une appli win32 sous devc++ en C.Je créé la fenetre avec CreateWindow, et j'aimerais que le fond soit blanc. Or l'appli se met dés
probleme bizzare.... [ par lektrosonic ]
Bonsoir, j ai code ce client...Code C:#include #include #include #define ID_CONNECT 1#define ID_SEND 2#define WM_SOCKET (WM_APP + 100)<br
Traduction en FR programme en fenetre devc++ [ par toto6311 ]
[code=cpp]#include /* Declare Windows procedure */ LRESULT CALLBACK WindowProcedure (HWND, UINT, WPARAM, LPARAM); /* Faites le nom de la class
Livres en rapport
|
Derniers Blogs
COMMENT MAPPER UNE VUE SQL SUR UNE COLLECTION DE COMPLEX TYPE?COMMENT MAPPER UNE VUE SQL SUR UNE COLLECTION DE COMPLEX TYPE? par Matthieu MEZIL
Avec EF, les vues doivent être mappées sur des entity types. Le problème c'est que les entity types doivent avoir une clé. Avec EF, nous avons les complex type qui n'ont pas de clé mais les vues ne peuvent pas être mappées dessus. Avec EF4, il est possibl...
Cliquez pour lire la suite de l'article par Matthieu MEZIL [WF4] UN BINDING ACTIVITY/ACTIVITYDESIGNER QUI PASSE MAL?[WF4] UN BINDING ACTIVITY/ACTIVITYDESIGNER QUI PASSE MAL? par JeremyJeanson
Certain d'entre vous on peut être vécu cette situation embarrassante après quelques temps passer avec WF4 : Au début avec mon " ActivityDesigner" , tout allait bien. Et puis un jour j'ai au des problèmes de " Binding" . Alors nous sommes allé sur le site ...
Cliquez pour lire la suite de l'article par JeremyJeanson MYTIC - SHAREPOINT 2010 : DéJà UN MYTHE MICROSOFT ?MYTIC - SHAREPOINT 2010 : DéJà UN MYTHE MICROSOFT ? par junarnoalg
La prochaine session de MyTIC aura lieu à Namur, le 23 mars prochain. Pendant presque une heure, nous parlerons de SharePoint 2010. Voici un aperçu du programme.
Accueil : 17h30 Début de la session : 18h00 - Les nouvelles int...
Cliquez pour lire la suite de l'article par junarnoalg
Forum
ERREUR DE POINTEURERREUR DE POINTEUR par africanwinners
Cliquez pour lire la suite par africanwinners CLISTCTRLCLISTCTRL par dorras7
Cliquez pour lire la suite par dorras7
Logiciels
Academy System (10.9.4.0)ACADEMY SYSTEM (10.9.4.0)Logiciel de gestion des établissements.
- élèves/étudiants (inscription, dossier, absence...)
-... Cliquez pour télécharger Academy System Xilisoft Convertisseur Vidéo Ultimate (5.1.39.0305)XILISOFT CONVERTISSEUR VIDéO ULTIMATE (5.1.39.0305)Xilisoft Convertisseur Vidéo Ultimate est un outil puissant de conversion vidéo, facile à utilise... Cliquez pour télécharger Xilisoft Convertisseur Vidéo Ultimate Xilisoft DVD Ripper Ultimate (5.0.64.0304)XILISOFT DVD RIPPER ULTIMATE (5.0.64.0304)Xilisoft DVD Ripper Ultimate est un logiciel excellent pour copier et convertir DVD vers presque ... Cliquez pour télécharger Xilisoft DVD Ripper Ultimate Rigs of Rods (63.3)RIGS OF RODS (63.3)c'est un jeu de multi-simulation camions,autobus voitures, avions, bateaux, hélicoptère avec défo... Cliquez pour télécharger Rigs of Rods
|