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