Main Page   Class Hierarchy   Alphabetical List   Data Structures   File List   Data Fields   Globals  

windlg.c File Reference

#include <windows.h>
#include "dlgproc.h"
#include "nmlperf.rh"
#include "windlg.h"

Include dependency graph for windlg.c:

Include dependency graph

Go to the source code of this file.

Functions

void WinDlgExit ()
int PASCAL main_window_proc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
int PASCAL WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpstrCmdLine, int nCmdShow)

Variables

HINSTANCE hWinDlgInstance
int nWinDlgCmdShow
DLGPROC dlg_proc_instance = NULL
HRSRC dlg_resource_handle = NULL
LPCSTR dlg_resource_str
HGLOBAL dlg_resource = NULL
HWND hDlg = NULL
MSG main_loop_message
HWND title_window
void FAR * dlg_resource_ptr = NULL


Function Documentation

void WinDlgExit  
 

Definition at line 24 of file windlg.c.

Referenced by main_window_dialog_proc().

00025 {
00026   if (NULL != title_window)
00027     {
00028       DestroyWindow (title_window);
00029     }
00030 }

int PASCAL main_window_proc HWND    hwnd,
UINT    message,
WPARAM    wParam,
LPARAM    lParam
 

Definition at line 33 of file windlg.c.

00034 {
00035   switch (message)
00036     {
00037     case WM_DESTROY:
00038       PostQuitMessage (0);
00039       break;
00040     default:
00041       return DefWindowProc (hwnd, message, wParam, lParam);
00042     }
00043 }

int PASCAL WinMain HINSTANCE    hInstance,
HINSTANCE    hPrevInstance,
LPSTR    lpstrCmdLine,
int    nCmdShow
 

Definition at line 46 of file windlg.c.

00048 {
00049   WNDCLASS wndclass;
00050   hWinDlgInstance = hInstance;
00051   nWinDlgCmdShow = nCmdShow;
00052 
00053   if (NULL == hPrevInstance)
00054     {
00055       wndclass.style = CS_HREDRAW | CS_VREDRAW;
00056       wndclass.lpfnWndProc = main_window_proc;
00057       wndclass.cbClsExtra = 0;
00058       // Reserve extra bytes for each instance of the window;
00059       // we will use these bytes to store a pointer to the C++
00060       // (MainWindow) object corresponding to the window.
00061       // the size of a 'this' pointer depends on the memory model.
00062       wndclass.cbWndExtra = 0;
00063       wndclass.hInstance = hInstance;
00064       wndclass.hIcon = NULL;
00065       wndclass.hCursor = LoadCursor (NULL, IDC_ARROW);
00066       wndclass.hbrBackground = (HBRUSH) GetStockObject (WHITE_BRUSH);
00067       wndclass.lpszMenuName = NULL;
00068       wndclass.lpszClassName = "TITLE_WINDOW";
00069 
00070       if (!RegisterClass (&wndclass))
00071         {
00072           MessageBox (NULL, "Can't Registor TITLE_WINDOW Class.", "ERROR",
00073                       MB_OK);
00074           return (0);
00075         }
00076     }
00077   title_window =
00078     CreateWindow ("TITLE_WINDOW", "The Title", WS_CAPTION | WS_SYSMENU, 0,      /* X */
00079                   0,            /* Y */
00080                   0,            /* width */
00081                   0,            /* hieght */
00082                   NULL,         /* Parent */
00083                   NULL,         /* hMenu */
00084                   hInstance, 0);
00085   if (title_window == NULL)
00086     {
00087       MessageBox (NULL, "Can't Create TITLE_WINDOW.", "ERROR", MB_OK);
00088       return 0;
00089     }
00090   ShowWindow (title_window, nCmdShow);
00091   dlg_proc_instance = MakeProcInstance (main_window_dialog_proc, hInstance);
00092   if (NULL == dlg_proc_instance)
00093     {
00094       MessageBox (NULL, "Can't MakeProcInstance for dialog_proc.", "ERROR",
00095                   MB_OK);
00096       return NULL;
00097     }
00098   dlg_resource_str = MAKEINTRESOURCE (MAIN_WINDOW_DIALOG);
00099   if (dlg_resource_str == NULL)
00100     {
00101       MessageBox (NULL, "Can't MAKEINTRESOURCE for MAIN_WINDOW_DIALOG",
00102                   "ERROR", MB_OK);
00103       return 0;
00104     }
00105 #if 0
00106   dlg_resource_handle = FindResource (hInstance, dlg_resource_str, RT_DIALOG);
00107   if (NULL == dlg_resource_handle)
00108     {
00109       MessageBox (NULL, "Can't FindResource MAIN_WINDOW_DIALOG", "ERROR",
00110                   MB_OK);
00111       FreeProcInstance (dlg_proc_instance);
00112       dlg_proc_instance = NULL;
00113       return NULL;
00114     }
00115   dlg_resource = LoadResource (hInstance, dlg_resource_handle);
00116   if (NULL == dlg_resource)
00117     {
00118       MessageBox (NULL, "Can't LoadResource MAIN_WINDOW_DIALOG", "ERROR",
00119                   MB_OK);
00120       FreeProcInstance (dlg_proc_instance);
00121       dlg_proc_instance = NULL;
00122       return NULL;
00123     }
00124   dlg_resource_ptr = LockResource (dlg_resource);
00125   if (dlg_resource_ptr == NULL)
00126     {
00127       MessageBox (NULL, "Can't LockResource MAIN_WINDOW_DIALOG", "ERROR",
00128                   MB_OK);
00129       return 0;
00130     }
00131 #endif
00132   hDlg = CreateDialog (hInstance,
00133                        dlg_resource_str, title_window, dlg_proc_instance);
00134   if (NULL == hDlg)
00135     {
00136       MessageBox (NULL, "Can't CreateDialog.", "ERROR", MB_OK);
00137       FreeProcInstance (dlg_proc_instance);
00138       dlg_proc_instance = NULL;
00139       FreeResource (dlg_resource);
00140       dlg_resource = NULL;
00141       return NULL;
00142     }
00143   while (GetMessage (&main_loop_message, NULL, 0, 0))
00144     {
00145       if (IsDialogMessage (hDlg, &main_loop_message))
00146         {
00147           continue;
00148         }
00149       TranslateMessage (&main_loop_message);
00150       DispatchMessage (&main_loop_message);
00151     }
00152   return main_loop_message.wParam;
00153 }


Variable Documentation

HINSTANCE hWinDlgInstance
 

Definition at line 11 of file windlg.c.

int nWinDlgCmdShow
 

Definition at line 12 of file windlg.c.

DLGPROC dlg_proc_instance = NULL
 

Definition at line 13 of file windlg.c.

HRSRC dlg_resource_handle = NULL
 

Definition at line 14 of file windlg.c.

LPCSTR dlg_resource_str
 

Definition at line 15 of file windlg.c.

HGLOBAL dlg_resource = NULL
 

Definition at line 16 of file windlg.c.

HWND hDlg = NULL
 

Definition at line 17 of file windlg.c.

MSG main_loop_message
 

Definition at line 18 of file windlg.c.

HWND title_window
 

Definition at line 19 of file windlg.c.

void FAR* dlg_resource_ptr = NULL
 

Definition at line 20 of file windlg.c.


Generated on Sun Dec 2 15:58:05 2001 for rcslib by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001