]> git.karo-electronics.de Git - karo-tx-redboot.git/blob - packages/services/gfx/mw/v2_0/src/demos/mwin/mtest.c
Initial revision
[karo-tx-redboot.git] / packages / services / gfx / mw / v2_0 / src / demos / mwin / mtest.c
1 #include <windows.h>
2
3 LRESULT CALLBACK wproc(HWND,UINT,WPARAM,LPARAM);
4
5 int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
6                    PSTR szCmdLine, int iCmdShow)
7 {
8         static char szAppName[]="HolaWin";
9         HWND hwnd;
10         MSG msg;
11         WNDCLASS wndclass;
12
13         wndclass.style          = CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW;
14         wndclass.lpfnWndProc    = (WNDPROC)wproc;
15         wndclass.cbClsExtra     =0;
16         wndclass.cbWndExtra     =0;
17         wndclass.hInstance      =0;
18         wndclass.hIcon          =0;
19         wndclass.hCursor        =0;
20         wndclass.hbrBackground  =(HBRUSH)GetStockObject(LTGRAY_BRUSH);
21         wndclass.lpszMenuName   =NULL;
22         wndclass.lpszClassName  = szAppName;
23
24         RegisterClass(&wndclass);
25         hwnd=CreateWindowEx(0L,
26                           szAppName,
27                           "Hola",
28                           WS_OVERLAPPEDWINDOW | WS_VISIBLE,
29                           CW_USEDEFAULT,
30                           CW_USEDEFAULT,
31                           80,
32                           80,
33                           NULL,
34                           NULL,
35                           NULL,
36                           NULL);
37                
38                
39         ShowWindow(hwnd,iCmdShow);
40         UpdateWindow(hwnd);
41         
42         while (GetMessage(&msg,NULL,0,0)) {
43                 TranslateMessage(&msg);
44                 DispatchMessage(&msg);
45         }      
46         return msg.wParam;
47 }       
48 LRESULT CALLBACK wproc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
49 {       
50         HDC hdc;
51         PAINTSTRUCT ps;
52         RECT rect;
53         
54         switch (iMsg) {
55         case WM_CREATE:
56                 break;
57         case WM_PAINT:
58         /*case WM_MOUSEFIRST:*/
59                 hdc=BeginPaint(hwnd,&ps);
60                 GetClientRect(hwnd,&rect);
61                 DrawText(hdc, "Hola, NOS", -1, &rect,
62                          DT_SINGLELINE|DT_CENTER|DT_VCENTER);
63                 EndPaint(hwnd,&ps);
64                 break;
65         case WM_DESTROY:
66                 PostQuitMessage(0);
67                 break;
68         default:
69                 return DefWindowProc(hwnd,iMsg,wParam,lParam);
70         }      
71         return (0);
72 }