Win32 Window

dontbugme's Avatar
Banned
Hello,

I have made in win32 window.
This compiles with dev-c 4 complete without errors but when i start the program it will do nothing.

Can anyone help me with this please ?

greetz,

dontbugme
dontbugme's Avatar
Banned
Quote:
Originally Posted by dontbugme
Hello,

I have made in win32 window.
This compiles with dev-c 4 complete without errors but when i start the program it will do nothing.

Can anyone help me with this please ?

greetz,

dontbugme
This is the code i forget

PHP Code:
#include <windows.h>

LRESULT CALLBACK WndProc(HWNDUINTWPARAMLPARAM);

int WINAPI WinMain(HINSTANCE hInstanceHINSTANCE hPrevInstancechar szCmdLineint iCmdShow)
{
char szAppName[] = "My window";
HWND               hwnd;
MSG                msg;
WNDCLASS          wndclass;

wndclass.lpfnWndProc       WndProc;
wndclass.lpszClassName     szAppName;
wndclass.style             CS_HREDRAW CS_VREDRAW;
wndclass.hInstance         hInstance;
wndclass.hIcon             LoadIcon(NULLIDI_APPLICATION);
wndclass.hCursor           LoadCursor(NULLIDC_ARROW);
wndclass.hbrBackground     = (HBRUSH) (COLOR_WINDOW+1);
wndclass.lpszMenuName      NULL;
wndclass.cbClsExtra        0;
wndclass.cbWndExtra        0;

//register class
if (!RegisterClass(&wndclass))
{
 
MessageBox(NULL"Window registration failed!"szAppNameMB_OK);
 return 
0;
}

//create window
hwnd CreateWindow(szAppName,
                    
szAppName,
                    
WS_OVERLAPPEDWINDOW,
                    
CW_USEDEFAULT,
                    
CW_USEDEFAULT,
                    
CW_USEDEFAULT,
                    
CW_USEDEFAULT,
                    
NULL,
                    
NULL,
                    
hInstance,
                    
NULL);

ShowWindow(hwndiCmdShow);
UpdateWindow(hwnd);


//messageloop
while(GetMessage(&msgNULL00))
{
 
TranslateMessage(&msg);
 
DispatchMessage(&msg);
}
 return 
msg.wParam;
 }

 
//window procedure
LRESULT CALLBACK WndProc(HWND hwndUINT messageWPARAM wParamLPARAM lParam)
{
 
HDC                               hdc;
 
PAINTSTRUCT                       lpps;
 
RECT                              lprect;

 switch(
message)
 {
  case 
WM_PAINT:
                                   
hdc BeginPaint(hwnd, &lpps);

                                   
GetClientRect(hwnd, &lprect);
                                   
DrawText(hdc"Hello World!", -1, &lprectDT_CENTER DT_VCENTER DT_SINGLELINE);

                                   
EndPaint(hwnd, &lpps);
                                   return 
0;


  case 
WM_DESTROY:
                                  
PostQuitMessage(0);
                                  return 
0;
 }
  return 
DefWindowProc(hwndmessagelParamwParam);