Removed some unnecessary includes.
[wine] / programs / view / init.c
1 #include <windows.h>
2 #include "globals.h"
3 #include "resource.h"
4
5 /* global variables */
6
7 HINSTANCE hInst;
8 char szAppName[9];
9 char szTitle[40];
10
11 BOOL InitApplication(HINSTANCE hInstance)
12 {
13   WNDCLASSEX wc;
14
15   /* Load the application name and description strings */
16   
17   LoadString(hInstance, IDS_APPNAME, szAppName, sizeof(szAppName));
18   LoadString(hInstance, IDS_DESCRIPTION, szTitle, sizeof(szTitle));
19
20   /* Fill in window class structure with parameters that describe the
21      main window */
22
23   wc.cbSize = sizeof(WNDCLASSEX);
24
25   /* Load small icon image */
26   wc.hIconSm = LoadImage(hInstance,             
27                          MAKEINTRESOURCEA(IDI_APPICON),
28                          IMAGE_ICON,
29                          16, 16,
30                          0);
31
32   wc.style         = CS_HREDRAW | CS_VREDRAW;             /* Class style(s) */
33   wc.lpfnWndProc   = (WNDPROC)WndProc;                  /* Window Procedure */
34   wc.cbClsExtra    = 0;                          /* No per-class extra data */
35   wc.cbWndExtra    = 0;                         /* No per-window extra data */
36   wc.hInstance     = hInstance;                      /* Owner of this class */
37   wc.hIcon         = LoadIcon(hInstance, szAppName);  /* Icon name from .rc */
38   wc.hCursor       = LoadCursor(NULL, IDC_ARROW);                 /* Cursor */
39   wc.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);           /* Default color */
40   wc.lpszMenuName  = szAppName;                       /* Menu name from .rc */
41   wc.lpszClassName = szAppName;                      /* Name to register as */
42
43   /* Register the window class and return FALSE if unsuccesful */
44
45   if (!RegisterClassEx(&wc))
46     {
47       if (!RegisterClass((LPWNDCLASS)&wc.style))
48         return FALSE;
49     }
50
51   /* Call module specific initialization functions here */
52
53   return TRUE;
54 }
55
56 BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
57 {
58     HWND hwnd; 
59
60     /* Save the instance handle in a global variable for later use */
61     hInst = hInstance;
62
63     /* Create main window */
64     hwnd = CreateWindow(szAppName,           /* See RegisterClass() call */
65                         szTitle,             /* window title */
66                         WS_OVERLAPPEDWINDOW, /* Window style */
67                         CW_USEDEFAULT, 0,    /* positioning */
68                         CW_USEDEFAULT, 0,    /* size */
69                         NULL,                /* Overlapped has no parent */
70                         NULL,                /* Use the window class menu */
71                         hInstance,           
72                         NULL);               
73     
74     if (!hwnd)
75         return FALSE;
76
77     /* Call module specific instance initialization functions here */
78
79     /* show the window, and paint it for the first time */
80     ShowWindow(hwnd, nCmdShow);
81     UpdateWindow(hwnd);
82
83     return TRUE;
84 }