TWR
T windows api WRapper
 All Classes Functions
BaseForm.h
1 #ifndef BASEFORM_H
2 #define BASEFORM_H
3 
4 #include "TwrWnd.h"
5 #include "BaseDialog.h"
6 
11 class BaseForm : public TwrWnd {
12 private:
13  TCHAR *windowClass;
14  TCHAR *title;
15 protected:
16  UINT message;
17  WPARAM wParam;
18  LPARAM lParam;
19  HINSTANCE hInstance;
20  DWORD style;
21 public:
22  BaseForm();
23  virtual ‾BaseForm();
24  void setClass(TCHAR *windowClassName) {
25  windowClass = windowClassName;
26  }
27  void setTitle(TCHAR *newTitle) {
28  title = newTitle;
29  }
30  HWND add(TwrWnd *obj);
31  HWND add(BaseDialog *obj);
32  void setStyle(DWORD newStyle);
33  virtual void UpdateData(bool toObj);
34 
35  virtual HWND Create(HINSTANCE hInstance);
36  virtual LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
37  virtual LRESULT OnCommand(int wmId, int wmEvent);
38  virtual LRESULT OnCreate();
39  virtual LRESULT OnNotify(LPNMHDR nmhdr);
40  virtual LRESULT OnDestroy();
41 
42 
43 };
44 
45 // MFCのDDXもどきマクロ
46 #define FDX_Text(toObj, ctl, str, bufLen) ¥
47  if (toObj) { ¥
48  SendMessage(ctl->getHwnd(),WM_GETTEXT,bufLen,str); ¥
49  } else { ¥
50  SendMessage(ctl->getHwnd(),WM_SETTEXT,(WPARAM)0,str); ¥
51  }
52 
53 #define FDX_Check(toObj, ctl, stat) ¥
54  if (toObj) { ¥
55  stat = (SendMessage(ctl->getHwnd(),BM_GETCHECK,0,0) ? true : false); ¥
56  } else { ¥
57  SendMessage(ctl->getHwnd(),BM_SETCHECK,(WPARAM)(stat ? 1 : 0),0); ¥
58  }
59 
60 #define FDX_CBIndex(toObj, ctl, index) ¥
61  if (toObj) { ¥
62  index = SendMessage(ctl->getHwnd(),CB_GETCURSEL,0,0); ¥
63  } else { ¥
64  SendMessage(ctl->getHwnd(),CB_SETCURSEL,(WPARAM)index,0); ¥
65  }
66 
67 
68 #endif // BASEFORM_H