Release 980301
[wine/multimedia.git] / programs / view / init.c
blobeeaa149022c595f5c731fbd9e92758b087c24e72
1 #include <windows.h>
2 #include "globals.h"
3 #include "resource.h"
5 /* global variables */
7 HINSTANCE hInst;
8 char szAppName[9];
9 char szTitle[40];
11 BOOL InitApplication(HINSTANCE hInstance)
13 WNDCLASSEX wc;
15 /* Load the application name and description strings */
17 LoadString(hInstance, IDS_APPNAME, szAppName, sizeof(szAppName));
18 LoadString(hInstance, IDS_DESCRIPTION, szTitle, sizeof(szTitle));
20 /* Fill in window class structure with parameters that describe the
21 main window */
23 wc.cbSize = sizeof(WNDCLASSEX);
25 /* Load small icon image */
26 wc.hIconSm = LoadImage(hInstance,
27 MAKEINTRESOURCE(IDI_APPICON),
28 IMAGE_ICON,
29 16, 16,
30 0);
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 */
43 /* Register the window class and return FALSE if unsuccesful */
45 if (!RegisterClassEx(&wc))
47 if (!RegisterClass((LPWNDCLASS)&wc.style))
48 return FALSE;
51 /* Call module specific initialization functions here */
53 return TRUE;
56 BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
58 HWND hwnd;
60 /* Save the instance handle in a global variable for later use */
61 hInst = hInstance;
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);
74 if (!hwnd)
75 return FALSE;
77 /* Call module specific instance initialization functions here */
79 /* show the window, and paint it for the first time */
80 ShowWindow(hwnd, nCmdShow);
81 UpdateWindow(hwnd);
83 return TRUE;