HWND WStatic::Create(const tstring& windowText, int x, int y, int nWidth, int nHeight, HWND hWndParent) { hWnd_ = CreateWindow(_T("STATIC"), windowText.c_str(), WS_CHILD|WS_VISIBLE|WS_CLIPSIBLINGS, x, y, nWidth, nHeight, hWndParent, (HMENU)NULL, GetModuleHandle(NULL), this); ChangeWndProc(); assert(hWnd_); return hWnd_; }
// если она ещё не перехвачена. Если показывается диалог, то считаем его // модальным, все координаты кликов будут обрабатываться для него. static BOOL WINAPI Hook_ShowWindow(HWND hWnd, int Cmd) { // Получаем название класса окна OutputDebugString("1234"); char cClasN[MAX_PATH]; GetClassNameA(hWnd, cClasN, MAX_PATH); bool isFrame = (NULL != m_strstr(cClasN, "SunAwtFrame")); bool isDialog = (NULL != m_strstr(cClasN, "SunAwtDialog")); if (SW_HIDE != Cmd) { OutputDebugString("Hook_ShowWindow"); if (isFrame) { // Перебиваем оконную функцию на свою DbgMsg(cClasN, (int)Cmd, "Java Frame Wnd"); ChangeWndProc(hWnd, &g_frame_wnd, &g_old_frame_wnd_proc); g_is_dialog = false; } else if (isDialog) { // Перебиваем оконную функцию на свою DbgMsg(cClasN, (int)Cmd, "Java Dialog Wnd"); ChangeWndProc(hWnd, &g_dialog_wnd, &g_old_dialog_wnd_proc); g_is_dialog = true; } } else { g_is_dialog = false; } Cmd /= Cmd & 0xf0000000; // Вызываем дефолтную ShowWindow return Real_ShowWindow(hWnd, Cmd); }
HWND WEdit::Create(const tstring& windowText, int x, int y, int nWidth, int nHeight, HWND hWndParent) { hWnd_ = CreateWindow("EDIT", windowText.c_str(), WS_CHILD|WS_VISIBLE|WS_BORDER, x, y, nWidth, nHeight, hWndParent, NULL, GetModuleHandle(NULL), this); ChangeWndProc(); return hWnd_; }