Usamos cookies para medir audiência e melhorar sua experiência. Você pode aceitar ou recusar a qualquer momento. Veja sobre o iMasters.
Pessoal alguem poderia me ajudar estou tentando criar uma janela pra window em C no Dev-C++ porem nao estou conseguindo compilar e nao consigo encontrar o erro.
Aqui esta o programa:
#include <windows.h>
LRESULT CALLBACK WindowProcedure(HWND, UINT, WPARAM, LPARAM);
char szWinName[ ]="MinhaJan";
int WINAPI WinMain (HINSTANCE hThisInst, HINSTANCE hPrevInst,
LPSTR lpszArgs, int nWinMode)
{
HWND hWnd;
MSG msg;
WNDCLASSEX wcl;
wcl.hInstance =hThisInst;
wcl.lpszClassName = szWinName;
wcl.lpfnWndProc = WindowProcedure;
wcl.style = CS_DBLCLKS;
wcl.cbSize = sizeof (WNDCLASSEX);
wcl.hIcon= LoadIcon (NULL, IDI_APPLICATION);
wcl.hIconSm = LoadIcon (NULL, IDI_APPLICATION);
wcl.hCursor = LoadCursor (NULL, IDC_ARROW);
wcl.lpszMenuName = NULL;
wcl.cbClsExtra = 0;
wcl.cbWndExtra = 0;
wcl.hbrBackground = (HBRUSH) GetStockObject (WHITE_BRUSH);aqui um type-casting*/
if (RegisterClassEx (&wcl)!= 0)
{
hWnd = CreateWindowEx(
0,
szWinName,
szWinName,
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT,
CW_USEDEFAULT,
544,
375,
HWND_DESKTOP,
NULL,
hThisInst,
NULL
);
ShowWindow (hWnd, nWinMode);
UpdateWindow (hWnd);
while (GetMessage(&msg,NULL,0,0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return (msg.wParam);
}
LRESULT CALLBACK WindowProcedure (HWND hWnd, UINT mesagem,
WPARAM wParam, LPARAM lParam)
{
HDC hDC = NULL;
PAINTSTRUCT psPaint;
switch (mesagem)
{
case WM_CREATE:
{
return (0);
}break;
case WM_PAINT:
{
hDC=BeginPaint(hWnd,&psPaint);
EndPaint(hWnd, &psPaint);
return(0);
}break;
case WM_CLOSE:
{
DestroyWindow(hWnd);
return (0);
}break;
case WM_DESTROY:
{
PostQuitMessage(WM_QUIT);
return (0);
}break;
default:
{
return (DefWindowProc(hWnd, mesagem, wParam, lParam));
}break;
}
}
}Carregando comentários...