00001 #if !defined(AFX_MYCONTROL_H__EC7EC7AD_A9D6_414E_A3B6_66870A1519B1__INCLUDED_) 00002 #define AFX_MYCONTROL_H__EC7EC7AD_A9D6_414E_A3B6_66870A1519B1__INCLUDED_ 00003 00004 #if _MSC_VER > 1000 00005 #pragma once 00006 #endif // _MSC_VER > 1000 00007 00008 #undef CreateDialog // sinon pb 00009 00010 #include "MyScroll.h" 00011 #include "MyString.h" 00012 #include "MyRect.h" 00013 #include "MySubClassing.h" 00014 00015 class CMyControl 00016 { 00017 protected: 00018 HWND m_hWndControl; 00019 00020 private: 00021 HINSTANCE m_hInstance; 00022 int m_itemHeight; 00023 00024 public: 00025 CMyScroll scroll; 00026 CMySubClassing sub; 00027 CMySubClassing subParent; 00028 00029 public: 00030 CMyControl (BOOL noTitle=FALSE); 00031 CMyControl (HWND hWnd) { *this=hWnd; } 00032 virtual ~CMyControl (); 00033 00034 void operator= (HWND hWnd); 00035 HWND operator [] (int index); 00036 00037 BOOL Enable (BOOL enable); 00038 void DragAcceptFile (BOOL drag); 00039 00040 BOOL SetIcon (long idIcon); 00041 00042 BOOL ShowWindow (BOOL isShow); 00043 BOOL DestroyWindow (); 00044 BOOL SetForegroundWindow(); 00045 HWND SetActiveWindow (); 00046 HWND SetFocus () { return ::SetFocus(GetHWND()); } 00047 BOOL IsFocus () { return GetFocus()==GetHWND(); } 00048 BOOL IsToolWindow (); 00049 00050 HWND GetParent (); 00051 HINSTANCE GethInstance (); 00052 HWND GetHWND () { return m_hWndControl; } 00053 00054 HWND CreateDialog (long idDialog,DLGPROC callBack,long param=NULL); 00055 int ModalDialog (long idDialog,DLGPROC callBack,long param=NULL); 00056 00057 BOOL GetWindowRect (RECT *rect); 00058 operator HWND () const { return m_hWndControl; } 00059 00060 BOOL GetText (MyString &dest,int idChildControl=0); 00061 BOOL SetText (char *dest,int idChildControl=0); 00062 00063 int GetDlgCtrlID (); 00064 int GetItemHeight () { return m_itemHeight; } 00065 void SetItemHeight (int height) { m_itemHeight = height; } 00066 00067 BOOL InvalidateRect (RECT *rect=NULL,BOOL erase=TRUE); 00068 BOOL GetClientRect (RECT *rect); 00069 BOOL SetPos (int x,int y,HWND hWndOrigine=NULL); 00070 BOOL SetSize (int dx,int dy); 00071 BOOL GetSize (int *dx,int *dy); 00072 BOOL GetPos (int *x,int *y); 00073 00074 LRESULT SendMessage (UINT Msg,WPARAM wParam,LPARAM lParam); 00075 void PostMessage (UINT Msg,WPARAM wParam,LPARAM lParam); 00076 00077 DWORD GetStyle (); 00078 DWORD GetStyleEx (); 00079 LONG SetStyle (DWORD dwStyle); 00080 LONG SetStyle (DWORD dwStyle,BOOL set); 00081 LONG SetStyleEx (DWORD dwStyle); 00082 LONG SetStyleEx (DWORD dwStyle,BOOL set); 00083 00084 void SetTopMost (BOOL set); 00085 00086 int MessageBox (char *text,char *caption,UINT type=0); 00087 00088 HMENU GetSystemMenu (BOOL bRevert); 00089 HWND SetCapture(); 00090 00091 00092 }; 00093 00094 #endif // !defined(AFX_MYCONTROL_H__EC7EC7AD_A9D6_414E_A3B6_66870A1519B1__INCLUDED_)