00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef __WIN32CLASS_H__
00011 #define __WIN32CLASS_H__
00012
00013 #include <gen_object.h>
00014
00015 #define RELEASE_CLASSOBJ(a) { a->release(); a = NULL; }
00016
00017 class Win32WndClass : public GenericObject
00018 {
00019 public:
00020 Win32WndClass(WNDCLASSEXA *wndclass, BOOL fUnicode = FALSE);
00021 ~Win32WndClass();
00022
00023 ULONG getClassLongA(int index, BOOL fUnicode = FALSE);
00024 ULONG getClassLongW(int index)
00025 {
00026 return getClassLongA(index, TRUE);
00027 };
00028 WORD getClassWord(int index);
00029
00030 ULONG setClassLongA(int index, LONG lNewVal, BOOL fUnicode = FALSE);
00031 ULONG setClassLongW(int index, LONG lNewVal)
00032 {
00033 return setClassLongA(index, lNewVal, TRUE);
00034 }
00035 WORD setClassWord(int index, WORD wNewVal);
00036
00037 ATOM getAtom() { return (ATOM) classAtom; };
00038 BOOL getClassInfo(WNDCLASSEXA *wndclass);
00039 BOOL getClassInfo(WNDCLASSEXW *wndclass);
00040
00041 ULONG getClassName(LPSTR lpszClassName, ULONG cchClassName);
00042 ULONG getClassName(LPWSTR lpszClassName, ULONG cchClassName);
00043
00044 WNDPROC getWindowProc() { return windowProc; };
00045 LPSTR getMenuNameA() { return menuNameA; };
00046 DWORD getExtraWndBytes() { return nrExtraWindowBytes; };
00047
00048 HICON getIcon() { return hIcon; };
00049 HICON getIconSm() { return hIconSm; };
00050 HCURSOR getCursor() { return hCursor; };
00051
00052 HINSTANCE getInstance() { return hInstance; };
00053
00054 HBRUSH getBackgroundBrush() { return backgroundBrush; };
00055 ULONG getStyle() { return windowStyle; };
00056
00057 HDC getClassDC() { return hdcClass; };
00058
00059 void setMenuName(LPSTR newMenuName);
00060
00061 BOOL hasClassName(LPSTR classname, BOOL fUnicode = FALSE);
00062
00063 BOOL isAppClass(ULONG curProcessId);
00064
00065 static BOOL UnregisterClassA(HINSTANCE hinst, LPSTR id);
00066
00067
00068
00069 static Win32WndClass *FindClass(HINSTANCE hinst, LPSTR id);
00070 static Win32WndClass *FindClass(HINSTANCE hinst, LPWSTR id);
00071
00072 static void DestroyAll();
00073
00074 private:
00075 BOOL isUnicode;
00076
00077
00078 ULONG windowStyle;
00079 ULONG nrExtraClassBytes;
00080 ULONG nrExtraWindowBytes;
00081 HBRUSH backgroundBrush;
00082 HCURSOR hCursor;
00083 HICON hIcon;
00084 HINSTANCE hInstance;
00085 PCHAR menuNameA;
00086 WCHAR *menuNameW;
00087 WNDPROC windowProc;
00088 ULONG classAtom;
00089
00090 PCHAR classNameA;
00091 WCHAR *classNameW;
00092 HICON hIconSm;
00093 HDC hdcClass;
00094
00095
00096 char *userClassBytes;
00097 ULONG processId;
00098
00099 static GenericObject *wndclasses;
00100 static CRITICAL_SECTION critsect;
00101 };
00102
00103 #endif //__WIN32CLASS_H__