ebooserge
Messages postés
137
Date d'inscription
lundi 13 décembre 2004
Statut
Membre
Dernière intervention
16 juillet 2007
1
21 sept. 2005 à 20:21
en choisissant tout simplement win32 en projet, je prend le code d'une fenetre sans aucun contenu qui marche bien avec devcpp.
mais quand je retape ce meme code sous vc++ 2005, il me donne l'erreur ci dessous:
1>j:\projet\c++\fmp\fmp\main.cpp(82) : fatal error C1010: unexpected end of file while looking for precompiled header. Did you forget to add '#include "stdafx.h"' to your source?
voici mon code tout simple:
#include <windows.h>
HINSTANCE hInstance;
HWND mainWindow;
LRESULT CALLBACK WindowProcedure(HWND,UINT,WPARAM,LPARAM);
int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
MSG message;
WNDCLASSEX wincl;
hInstance = hInst;
wincl.hIcon = LoadIcon(NULL, hInstance);
wincl.hIconSm = LoadIcon(NULL, hInstance);
wincl.hCursor = LoadCursor(NULL,IDC_ARROW);
wincl.cbSize = sizeof(WNDCLASSEX);
wincl.style = CS_HREDRAW | CS_VREDRAW;
wincl.hInstance = hInstance;
wincl.lpfnWndProc = WindowProcedure;
wincl.lpszClassName = "window";
wincl.lpszMenuName = NULL;
wincl.hbrBackground = CreateSolidBrush(RGB(192,192,192));
wincl.cbClsExtra = 0;
wincl.cbWndExtra = 0;
if(!RegisterClassEx(&wincl))
return 0;
mainWindow = CreateWindowEx(0,"window","Alternative VLC",WS_SYSMENU,100,100,500,100,HWND_DESKTOP,NULL,hInstance,NULL);
ShowWindow(mainWindow, nCmdShow);
while(GetMessage(&message,NULL,0,0))
{
TranslateMessage(&message);
DispatchMessage(&message);
}//while(GetMessage(&message,NULL,0,0))
return message.wParam;
}
LRESULT CALLBACK WindowProcedure(HWND fenetre, UINT message, WPARAM wParam, LPARAM lParam)
{
switch(message)
{
case WM_CLOSE:
{
SendMessage(fenetre,WM_DESTROY,0,0); break;}//if(quit==IDYES)
break;
}
case WM_DESTROY:
{ PostQuitMessage(0); break;}
default:
{ return DefWindowProc(fenetre,message,wParam,lParam);}
}//switch(message)
}