home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c480 / 20.ddi / SAMPLES / MAKEAPP / APP.H_ / APP.H
Encoding:
C/C++ Source or Header  |  1993-02-08  |  1.4 KB  |  56 lines

  1. // App structure declarations
  2. //
  3. #ifndef _INC_APP
  4. #define _INC_APP
  5.  
  6. // Public declarations
  7.  
  8. int PASCAL WinMain(HINSTANCE hinst, HINSTANCE hinstPrev, LPSTR lpszCmdLine, int cmdShow);
  9.  
  10. typedef struct tagAPP
  11. {
  12.     MSG         msg;
  13.     HINSTANCE   hinst;
  14.     HINSTANCE   hinstPrev;
  15.     LPSTR       lpszCmdLine;
  16.     int         cmdShow;
  17.     HWND        hwndMain;
  18.     int         codeExit;
  19.     BOOL        fQuit : 1;
  20. } APP;
  21.  
  22. // Public globals
  23.  
  24. extern APP g_app;
  25. extern UINT WM_MSGFILTER;
  26.  
  27. // Message crackers for new WM_MSGFILTER message
  28.  
  29. /* Cls_OnMsgFilter(HWND hwnd, MSG FAR* lpmsg, int context); */
  30. #define HANDLE_WM_MSGFILTER(hwnd, wParam, lParam, fn) \
  31.     (LRESULT)(DWORD)(fn)((hwnd), (MSG FAR*)(lParam), (int)(wParam))
  32. #define FORWARD_WM_MSGFILTER(hwnd, lpmsg, context, fn) \
  33.     (BOOL)(UINT)(fn)((hwnd), WM_MSGFILTER, (WPARAM)(context), (LPARAM)(lpmsg))
  34.  
  35. // Private declarations
  36.  
  37. BOOL App_Initialize(APP* papp);
  38. void App_Run(APP* papp);
  39.  
  40. // App_Terminate() exit codes
  41. #define TERM_QUIT           0
  42. #define TERM_ENDSESSION     1
  43. #define TERM_ERROR          2
  44.  
  45. void App_Terminate(APP* papp, int codeTerm);
  46.  
  47. BOOL App_ProcessNextMessage(APP* papp);
  48. BOOL App_MsgFilter(APP* papp, MSG FAR* lpmsg, int context);
  49. BOOL App_Idle(APP* papp);
  50.  
  51. BOOL App_InitializeHook(APP* papp);
  52. void App_TerminateHook(APP* papp);
  53. LRESULT __export CALLBACK App_MsgFilterHook(int code, WPARAM wParam, LPARAM lParam);
  54.  
  55. #endif  // !_INC_APP
  56.