From 0456519f5d2c262fb8a98b22d514c338fc8ed1f0 Mon Sep 17 00:00:00 2001 From: "av%netscape.com" Date: Thu, 13 Mar 2003 03:05:47 +0000 Subject: [PATCH] Fixing minor bug in the Tester Plugin, not part of the build git-svn-id: svn://10.0.0.236/trunk@139367 18797224-902f-48f8-a5cc-f745e15eee43 --- .../plugin/tools/tester/windows/plugin.cpp | 24 ++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/mozilla/modules/plugin/tools/tester/windows/plugin.cpp b/mozilla/modules/plugin/tools/tester/windows/plugin.cpp index c519e93109f..96fe669b31f 100644 --- a/mozilla/modules/plugin/tools/tester/windows/plugin.cpp +++ b/mozilla/modules/plugin/tools/tester/windows/plugin.cpp @@ -194,31 +194,34 @@ void CPlugin::getLogFileName(LPSTR szLogFileName, int iSize) BOOL CALLBACK NP_LOADDS TesterDlgProc(HWND, UINT, WPARAM, LPARAM); -static BOOL bStandAlone = TRUE; static char szStandAlonePluginWindowClassName[] = "StandAloneWindowClass"; BOOL CPlugin::initStandAlone() { HWND hWndParent = NULL; + // ensure window class WNDCLASS wc; wc.style = 0; wc.lpfnWndProc = DefWindowProc; wc.cbClsExtra = 0; wc.cbWndExtra = 0; - wc.hInstance = m_hInst; + wc.hInstance = hInst; wc.hIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_ICON_APP)); wc.hCursor = LoadCursor(0, IDC_ARROW); wc.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1); wc.lpszMenuName = NULL; wc.lpszClassName = szStandAlonePluginWindowClassName; - if(RegisterClass(&wc)) - hWndParent = CreateWindow(szStandAlonePluginWindowClassName, - "The Tester Plugin", - WS_POPUPWINDOW | WS_CAPTION | WS_VISIBLE | WS_MINIMIZEBOX, - 0, 0, 800, 600, - GetDesktopWindow(), NULL, m_hInst, NULL); + // just register the window class, if class already exists GetLastError() + // will return ERROR_CLASS_ALREADY_EXISTS, let's not care about it + RegisterClass(&wc); + + hWndParent = CreateWindow(szStandAlonePluginWindowClassName, + "The Tester Plugin", + WS_POPUPWINDOW | WS_CAPTION | WS_VISIBLE | WS_MINIMIZEBOX, + 0, 0, 800, 600, + GetDesktopWindow(), NULL, m_hInst, NULL); // m_hWndStandAloneLogWindow = CreateWindow("LISTBOX", "", // WS_CHILD | WS_VISIBLE | WS_BORDER | WS_VSCROLL | WS_HSCROLL | LBS_NOINTEGRALHEIGHT, @@ -246,11 +249,10 @@ BOOL CPlugin::initStandAlone() void CPlugin::shutStandAlone() { + // we don't care about unregistering window class, let it be in the system + if (isStandAlone() && m_hWndParent) - { DestroyWindow(m_hWndParent); - UnregisterClass(szStandAlonePluginWindowClassName, m_hInst); - } m_bPluginReady = FALSE; }