Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
1.2 KiB

  1. #ifndef __DIALOG_H
  2. #define __DIALOG_H
  3. class Dialog {
  4. public:
  5. Dialog(UINT ResID, HINSTANCE hInst) : resID(ResID), hDlg(NULL), hInstance(hInst) {}
  6. virtual ~Dialog() {}
  7. virtual UINT ShowModal(HWND hwndParent = NULL);
  8. virtual INT_PTR OnInitDialog(HWND hwndDlg) { hDlg = hwndDlg; return TRUE; }
  9. INT_PTR MainDlgProc(UINT msg, WPARAM wParam, LPARAM lParam);
  10. protected:
  11. static INT_PTR DialogStaticDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam);
  12. virtual INT_PTR DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) { return FALSE; }
  13. virtual void OnOK() { result = IDOK; EndDialog(hDlg, IDOK);}
  14. virtual void OnCancel() { result = IDCANCEL; EndDialog(hDlg, IDCANCEL);}
  15. virtual BOOL OnHelp(LPHELPINFO pHelpInfo) { return FALSE; }
  16. virtual BOOL OnContextMenu (WPARAM wParam, LPARAM lParam) { return FALSE; }
  17. void HandleCommand(UINT ctrlId, HWND hwndCtrl, UINT cNotify);
  18. virtual void OnCommand(UINT ctrlId, HWND hwndCtrl, UINT cNotify) {}
  19. virtual INT_PTR OnNotify(NMHDR * nmhdr) {return FALSE;}
  20. HICON SetIcon(UINT iconID, BOOL bLarge = TRUE);
  21. void CenterWindow(HWND hwnd = NULL);
  22. HINSTANCE hInstance;
  23. HWND hDlg;
  24. UINT resID;
  25. UINT result;
  26. };
  27. #endif // __DIALOG_H