From ccc6160631d85e08dd112c65abb2e07d01bc2e0c Mon Sep 17 00:00:00 2001 From: "locka%iol.ie" Date: Tue, 21 Mar 2000 00:05:33 +0000 Subject: [PATCH] Relocated ActiveX control test source git-svn-id: svn://10.0.0.236/trunk@63502 18797224-902f-48f8-a5cc-f745e15eee43 --- .../activex/tests/IEPatcher/DlgProxy.cpp | 86 ++ .../activex/tests/IEPatcher/DlgProxy.h | 61 ++ .../activex/tests/IEPatcher/IEPatcher.cpp | 93 ++ .../activex/tests/IEPatcher/IEPatcher.dsp | 203 +++++ .../activex/tests/IEPatcher/IEPatcher.h | 53 ++ .../activex/tests/IEPatcher/IEPatcher.odl | 41 + .../activex/tests/IEPatcher/IEPatcher.rc | 236 +++++ .../activex/tests/IEPatcher/IEPatcher.reg | 13 + .../activex/tests/IEPatcher/IEPatcherDlg.cpp | 622 +++++++++++++ .../activex/tests/IEPatcher/IEPatcherDlg.h | 105 +++ .../tests/IEPatcher/ScanForFilesDlg.cpp | 110 +++ .../activex/tests/IEPatcher/ScanForFilesDlg.h | 48 + .../activex/tests/IEPatcher/ScannerThread.cpp | 46 + .../activex/tests/IEPatcher/ScannerThread.h | 54 ++ .../activex/tests/IEPatcher/ScannerWnd.cpp | 82 ++ .../activex/tests/IEPatcher/ScannerWnd.h | 48 + .../activex/tests/IEPatcher/StdAfx.cpp | 6 + .../browser/activex/tests/IEPatcher/StdAfx.h | 42 + .../activex/tests/IEPatcher/res/IEPatcher.ico | Bin 0 -> 1078 bytes .../activex/tests/IEPatcher/res/IEPatcher.rc2 | 13 + .../tests/IEPatcher/res/containsie.ico | Bin 0 -> 318 bytes .../tests/IEPatcher/res/containsmozilla.ico | Bin 0 -> 318 bytes .../tests/IEPatcher/res/doesntcontainie.ico | Bin 0 -> 318 bytes .../tests/IEPatcher/res/unknownstatus.ico | Bin 0 -> 318 bytes .../activex/tests/IEPatcher/resource.h | 35 + .../tests/RegMozCtl/MozillaBrowser.ico | Bin 0 -> 4710 bytes .../activex/tests/RegMozCtl/ReadMe.txt | 88 ++ .../activex/tests/RegMozCtl/RegMozCtl.cpp | 74 ++ .../activex/tests/RegMozCtl/RegMozCtl.dsp | 150 ++++ .../activex/tests/RegMozCtl/RegMozCtl.h | 49 + .../activex/tests/RegMozCtl/RegMozCtl.rc | 205 +++++ .../activex/tests/RegMozCtl/RegMozCtlDlg.cpp | 337 +++++++ .../activex/tests/RegMozCtl/RegMozCtlDlg.h | 65 ++ .../activex/tests/RegMozCtl/StdAfx.cpp | 8 + .../browser/activex/tests/RegMozCtl/StdAfx.h | 29 + .../activex/tests/RegMozCtl/res/RegMozCtl.ico | Bin 0 -> 1078 bytes .../activex/tests/RegMozCtl/res/RegMozCtl.rc2 | 13 + .../activex/tests/RegMozCtl/resource.h | 27 + .../activex/tests/cbrowse/CBrowseDlg.cpp | 846 ++++++++++++++++++ .../activex/tests/cbrowse/CBrowseDlg.h | 110 +++ .../activex/tests/cbrowse/CBrowserCtlSite.cpp | 172 ++++ .../activex/tests/cbrowse/CBrowserCtlSite.h | 56 ++ .../activex/tests/cbrowse/CBrowserCtlSite.rgs | 24 + .../browser/activex/tests/cbrowse/Cbrowse.idl | 68 ++ .../browser/activex/tests/cbrowse/Cbrowse.rgs | 11 + .../tests/cbrowse/ControlEventSink.cpp | 144 +++ .../activex/tests/cbrowse/ControlEventSink.h | 60 ++ .../tests/cbrowse/ControlEventSink.rgs | 24 + .../activex/tests/cbrowse/EditToolBar.cpp | 33 + .../activex/tests/cbrowse/EditToolBar.h | 48 + .../activex/tests/cbrowse/Html/main.htm | 32 + .../activex/tests/cbrowse/PickerDlg.cpp | 129 +++ .../browser/activex/tests/cbrowse/PickerDlg.h | 54 ++ .../activex/tests/cbrowse/Scripts/Basic.vbs | 4 + .../tests/cbrowse/Scripts/NewWindow.vbs | 4 + .../activex/tests/cbrowse/Scripts/Post.vbs | 6 + .../browser/activex/tests/cbrowse/StdAfx.cpp | 13 + .../browser/activex/tests/cbrowse/StdAfx.h | 75 ++ .../browser/activex/tests/cbrowse/TabDOM.cpp | 69 ++ .../browser/activex/tests/cbrowse/TabDOM.h | 54 ++ .../activex/tests/cbrowse/TabMessages.cpp | 50 ++ .../activex/tests/cbrowse/TabMessages.h | 55 ++ .../activex/tests/cbrowse/TabTests.cpp | 114 +++ .../browser/activex/tests/cbrowse/TabTests.h | 58 ++ .../tests/cbrowse/TestScriptHelper.cpp | 98 ++ .../activex/tests/cbrowse/TestScriptHelper.h | 43 + .../tests/cbrowse/TestScriptHelper.rgs | 24 + .../browser/activex/tests/cbrowse/Tests.cpp | 491 ++++++++++ .../browser/activex/tests/cbrowse/Tests.h | 73 ++ .../browser/activex/tests/cbrowse/cbrowse.cpp | 205 +++++ .../browser/activex/tests/cbrowse/cbrowse.dsp | 327 +++++++ .../browser/activex/tests/cbrowse/cbrowse.h | 59 ++ .../browser/activex/tests/cbrowse/cbrowse.rc | 450 ++++++++++ .../activex/tests/cbrowse/res/cbrowse.ico | Bin 0 -> 1078 bytes .../activex/tests/cbrowse/res/cbrowse.rc2 | 13 + .../tests/cbrowse/res/closedfolder.ico | Bin 0 -> 318 bytes .../activex/tests/cbrowse/res/openfolder.ico | Bin 0 -> 318 bytes .../activex/tests/cbrowse/res/test.ico | Bin 0 -> 318 bytes .../activex/tests/cbrowse/res/testfailed.ico | Bin 0 -> 318 bytes .../activex/tests/cbrowse/res/testpartial.ico | Bin 0 -> 318 bytes .../activex/tests/cbrowse/res/testpassed.ico | Bin 0 -> 318 bytes .../activex/tests/cbrowse/res/toolbar1.bmp | Bin 0 -> 1078 bytes .../browser/activex/tests/cbrowse/resource.h | 75 ++ .../browser/activex/tests/vbrowse/VBrowse.vbp | 37 + .../browser/activex/tests/vbrowse/browser.frm | 54 ++ .../browser/activex/tests/vbrowse/browser.frx | Bin 0 -> 36 bytes .../activex/tests/vbrowse/frmExplorer.frm | 63 ++ .../activex/tests/vbrowse/frmToolBar.frm | 315 +++++++ .../activex/tests/vbrowse/frmToolBar.frx | Bin 0 -> 6516 bytes 89 files changed, 7682 insertions(+) create mode 100644 mozilla/embedding/browser/activex/tests/IEPatcher/DlgProxy.cpp create mode 100644 mozilla/embedding/browser/activex/tests/IEPatcher/DlgProxy.h create mode 100644 mozilla/embedding/browser/activex/tests/IEPatcher/IEPatcher.cpp create mode 100644 mozilla/embedding/browser/activex/tests/IEPatcher/IEPatcher.dsp create mode 100644 mozilla/embedding/browser/activex/tests/IEPatcher/IEPatcher.h create mode 100644 mozilla/embedding/browser/activex/tests/IEPatcher/IEPatcher.odl create mode 100644 mozilla/embedding/browser/activex/tests/IEPatcher/IEPatcher.rc create mode 100644 mozilla/embedding/browser/activex/tests/IEPatcher/IEPatcher.reg create mode 100644 mozilla/embedding/browser/activex/tests/IEPatcher/IEPatcherDlg.cpp create mode 100644 mozilla/embedding/browser/activex/tests/IEPatcher/IEPatcherDlg.h create mode 100644 mozilla/embedding/browser/activex/tests/IEPatcher/ScanForFilesDlg.cpp create mode 100644 mozilla/embedding/browser/activex/tests/IEPatcher/ScanForFilesDlg.h create mode 100644 mozilla/embedding/browser/activex/tests/IEPatcher/ScannerThread.cpp create mode 100644 mozilla/embedding/browser/activex/tests/IEPatcher/ScannerThread.h create mode 100644 mozilla/embedding/browser/activex/tests/IEPatcher/ScannerWnd.cpp create mode 100644 mozilla/embedding/browser/activex/tests/IEPatcher/ScannerWnd.h create mode 100644 mozilla/embedding/browser/activex/tests/IEPatcher/StdAfx.cpp create mode 100644 mozilla/embedding/browser/activex/tests/IEPatcher/StdAfx.h create mode 100644 mozilla/embedding/browser/activex/tests/IEPatcher/res/IEPatcher.ico create mode 100644 mozilla/embedding/browser/activex/tests/IEPatcher/res/IEPatcher.rc2 create mode 100644 mozilla/embedding/browser/activex/tests/IEPatcher/res/containsie.ico create mode 100644 mozilla/embedding/browser/activex/tests/IEPatcher/res/containsmozilla.ico create mode 100644 mozilla/embedding/browser/activex/tests/IEPatcher/res/doesntcontainie.ico create mode 100644 mozilla/embedding/browser/activex/tests/IEPatcher/res/unknownstatus.ico create mode 100644 mozilla/embedding/browser/activex/tests/IEPatcher/resource.h create mode 100644 mozilla/embedding/browser/activex/tests/RegMozCtl/MozillaBrowser.ico create mode 100644 mozilla/embedding/browser/activex/tests/RegMozCtl/ReadMe.txt create mode 100644 mozilla/embedding/browser/activex/tests/RegMozCtl/RegMozCtl.cpp create mode 100644 mozilla/embedding/browser/activex/tests/RegMozCtl/RegMozCtl.dsp create mode 100644 mozilla/embedding/browser/activex/tests/RegMozCtl/RegMozCtl.h create mode 100644 mozilla/embedding/browser/activex/tests/RegMozCtl/RegMozCtl.rc create mode 100644 mozilla/embedding/browser/activex/tests/RegMozCtl/RegMozCtlDlg.cpp create mode 100644 mozilla/embedding/browser/activex/tests/RegMozCtl/RegMozCtlDlg.h create mode 100644 mozilla/embedding/browser/activex/tests/RegMozCtl/StdAfx.cpp create mode 100644 mozilla/embedding/browser/activex/tests/RegMozCtl/StdAfx.h create mode 100644 mozilla/embedding/browser/activex/tests/RegMozCtl/res/RegMozCtl.ico create mode 100644 mozilla/embedding/browser/activex/tests/RegMozCtl/res/RegMozCtl.rc2 create mode 100644 mozilla/embedding/browser/activex/tests/RegMozCtl/resource.h create mode 100644 mozilla/embedding/browser/activex/tests/cbrowse/CBrowseDlg.cpp create mode 100644 mozilla/embedding/browser/activex/tests/cbrowse/CBrowseDlg.h create mode 100644 mozilla/embedding/browser/activex/tests/cbrowse/CBrowserCtlSite.cpp create mode 100644 mozilla/embedding/browser/activex/tests/cbrowse/CBrowserCtlSite.h create mode 100644 mozilla/embedding/browser/activex/tests/cbrowse/CBrowserCtlSite.rgs create mode 100644 mozilla/embedding/browser/activex/tests/cbrowse/Cbrowse.idl create mode 100644 mozilla/embedding/browser/activex/tests/cbrowse/Cbrowse.rgs create mode 100644 mozilla/embedding/browser/activex/tests/cbrowse/ControlEventSink.cpp create mode 100644 mozilla/embedding/browser/activex/tests/cbrowse/ControlEventSink.h create mode 100644 mozilla/embedding/browser/activex/tests/cbrowse/ControlEventSink.rgs create mode 100644 mozilla/embedding/browser/activex/tests/cbrowse/EditToolBar.cpp create mode 100644 mozilla/embedding/browser/activex/tests/cbrowse/EditToolBar.h create mode 100644 mozilla/embedding/browser/activex/tests/cbrowse/Html/main.htm create mode 100644 mozilla/embedding/browser/activex/tests/cbrowse/PickerDlg.cpp create mode 100644 mozilla/embedding/browser/activex/tests/cbrowse/PickerDlg.h create mode 100644 mozilla/embedding/browser/activex/tests/cbrowse/Scripts/Basic.vbs create mode 100644 mozilla/embedding/browser/activex/tests/cbrowse/Scripts/NewWindow.vbs create mode 100644 mozilla/embedding/browser/activex/tests/cbrowse/Scripts/Post.vbs create mode 100644 mozilla/embedding/browser/activex/tests/cbrowse/StdAfx.cpp create mode 100644 mozilla/embedding/browser/activex/tests/cbrowse/StdAfx.h create mode 100644 mozilla/embedding/browser/activex/tests/cbrowse/TabDOM.cpp create mode 100644 mozilla/embedding/browser/activex/tests/cbrowse/TabDOM.h create mode 100644 mozilla/embedding/browser/activex/tests/cbrowse/TabMessages.cpp create mode 100644 mozilla/embedding/browser/activex/tests/cbrowse/TabMessages.h create mode 100644 mozilla/embedding/browser/activex/tests/cbrowse/TabTests.cpp create mode 100644 mozilla/embedding/browser/activex/tests/cbrowse/TabTests.h create mode 100644 mozilla/embedding/browser/activex/tests/cbrowse/TestScriptHelper.cpp create mode 100644 mozilla/embedding/browser/activex/tests/cbrowse/TestScriptHelper.h create mode 100644 mozilla/embedding/browser/activex/tests/cbrowse/TestScriptHelper.rgs create mode 100644 mozilla/embedding/browser/activex/tests/cbrowse/Tests.cpp create mode 100644 mozilla/embedding/browser/activex/tests/cbrowse/Tests.h create mode 100644 mozilla/embedding/browser/activex/tests/cbrowse/cbrowse.cpp create mode 100644 mozilla/embedding/browser/activex/tests/cbrowse/cbrowse.dsp create mode 100644 mozilla/embedding/browser/activex/tests/cbrowse/cbrowse.h create mode 100644 mozilla/embedding/browser/activex/tests/cbrowse/cbrowse.rc create mode 100644 mozilla/embedding/browser/activex/tests/cbrowse/res/cbrowse.ico create mode 100644 mozilla/embedding/browser/activex/tests/cbrowse/res/cbrowse.rc2 create mode 100644 mozilla/embedding/browser/activex/tests/cbrowse/res/closedfolder.ico create mode 100644 mozilla/embedding/browser/activex/tests/cbrowse/res/openfolder.ico create mode 100644 mozilla/embedding/browser/activex/tests/cbrowse/res/test.ico create mode 100644 mozilla/embedding/browser/activex/tests/cbrowse/res/testfailed.ico create mode 100644 mozilla/embedding/browser/activex/tests/cbrowse/res/testpartial.ico create mode 100644 mozilla/embedding/browser/activex/tests/cbrowse/res/testpassed.ico create mode 100644 mozilla/embedding/browser/activex/tests/cbrowse/res/toolbar1.bmp create mode 100644 mozilla/embedding/browser/activex/tests/cbrowse/resource.h create mode 100644 mozilla/embedding/browser/activex/tests/vbrowse/VBrowse.vbp create mode 100644 mozilla/embedding/browser/activex/tests/vbrowse/browser.frm create mode 100644 mozilla/embedding/browser/activex/tests/vbrowse/browser.frx create mode 100644 mozilla/embedding/browser/activex/tests/vbrowse/frmExplorer.frm create mode 100644 mozilla/embedding/browser/activex/tests/vbrowse/frmToolBar.frm create mode 100644 mozilla/embedding/browser/activex/tests/vbrowse/frmToolBar.frx diff --git a/mozilla/embedding/browser/activex/tests/IEPatcher/DlgProxy.cpp b/mozilla/embedding/browser/activex/tests/IEPatcher/DlgProxy.cpp new file mode 100644 index 00000000000..d53b68447aa --- /dev/null +++ b/mozilla/embedding/browser/activex/tests/IEPatcher/DlgProxy.cpp @@ -0,0 +1,86 @@ +// DlgProxy.cpp : implementation file +// + +#include "stdafx.h" +#include "IEPatcher.h" +#include "DlgProxy.h" +#include "IEPatcherDlg.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// CIEPatcherDlgAutoProxy + +IMPLEMENT_DYNCREATE(CIEPatcherDlgAutoProxy, CCmdTarget) + +CIEPatcherDlgAutoProxy::CIEPatcherDlgAutoProxy() +{ + EnableAutomation(); + + // To keep the application running as long as an OLE automation + // object is active, the constructor calls AfxOleLockApp. + AfxOleLockApp(); + + // Get access to the dialog through the application's + // main window pointer. Set the proxy's internal pointer + // to point to the dialog, and set the dialog's back pointer to + // this proxy. + ASSERT (AfxGetApp()->m_pMainWnd != NULL); + ASSERT_VALID (AfxGetApp()->m_pMainWnd); + ASSERT_KINDOF(CIEPatcherDlg, AfxGetApp()->m_pMainWnd); + m_pDialog = (CIEPatcherDlg*) AfxGetApp()->m_pMainWnd; + m_pDialog->m_pAutoProxy = this; +} + +CIEPatcherDlgAutoProxy::~CIEPatcherDlgAutoProxy() +{ + // To terminate the application when all objects created with + // with OLE automation, the destructor calls AfxOleUnlockApp. + // Among other things, this will destroy the main dialog + AfxOleUnlockApp(); +} + +void CIEPatcherDlgAutoProxy::OnFinalRelease() +{ + // When the last reference for an automation object is released + // OnFinalRelease is called. The base class will automatically + // deletes the object. Add additional cleanup required for your + // object before calling the base class. + + CCmdTarget::OnFinalRelease(); +} + +BEGIN_MESSAGE_MAP(CIEPatcherDlgAutoProxy, CCmdTarget) + //{{AFX_MSG_MAP(CIEPatcherDlgAutoProxy) + // NOTE - the ClassWizard will add and remove mapping macros here. + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +BEGIN_DISPATCH_MAP(CIEPatcherDlgAutoProxy, CCmdTarget) + //{{AFX_DISPATCH_MAP(CIEPatcherDlgAutoProxy) + // NOTE - the ClassWizard will add and remove mapping macros here. + //}}AFX_DISPATCH_MAP +END_DISPATCH_MAP() + +// Note: we add support for IID_IIEPatcher to support typesafe binding +// from VBA. This IID must match the GUID that is attached to the +// dispinterface in the .ODL file. + +// {A6031677-3B36-11D2-B44D-00600819607E} +static const IID IID_IIEPatcher = +{ 0xa6031677, 0x3b36, 0x11d2, { 0xb4, 0x4d, 0x0, 0x60, 0x8, 0x19, 0x60, 0x7e } }; + +BEGIN_INTERFACE_MAP(CIEPatcherDlgAutoProxy, CCmdTarget) + INTERFACE_PART(CIEPatcherDlgAutoProxy, IID_IIEPatcher, Dispatch) +END_INTERFACE_MAP() + +// The IMPLEMENT_OLECREATE2 macro is defined in StdAfx.h of this project +// {A6031675-3B36-11D2-B44D-00600819607E} +IMPLEMENT_OLECREATE2(CIEPatcherDlgAutoProxy, "IEPatcher.Application", 0xa6031675, 0x3b36, 0x11d2, 0xb4, 0x4d, 0x0, 0x60, 0x8, 0x19, 0x60, 0x7e) + +///////////////////////////////////////////////////////////////////////////// +// CIEPatcherDlgAutoProxy message handlers diff --git a/mozilla/embedding/browser/activex/tests/IEPatcher/DlgProxy.h b/mozilla/embedding/browser/activex/tests/IEPatcher/DlgProxy.h new file mode 100644 index 00000000000..f90ba1d322a --- /dev/null +++ b/mozilla/embedding/browser/activex/tests/IEPatcher/DlgProxy.h @@ -0,0 +1,61 @@ +// DlgProxy.h : header file +// + +#if !defined(AFX_DLGPROXY_H__A603167E_3B36_11D2_B44D_00600819607E__INCLUDED_) +#define AFX_DLGPROXY_H__A603167E_3B36_11D2_B44D_00600819607E__INCLUDED_ + +#if _MSC_VER >= 1000 +#pragma once +#endif // _MSC_VER >= 1000 + +class CIEPatcherDlg; + +///////////////////////////////////////////////////////////////////////////// +// CIEPatcherDlgAutoProxy command target + +class CIEPatcherDlgAutoProxy : public CCmdTarget +{ + DECLARE_DYNCREATE(CIEPatcherDlgAutoProxy) + + CIEPatcherDlgAutoProxy(); // protected constructor used by dynamic creation + +// Attributes +public: + CIEPatcherDlg* m_pDialog; + +// Operations +public: + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CIEPatcherDlgAutoProxy) + public: + virtual void OnFinalRelease(); + //}}AFX_VIRTUAL + +// Implementation +protected: + virtual ~CIEPatcherDlgAutoProxy(); + + // Generated message map functions + //{{AFX_MSG(CIEPatcherDlgAutoProxy) + // NOTE - the ClassWizard will add and remove member functions here. + //}}AFX_MSG + + DECLARE_MESSAGE_MAP() + DECLARE_OLECREATE(CIEPatcherDlgAutoProxy) + + // Generated OLE dispatch map functions + //{{AFX_DISPATCH(CIEPatcherDlgAutoProxy) + // NOTE - the ClassWizard will add and remove member functions here. + //}}AFX_DISPATCH + DECLARE_DISPATCH_MAP() + DECLARE_INTERFACE_MAP() +}; + +///////////////////////////////////////////////////////////////////////////// + +//{{AFX_INSERT_LOCATION}} +// Microsoft Developer Studio will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_DLGPROXY_H__A603167E_3B36_11D2_B44D_00600819607E__INCLUDED_) diff --git a/mozilla/embedding/browser/activex/tests/IEPatcher/IEPatcher.cpp b/mozilla/embedding/browser/activex/tests/IEPatcher/IEPatcher.cpp new file mode 100644 index 00000000000..349dea4eca6 --- /dev/null +++ b/mozilla/embedding/browser/activex/tests/IEPatcher/IEPatcher.cpp @@ -0,0 +1,93 @@ +// IEPatcher.cpp : Defines the class behaviors for the application. +// + +#include "stdafx.h" +#include "IEPatcher.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// CIEPatcherApp + +BEGIN_MESSAGE_MAP(CIEPatcherApp, CWinApp) + //{{AFX_MSG_MAP(CIEPatcherApp) + // NOTE - the ClassWizard will add and remove mapping macros here. + // DO NOT EDIT what you see in these blocks of generated code! + //}}AFX_MSG + ON_COMMAND(ID_HELP, CWinApp::OnHelp) +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// CIEPatcherApp construction + +CIEPatcherApp::CIEPatcherApp() +{ + m_pIEPatcherDlg = NULL; +} + +///////////////////////////////////////////////////////////////////////////// +// The one and only CIEPatcherApp object + +CIEPatcherApp theApp; + +///////////////////////////////////////////////////////////////////////////// +// CIEPatcherApp initialization + +BOOL CIEPatcherApp::InitInstance() +{ + // Initialize OLE libraries + if (!AfxOleInit()) + { + AfxMessageBox(IDP_OLE_INIT_FAILED); + return FALSE; + } + + // Standard initialization + // If you are not using these features and wish to reduce the size + // of your final executable, you should remove from the following + // the specific initialization routines you do not need. + +#ifdef _AFXDLL + Enable3dControls(); // Call this when using MFC in a shared DLL +#else + Enable3dControlsStatic(); // Call this when linking to MFC statically +#endif + + // Parse the command line to see if launched as OLE server + if (RunEmbedded() || RunAutomated()) + { + // Register all OLE server (factories) as running. This enables the + // OLE libraries to create objects from other applications. + COleTemplateServer::RegisterAll(); + } + else + { + // When a server application is launched stand-alone, it is a good idea + // to update the system registry in case it has been damaged. + COleObjectFactory::UpdateRegistryAll(); + } + + // Now the scanner window + m_pIEPatcherDlg = new CIEPatcherDlg; + m_pMainWnd = m_pIEPatcherDlg; + int nResponse = m_pIEPatcherDlg->DoModal(); + if (nResponse == IDOK) + { + // TODO: Place code here to handle when the dialog is + // dismissed with OK + } + else if (nResponse == IDCANCEL) + { + // TODO: Place code here to handle when the dialog is + // dismissed with Cancel + } + delete m_pIEPatcherDlg; + + // Since the dialog has been closed, return FALSE so that we exit the + // application, rather than start the application's message pump. + return FALSE; +} diff --git a/mozilla/embedding/browser/activex/tests/IEPatcher/IEPatcher.dsp b/mozilla/embedding/browser/activex/tests/IEPatcher/IEPatcher.dsp new file mode 100644 index 00000000000..53b943b34f4 --- /dev/null +++ b/mozilla/embedding/browser/activex/tests/IEPatcher/IEPatcher.dsp @@ -0,0 +1,203 @@ +# Microsoft Developer Studio Project File - Name="IEPatcher" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Application" 0x0101 + +CFG=IEPatcher - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "IEPatcher.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "IEPatcher.mak" CFG="IEPatcher - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "IEPatcher - Win32 Release" (based on "Win32 (x86) Application") +!MESSAGE "IEPatcher - Win32 Debug" (based on "Win32 (x86) Application") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "IEPatcher - Win32 Release" + +# PROP BASE Use_MFC 6 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 5 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /Yu"stdafx.h" /FD /c +# ADD CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /Yu"stdafx.h" /FD /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 +# ADD BASE RSC /l 0x1809 /d "NDEBUG" /d "_AFXDLL" +# ADD RSC /l 0x1809 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 /nologo /subsystem:windows /machine:I386 +# ADD LINK32 /nologo /subsystem:windows /machine:I386 + +!ELSEIF "$(CFG)" == "IEPatcher - Win32 Debug" + +# PROP BASE Use_MFC 6 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 5 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /Yu"stdafx.h" /FD /c +# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /Yu"stdafx.h" /FD /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 +# ADD BASE RSC /l 0x1809 /d "_DEBUG" /d "_AFXDLL" +# ADD RSC /l 0x1809 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept +# ADD LINK32 /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept + +!ENDIF + +# Begin Target + +# Name "IEPatcher - Win32 Release" +# Name "IEPatcher - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=.\DlgProxy.cpp +# End Source File +# Begin Source File + +SOURCE=.\IEPatcher.cpp +# End Source File +# Begin Source File + +SOURCE=.\IEPatcher.odl +# End Source File +# Begin Source File + +SOURCE=.\IEPatcher.rc +# End Source File +# Begin Source File + +SOURCE=.\IEPatcherDlg.cpp +# End Source File +# Begin Source File + +SOURCE=.\ScanForFilesDlg.cpp +# End Source File +# Begin Source File + +SOURCE=.\ScannerThread.cpp +# End Source File +# Begin Source File + +SOURCE=.\ScannerWnd.cpp +# End Source File +# Begin Source File + +SOURCE=.\StdAfx.cpp +# ADD CPP /Yc"stdafx.h" +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=.\DlgProxy.h +# End Source File +# Begin Source File + +SOURCE=.\IEPatcher.h +# End Source File +# Begin Source File + +SOURCE=.\IEPatcherDlg.h +# End Source File +# Begin Source File + +SOURCE=.\Resource.h +# End Source File +# Begin Source File + +SOURCE=.\ScanForFilesDlg.h +# End Source File +# Begin Source File + +SOURCE=.\ScannerThread.h +# End Source File +# Begin Source File + +SOURCE=.\ScannerWnd.h +# End Source File +# Begin Source File + +SOURCE=.\StdAfx.h +# End Source File +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe" +# Begin Source File + +SOURCE=.\res\containsie.ico +# End Source File +# Begin Source File + +SOURCE=.\res\containsmozilla.ico +# End Source File +# Begin Source File + +SOURCE=.\res\doesntcontainie.ico +# End Source File +# Begin Source File + +SOURCE=.\res\IEPatcher.ico +# End Source File +# Begin Source File + +SOURCE=.\res\IEPatcher.rc2 +# End Source File +# Begin Source File + +SOURCE=.\res\unknownstatus.ico +# End Source File +# End Group +# Begin Source File + +SOURCE=.\IEPatcher.reg +# End Source File +# Begin Source File + +SOURCE=.\ReadMe.txt +# End Source File +# End Target +# End Project diff --git a/mozilla/embedding/browser/activex/tests/IEPatcher/IEPatcher.h b/mozilla/embedding/browser/activex/tests/IEPatcher/IEPatcher.h new file mode 100644 index 00000000000..802c4a30264 --- /dev/null +++ b/mozilla/embedding/browser/activex/tests/IEPatcher/IEPatcher.h @@ -0,0 +1,53 @@ +// IEPatcher.h : main header file for the IEPATCHER application +// + +#if !defined(AFX_IEPATCHER_H__A603167A_3B36_11D2_B44D_00600819607E__INCLUDED_) +#define AFX_IEPATCHER_H__A603167A_3B36_11D2_B44D_00600819607E__INCLUDED_ + +#if _MSC_VER >= 1000 +#pragma once +#endif // _MSC_VER >= 1000 + +#ifndef __AFXWIN_H__ + #error include 'stdafx.h' before including this file for PCH +#endif + +#include "resource.h" // main symbols + +#include "IEPatcherDlg.h" + +///////////////////////////////////////////////////////////////////////////// +// CIEPatcherApp: +// See IEPatcher.cpp for the implementation of this class +// + +class CIEPatcherApp : public CWinApp +{ +public: + CIEPatcherApp(); + + CIEPatcherDlg *m_pIEPatcherDlg; + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CIEPatcherApp) + public: + virtual BOOL InitInstance(); + //}}AFX_VIRTUAL + +// Implementation + + //{{AFX_MSG(CIEPatcherApp) + // NOTE - the ClassWizard will add and remove member functions here. + // DO NOT EDIT what you see in these blocks of generated code ! + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +}; + + +///////////////////////////////////////////////////////////////////////////// + +//{{AFX_INSERT_LOCATION}} +// Microsoft Developer Studio will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_IEPATCHER_H__A603167A_3B36_11D2_B44D_00600819607E__INCLUDED_) diff --git a/mozilla/embedding/browser/activex/tests/IEPatcher/IEPatcher.odl b/mozilla/embedding/browser/activex/tests/IEPatcher/IEPatcher.odl new file mode 100644 index 00000000000..f50dabc6e76 --- /dev/null +++ b/mozilla/embedding/browser/activex/tests/IEPatcher/IEPatcher.odl @@ -0,0 +1,41 @@ +// IEPatcher.odl : type library source for IEPatcher.exe + +// This file will be processed by the MIDL compiler to produce the +// type library (IEPatcher.tlb). + +[ uuid(A6031676-3B36-11D2-B44D-00600819607E), version(1.0) ] +library IEPatcher +{ + importlib("stdole32.tlb"); + + + // Primary dispatch interface for CIEPatcherDoc + + [ uuid(A6031677-3B36-11D2-B44D-00600819607E) ] + dispinterface IIEPatcher + { + properties: + // NOTE - ClassWizard will maintain property information here. + // Use extreme caution when editing this section. + //{{AFX_ODL_PROP(CIEPatcherDlgAutoProxy) + //}}AFX_ODL_PROP + + methods: + // NOTE - ClassWizard will maintain method information here. + // Use extreme caution when editing this section. + //{{AFX_ODL_METHOD(CIEPatcherDlgAutoProxy) + //}}AFX_ODL_METHOD + + }; + + // Class information for CIEPatcherDoc + + [ uuid(A6031675-3B36-11D2-B44D-00600819607E) ] + coclass IEPatcher + { + [default] dispinterface IIEPatcher; + }; + + //{{AFX_APPEND_ODL}} + //}}AFX_APPEND_ODL}} +}; diff --git a/mozilla/embedding/browser/activex/tests/IEPatcher/IEPatcher.rc b/mozilla/embedding/browser/activex/tests/IEPatcher/IEPatcher.rc new file mode 100644 index 00000000000..8c793670a7e --- /dev/null +++ b/mozilla/embedding/browser/activex/tests/IEPatcher/IEPatcher.rc @@ -0,0 +1,236 @@ +//Microsoft Developer Studio generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "afxres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_IEPATCHER_DIALOG DIALOGEX 0, 0, 323, 202 +STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +EXSTYLE WS_EX_APPWINDOW +CAPTION "IE to Mozilla Patcher" +FONT 8, "MS Sans Serif" +BEGIN + PUSHBUTTON "&Scan...",IDC_SCAN,266,6,50,14 + CONTROL "List1",IDC_FILELIST,"SysListView32",LVS_REPORT | + LVS_SHOWSELALWAYS | LVS_SORTASCENDING | WS_BORDER | + WS_TABSTOP,7,59,309,136 + PUSHBUTTON "&Patch",IDC_PATCH,266,26,50,14 + LTEXT "Add files to the source list by selecting ""Scan"". Files containing references to Internet Explorer or Mozilla will be highlighted.", + IDC_STATIC,7,6,257,18 + LTEXT "Choose ""Patch"" to apply the Mozilla patch to any selected files. The patching process does not overwrite the original file but creates a new file prepended with ""moz_"" which you may test at your leisure.", + IDC_STATIC,7,30,257,26 +END + +IDD_SCANFORFILES DIALOG DISCARDABLE 0, 0, 227, 63 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Scan for files" +FONT 8, "MS Sans Serif" +BEGIN + LTEXT "Type a filename or wildcard pattern or use ""Pick File..."" or ""Pick Folder...""", + IDC_STATIC,7,7,155,18 + EDITTEXT IDC_FILEPATTERN,5,25,158,13,ES_AUTOHSCROLL + PUSHBUTTON "Pick File...",IDC_SELECTFILE,29,43,55,13 + DEFPUSHBUTTON "OK",IDOK,170,5,50,14 + PUSHBUTTON "Cancel",IDCANCEL,170,25,50,14 + PUSHBUTTON "Pick Folder...",IDC_SELECTFOLDER,89,43,55,13 +END + + +#ifndef _MAC +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,0,0,1 + PRODUCTVERSION 1,0,0,1 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x4L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904B0" + BEGIN + VALUE "CompanyName", "\0" + VALUE "FileDescription", "IEPatcher MFC Application\0" + VALUE "FileVersion", "1, 0, 0, 1\0" + VALUE "InternalName", "IEPatcher\0" + VALUE "LegalCopyright", "Copyright (C) 1998\0" + VALUE "LegalTrademarks", "\0" + VALUE "OriginalFilename", "IEPatcher.EXE\0" + VALUE "ProductName", "IEPatcher Application\0" + VALUE "ProductVersion", "1, 0, 0, 1\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + +#endif // !_MAC + + +///////////////////////////////////////////////////////////////////////////// +// +// DESIGNINFO +// + +#ifdef APSTUDIO_INVOKED +GUIDELINES DESIGNINFO DISCARDABLE +BEGIN + IDD_IEPATCHER_DIALOG, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 316 + TOPMARGIN, 6 + BOTTOMMARGIN, 195 + END + + IDD_SCANFORFILES, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 220 + TOPMARGIN, 7 + BOTTOMMARGIN, 56 + END +END +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDI_CONTAINSIE ICON DISCARDABLE "res\\containsie.ico" +IDI_DOESNTCONTAINIE ICON DISCARDABLE "res\\doesntcontainie.ico" +IDI_CONTAINSMOZILLA ICON DISCARDABLE "res\\containsmozilla.ico" +IDI_UNKNOWNSTATUS ICON DISCARDABLE "res\\unknownstatus.ico" + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE DISCARDABLE +BEGIN + IDP_OLE_INIT_FAILED "OLE initialization failed. Make sure that the OLE libraries are the correct version." +END + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + +///////////////////////////////////////////////////////////////////////////// +// English (Ireland) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENI) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_EIRE +#pragma code_page(1252) +#endif //_WIN32 + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE DISCARDABLE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE DISCARDABLE +BEGIN + "#include ""afxres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE DISCARDABLE +BEGIN + "#define _AFX_NO_SPLITTER_RESOURCES\r\n" + "#define _AFX_NO_OLE_RESOURCES\r\n" + "#define _AFX_NO_TRACKER_RESOURCES\r\n" + "#define _AFX_NO_PROPERTY_RESOURCES\r\n" + "\r\n" + "#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n" + "#ifdef _WIN32\r\n" + "LANGUAGE 9, 1\r\n" + "#pragma code_page(1252)\r\n" + "#endif\r\n" + "#include ""res\\IEPatcher.rc2"" // non-Microsoft Visual C++ edited resources\r\n" + "#include ""afxres.rc"" // Standard components\r\n" + "#endif\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDR_MAINFRAME ICON DISCARDABLE "res\\IEPatcher.ico" +#endif // English (Ireland) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// +#define _AFX_NO_SPLITTER_RESOURCES +#define _AFX_NO_OLE_RESOURCES +#define _AFX_NO_TRACKER_RESOURCES +#define _AFX_NO_PROPERTY_RESOURCES + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE 9, 1 +#pragma code_page(1252) +#endif +#include "res\IEPatcher.rc2" // non-Microsoft Visual C++ edited resources +#include "afxres.rc" // Standard components +#endif +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/mozilla/embedding/browser/activex/tests/IEPatcher/IEPatcher.reg b/mozilla/embedding/browser/activex/tests/IEPatcher/IEPatcher.reg new file mode 100644 index 00000000000..026ae7bef0b --- /dev/null +++ b/mozilla/embedding/browser/activex/tests/IEPatcher/IEPatcher.reg @@ -0,0 +1,13 @@ +REGEDIT +; This .REG file may be used by your SETUP program. +; If a SETUP program is not available, the entries below will be +; registered in your InitInstance automatically with a call to +; CWinApp::RegisterShellFileTypes and COleObjectFactory::UpdateRegistryAll. + + +HKEY_CLASSES_ROOT\IEPatcher.Application = IEPatcher Application +HKEY_CLASSES_ROOT\IEPatcher.Application\CLSID = {A6031675-3B36-11D2-B44D-00600819607E} + +HKEY_CLASSES_ROOT\CLSID\{A6031675-3B36-11D2-B44D-00600819607E} = IEPatcher Application +HKEY_CLASSES_ROOT\CLSID\{A6031675-3B36-11D2-B44D-00600819607E}\ProgId = IEPatcher.Application +HKEY_CLASSES_ROOT\CLSID\{A6031675-3B36-11D2-B44D-00600819607E}\LocalServer32 = IEPATCHER.EXE diff --git a/mozilla/embedding/browser/activex/tests/IEPatcher/IEPatcherDlg.cpp b/mozilla/embedding/browser/activex/tests/IEPatcher/IEPatcherDlg.cpp new file mode 100644 index 00000000000..b4cece53424 --- /dev/null +++ b/mozilla/embedding/browser/activex/tests/IEPatcher/IEPatcherDlg.cpp @@ -0,0 +1,622 @@ +// IEPatcherDlg.cpp : implementation file +// + +#include "stdafx.h" +#include "IEPatcher.h" +#include "IEPatcherDlg.h" +#include "ScanForFilesDlg.h" +#include "ScannerThread.h" +#include "DlgProxy.h" + +#include +#include + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +const CLSID CLSID_WebBrowser_V1 = { 0xEAB22AC3, 0x30C1, 0x11CF, { 0xA7, 0xEB, 0x00, 0x00, 0xC0, 0x5B, 0xAE, 0x0B } }; +const CLSID CLSID_WebBrowser = { 0x8856F961, 0x340A, 0x11D0, { 0xA9, 0x6B, 0x00, 0xC0, 0x4F, 0xD7, 0x05, 0xA2 } }; +const CLSID CLSID_InternetExplorer = { 0x0002DF01, 0x0000, 0x0000, { 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46 } }; +const CLSID CLSID_MozillaBrowser = {0x1339B54C,0x3453,0x11D2,{0x93,0xB9,0x00,0x00,0x00,0x00,0x00,0x00}}; +const IID IID_IWebBrowser = { 0xEAB22AC1, 0x30C1, 0x11CF, { 0xA7, 0xEB, 0x00, 0x00, 0xC0, 0x5B, 0xAE, 0x0B } }; +const IID IID_IWebBrowser2 = { 0xD30C1661, 0xCDAF, 0x11d0, { 0x8A, 0x3E, 0x00, 0xC0, 0x4F, 0xC9, 0xE2, 0x6E } }; +const IID IID_IWebBrowserApp = { 0x0002DF05, 0x0000, 0x0000, { 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46 } }; + + +#define ITEM_PATCHSTATUS 1 + +#define IMG_DOESNTCONTAINIE 0 +#define IMG_CONTAINSIE 1 +#define IMG_CONTAINSMOZILLA 2 +#define IMG_UNKNOWNSTATUS 3 + +///////////////////////////////////////////////////////////////////////////// +// CIEPatcherDlg dialog + +IMPLEMENT_DYNAMIC(CIEPatcherDlg, CDialog); + +CIEPatcherDlg::CIEPatcherDlg(CWnd* pParent /*=NULL*/) + : CDialog(CIEPatcherDlg::IDD, pParent) +{ + //{{AFX_DATA_INIT(CIEPatcherDlg) + //}}AFX_DATA_INIT + // Note that LoadIcon does not require a subsequent DestroyIcon in Win32 + m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); + m_pAutoProxy = NULL; +} + + +CIEPatcherDlg::~CIEPatcherDlg() +{ + // If there is an automation proxy for this dialog, set + // its back pointer to this dialog to NULL, so it knows + // the dialog has been deleted. + if (m_pAutoProxy != NULL) + m_pAutoProxy->m_pDialog = NULL; +} + + +void CIEPatcherDlg::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + //{{AFX_DATA_MAP(CIEPatcherDlg) + DDX_Control(pDX, IDC_PATCH, m_btnPatch); + DDX_Control(pDX, IDC_FILELIST, m_cFileList); + //}}AFX_DATA_MAP +} + + +BEGIN_MESSAGE_MAP(CIEPatcherDlg, CDialog) + //{{AFX_MSG_MAP(CIEPatcherDlg) + ON_WM_PAINT() + ON_WM_QUERYDRAGICON() + ON_WM_CLOSE() + ON_BN_CLICKED(IDC_SCAN, OnScan) + ON_NOTIFY(NM_CLICK, IDC_FILELIST, OnClickFilelist) + ON_BN_CLICKED(IDC_PATCH, OnPatch) + //}}AFX_MSG_MAP + ON_MESSAGE(WM_UPDATEFILESTATUS, OnUpdateFileStatus) +END_MESSAGE_MAP() + + +///////////////////////////////////////////////////////////////////////////// +// CIEPatcherDlg message handlers + +BOOL CIEPatcherDlg::OnInitDialog() +{ + CDialog::OnInitDialog(); + + // Start the scanner thread + AfxBeginThread(RUNTIME_CLASS(CScannerThread), 0); + + // Set the icon for this dialog. The framework does this automatically + // when the application's main window is not a dialog + SetIcon(m_hIcon, TRUE); // Set big icon + SetIcon(m_hIcon, FALSE); // Set small icon + + // Add icons to image list + m_cImageList.Create(16, 16, ILC_MASK, 0, 5); + m_cImageList.Add(AfxGetApp()->LoadIcon(IDI_DOESNTCONTAINIE)); + m_cImageList.Add(AfxGetApp()->LoadIcon(IDI_CONTAINSIE)); + m_cImageList.Add(AfxGetApp()->LoadIcon(IDI_CONTAINSMOZILLA)); + m_cImageList.Add(AfxGetApp()->LoadIcon(IDI_UNKNOWNSTATUS)); + + // Associate image list with file list + m_cFileList.SetImageList(&m_cImageList, LVSIL_SMALL); + + struct ColumnData + { + TCHAR *sColumnTitle; + int nPercentageWidth; + int nFormat; + }; + + ColumnData aColData[] = + { + { _T("File"), 70, LVCFMT_LEFT }, + { _T("Patch Status"), 30, LVCFMT_LEFT } + }; + + // Get the size of the file list control and neatly + // divide it into columns + + CRect rcFileList; + m_cFileList.GetClientRect(&rcFileList); + + int nColTotal = sizeof(aColData) / sizeof(aColData[0]); + int nWidthRemaining = rcFileList.Width(); + + for (int nCol = 0; nCol < nColTotal; nCol++) + { + ColumnData *pData = &aColData[nCol]; + + int nColWidth = (rcFileList.Width() * pData->nPercentageWidth) / 100; + if (nCol == nColTotal - 1) + { + nColWidth = nWidthRemaining; + } + else if (nColWidth > nWidthRemaining) + { + nColWidth = nWidthRemaining; + } + + m_cFileList.InsertColumn(nCol, pData->sColumnTitle, pData->nFormat, nColWidth); + + nWidthRemaining -= nColWidth; + if (nColWidth <= 0) + { + break; + } + } + + return TRUE; // return TRUE unless you set the focus to a control +} + + +// If you add a minimize button to your dialog, you will need the code below +// to draw the icon. For MFC applications using the document/view model, +// this is automatically done for you by the framework. + +void CIEPatcherDlg::OnPaint() +{ + if (IsIconic()) + { + CPaintDC dc(this); // device context for painting + + SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0); + + // Center icon in client rectangle + int cxIcon = GetSystemMetrics(SM_CXICON); + int cyIcon = GetSystemMetrics(SM_CYICON); + CRect rect; + GetClientRect(&rect); + int x = (rect.Width() - cxIcon + 1) / 2; + int y = (rect.Height() - cyIcon + 1) / 2; + + // Draw the icon + dc.DrawIcon(x, y, m_hIcon); + } + else + { + CDialog::OnPaint(); + } +} + + +// The system calls this to obtain the cursor to display while the user drags +// the minimized window. +HCURSOR CIEPatcherDlg::OnQueryDragIcon() +{ + return (HCURSOR) m_hIcon; +} + + +// Automation servers should not exit when a user closes the UI +// if a controller still holds on to one of its objects. These +// message handlers make sure that if the proxy is still in use, +// then the UI is hidden but the dialog remains around if it +// is dismissed. + +void CIEPatcherDlg::OnClose() +{ + if (CanExit()) + CDialog::OnClose(); +} + + +LONG CIEPatcherDlg::OnUpdateFileStatus(WPARAM wParam, LPARAM lParam) +{ + PatchStatus ps = (PatchStatus) wParam; + TCHAR *pszFile = (TCHAR *) lParam; + UpdateFileStatus(pszFile, ps); + return 0; +} + + +void CIEPatcherDlg::OnScan() +{ + CScanForFilesDlg dlg; + + if (dlg.DoModal() == IDOK) + { + CWaitCursor wc; + + CFileFind op; + if (op.FindFile(dlg.m_sFilePattern)) + { + op.FindNextFile(); + do { + if (!op.IsDirectory()) + { + AddFileToList(op.GetFilePath()); + } + } while (op.FindNextFile()); + op.Close(); + } + } +} + + +void CIEPatcherDlg::OnPatch() +{ + int nItem = -1; + do { + nItem = m_cFileList.GetNextItem(nItem, LVNI_ALL | LVNI_SELECTED); + if (nItem != -1) + { + m_cQueuedFileDataList[nItem]->ps = psPatchPending; + UpdateFileStatus(nItem, m_cQueuedFileDataList[nItem]->sFileName, m_cQueuedFileDataList[nItem]->ps); + } + } while (nItem != -1); +} + + +void CIEPatcherDlg::OnClickFilelist(NMHDR* pNMHDR, LRESULT* pResult) +{ + // Check if files are selected + + *pResult = 0; +} + + +/////////////////////////////////////////////////////////////////////////////// + + +BOOL CIEPatcherDlg::CanExit() +{ + // If the proxy object is still around, then the automation + // controller is still holding on to this application. Leave + // the dialog around, but hide its UI. + if (m_pAutoProxy != NULL) + { + ShowWindow(SW_HIDE); + return FALSE; + } + + return TRUE; +} + + +PatchStatus CIEPatcherDlg::ScanFile(const CString &sFileName) +{ + char *pszBuffer = NULL; + long nBufferSize = 0; + if (!ReadFileToBuffer(sFileName, &pszBuffer, &nBufferSize)) + { + return psFileError; + } + + PatchStatus ps = ScanBuffer(pszBuffer, nBufferSize, FALSE); + delete []pszBuffer; + return ps; +} + + +BOOL CIEPatcherDlg::WriteBufferToFile(const CString &sFileName, char *pszBuffer, long nBufferSize) +{ + CString sMessage; + sMessage.Format("Saving patched file \"%s\"", sFileName); + TraceProgress(sMessage); + + FILE *fDest = fopen(sFileName, "wb"); + if (fDest == NULL) + { + TraceProgress("Error: Could not open destination file"); + return FALSE; + } + + fwrite(pszBuffer, 1, nBufferSize, fDest); + fclose(fDest); + TraceProgress("File saved"); + + return TRUE; +} + + +BOOL CIEPatcherDlg::ReadFileToBuffer(const CString &sFileName, char **ppszBuffer, long *pnBufferSize) +{ + CString sProcessing; + sProcessing.Format("Processing file \"%s\"", sFileName); + TraceProgress(sProcessing); + + // Allocate a memory buffer to slurp up the whole file + struct _stat srcStat; + _stat(sFileName, &srcStat); + + char *pszBuffer = new char[srcStat.st_size / sizeof(char)]; + if (pszBuffer == NULL) + { + TraceProgress("Error: Could not allocate buffer for file"); + return FALSE; + } + FILE *fSrc = fopen(sFileName, "rb"); + if (fSrc == NULL) + { + TraceProgress("Error: Could not open file"); + delete []pszBuffer; + return FALSE; + } + size_t sizeSrc = srcStat.st_size; + size_t sizeRead = 0; + + // Dumb but effective + sizeRead = fread(pszBuffer, 1, sizeSrc, fSrc); + fclose(fSrc); + + if (sizeRead != sizeSrc) + { + TraceProgress("Error: Could not read all of file"); + delete []pszBuffer; + return FALSE; + } + + *ppszBuffer = pszBuffer; + *pnBufferSize = sizeRead; + + return TRUE; +} + + +PatchStatus CIEPatcherDlg::ScanBuffer(char *pszBuffer, long nBufferSize, BOOL bApplyPatch) +{ + if (nBufferSize < sizeof(CLSID)) + { + return psNotPatchable; + } + + TraceProgress("Scanning for IE..."); + + BOOL bPatchApplied = FALSE; + PatchStatus ps = psUnknownStatus; + + // Scan through buffer, one byte at a time doing a memcmp + for (size_t i = 0; i < nBufferSize - sizeof(CLSID); i++) + { + if (memcmp(&pszBuffer[i], &CLSID_MozillaBrowser, sizeof(CLSID)) == 0) + { + TraceProgress("Found CLSID_MozillaBrowser"); + if (ps == psUnknownStatus) + { + ps = psAlreadyPatched; + } + } + else if (memcmp(&pszBuffer[i], &CLSID_WebBrowser_V1, sizeof(CLSID)) == 0) + { + TraceProgress("Found CLSID_WebBrowser_V1"); + if (ps == psUnknownStatus) + { + ps = psPatchable; + } + if (bApplyPatch) + { + TraceProgress("Patching with CLSID_MozillaBrowser"); + memcpy(&pszBuffer[i], &CLSID_MozillaBrowser, sizeof(CLSID)); + bPatchApplied = TRUE; + } + } + else if (memcmp(&pszBuffer[i], &CLSID_WebBrowser, sizeof(CLSID)) == 0) + { + TraceProgress("Found CLSID_WebBrowser"); + if (ps == psUnknownStatus) + { + ps = psPatchable; + } + if (bApplyPatch) + { + TraceProgress("Patching with CLSID_MozillaBrowser"); + memcpy(&pszBuffer[i], &CLSID_MozillaBrowser, sizeof(CLSID)); + TraceProgress("Patching with CLSID_MozillaBrowser"); + bPatchApplied = TRUE; + } + } + else if (memcmp(&pszBuffer[i], &IID_IWebBrowser, sizeof(CLSID)) == 0) + { + TraceProgress("Found IID_IWebBrowser"); + if (ps == psUnknownStatus) + { + ps = psPatchable; + } + } + else if (memcmp(&pszBuffer[i], &CLSID_InternetExplorer, sizeof(CLSID)) == 0) + { + TraceProgress("Warning: Found CLSID_InternetExplorer, patching might not work"); + if (ps == psUnknownStatus) + { + ps = psMayBePatchable; + } + } + else if (memcmp(&pszBuffer[i], &IID_IWebBrowser2, sizeof(CLSID)) == 0) + { + TraceProgress("Found IID_IWebBrowser2"); + if (ps == psUnknownStatus) + { + ps = psPatchable; + } + } + else if (memcmp(&pszBuffer[i], &IID_IWebBrowserApp, sizeof(CLSID)) == 0) + { + TraceProgress("Found IID_IWebBrowserApp"); + if (ps == psUnknownStatus) + { + ps = psPatchable; + } + } + } + + if (ps == psUnknownStatus) + { + ps = psNotPatchable; + } + if (bApplyPatch) + { + ps = (bPatchApplied) ? psAlreadyPatched : psNotPatchable; + } + + TraceProgress("Scan completed"); + + return ps; +} + + +BOOL CIEPatcherDlg::PatchFile(const CString & sFileFrom, const CString & sFileTo, PatchStatus *pPatchStatus) +{ + if (sFileTo.IsEmpty()) + { + return FALSE; + } + if (sFileTo == sFileFrom) + { + TraceProgress("Warning: Patching disabled for safety reasons, source and destination names must differ"); + return FALSE; + } + + char *pszBuffer = NULL; + long nBufferSize = 0; + + if (!ReadFileToBuffer(sFileFrom, &pszBuffer, &nBufferSize)) + { + return FALSE; + } + + // Scan and patch the buffer + *pPatchStatus = ScanBuffer(pszBuffer, nBufferSize, TRUE); + if (*pPatchStatus == psNotPatchable) + { + TraceProgress("Error: Nothing was found to patch"); + } + else + { + // Write out the patch file + WriteBufferToFile(sFileTo, pszBuffer, nBufferSize); + } + + delete []pszBuffer; + return FALSE; +} + + +void CIEPatcherDlg::TraceProgress(const CString &sProgress) +{ + // TODO +} + + +void CIEPatcherDlg::AddFileToList(const CString & sFile) +{ + CSingleLock sl(&m_csQueuedFileDataList, TRUE); + + int nIndex = m_cFileList.GetItemCount(); + m_cFileList.InsertItem(nIndex, sFile, IMG_UNKNOWNSTATUS); + + QueuedFileData *pData = new QueuedFileData; + pData->ps = psUnknownStatus; + pData->sFileName = sFile; + pData->sPatchedFileName = sFile; + m_cQueuedFileDataList.Add(pData); + + UpdateFileStatus(nIndex, pData->ps); +} + + +void CIEPatcherDlg::UpdateFileStatus(int nFileIndex, const CString &sFile, PatchStatus ps) +{ + CString sStatus; + int nIconStatus = -1; + + switch (ps) + { + case psFileError: + sStatus = _T("File error"); + break; + + case psNotPatchable: + sStatus = _T("Nothing to patch"); + nIconStatus = IMG_DOESNTCONTAINIE; + break; + + case psPatchable: + sStatus = _T("Patchable"); + nIconStatus = IMG_CONTAINSIE; + break; + + case psMayBePatchable: + sStatus = _T("Maybe patchable"); + nIconStatus = IMG_CONTAINSIE; + break; + + case psAlreadyPatched: + sStatus = _T("Already patched"); + nIconStatus = IMG_CONTAINSMOZILLA; + break; + + case psUnknownStatus: + sStatus = _T("Status pending"); + nIconStatus = IMG_UNKNOWNSTATUS; + break; + + case psPatchPending: + sStatus = _T("Patch pending"); + break; + + default: + sStatus = _T("*** ERROR ***"); + break; + } + + if (nIconStatus != -1) + { + m_cFileList.SetItem(nFileIndex, -1, LVIF_IMAGE, NULL, nIconStatus, 0, 0, 0); + } + m_cFileList.SetItemText(nFileIndex, ITEM_PATCHSTATUS, sStatus); +} + + +void CIEPatcherDlg::UpdateFileStatus(const CString &sFile, PatchStatus ps) +{ + CSingleLock sl(&m_csQueuedFileDataList, TRUE); + + for (int n = 0; n < m_cQueuedFileDataList.GetSize(); n++) + { + if (m_cQueuedFileDataList[n]->sFileName == sFile) + { + UpdateFileStatus(n, sFile, ps); + m_cQueuedFileDataList[n]->ps = ps; + return; + } + } +} + + +BOOL CIEPatcherDlg::GetPendingFileToScan(CString & sFileToScan) +{ + CSingleLock sl(&m_csQueuedFileDataList, TRUE); + + for (int n = 0; n < m_cQueuedFileDataList.GetSize(); n++) + { + if (m_cQueuedFileDataList[n]->ps == psUnknownStatus) + { + sFileToScan = m_cQueuedFileDataList[n]->sFileName; + return TRUE; + } + } + return FALSE; +} + + +BOOL CIEPatcherDlg::GetPendingFileToPatch(CString & sFileToPatch) +{ + CSingleLock sl(&m_csQueuedFileDataList, TRUE); + + for (int n = 0; n < m_cQueuedFileDataList.GetSize(); n++) + { + if (m_cQueuedFileDataList[n]->ps == psPatchPending) + { + sFileToPatch = m_cQueuedFileDataList[n]->sFileName; + return TRUE; + } + } + return FALSE; +} diff --git a/mozilla/embedding/browser/activex/tests/IEPatcher/IEPatcherDlg.h b/mozilla/embedding/browser/activex/tests/IEPatcher/IEPatcherDlg.h new file mode 100644 index 00000000000..56bcd63b181 --- /dev/null +++ b/mozilla/embedding/browser/activex/tests/IEPatcher/IEPatcherDlg.h @@ -0,0 +1,105 @@ +// IEPatcherDlg.h : header file +// + +#if !defined(AFX_IEPATCHERDLG_H__A603167C_3B36_11D2_B44D_00600819607E__INCLUDED_) +#define AFX_IEPATCHERDLG_H__A603167C_3B36_11D2_B44D_00600819607E__INCLUDED_ + +#if _MSC_VER >= 1000 +#pragma once +#endif // _MSC_VER >= 1000 + +class CIEPatcherDlgAutoProxy; + +enum PatchStatus +{ + psFileError, + psUnknownStatus, + psPatchPending, + psNotPatchable, + psPatchable, + psMayBePatchable, + psAlreadyPatched +}; + +struct QueuedFileData +{ + CString sFileName; + CString sPatchedFileName; + PatchStatus ps; +}; + +#define WM_UPDATEFILESTATUS WM_USER+1 + +///////////////////////////////////////////////////////////////////////////// +// CIEPatcherDlg dialog + +class CIEPatcherDlg : public CDialog +{ + DECLARE_DYNAMIC(CIEPatcherDlg); + friend class CIEPatcherDlgAutoProxy; + +// Construction +public: + void AddFileToList(const CString &sFile); + BOOL GetPendingFileToScan(CString &sFileToScan); + BOOL GetPendingFileToPatch(CString &sFileToPatch); + + static PatchStatus ScanFile(const CString &sFileName); + static PatchStatus ScanBuffer(char *pszBuffer, long nBufferSize, BOOL bApplyPatches); + static BOOL PatchFile(const CString & sFileFrom, const CString & sFileTo, PatchStatus *pPatchStatus); + + static BOOL WriteBufferToFile(const CString &sFileName, char *pszBuffer, long nBufferSize); + static BOOL ReadFileToBuffer(const CString &sFileName, char **ppszBuffer, long *pnBufferSize); + static void TraceProgress(const CString &sProgress); + + void UpdateFileStatus(const CString &sFile, PatchStatus ps); + void UpdateFileStatus(int nFileIndex, const CString &sFile, PatchStatus ps); + + + CIEPatcherDlg(CWnd* pParent = NULL); // standard constructor + virtual ~CIEPatcherDlg(); + + CImageList m_cImageList; + + CArray m_cQueuedFileDataList; + CCriticalSection m_csQueuedFileDataList; + +// Dialog Data + //{{AFX_DATA(CIEPatcherDlg) + enum { IDD = IDD_IEPATCHER_DIALOG }; + CButton m_btnPatch; + CListCtrl m_cFileList; + //}}AFX_DATA + + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CIEPatcherDlg) + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + //}}AFX_VIRTUAL + +// Implementation +protected: + CIEPatcherDlgAutoProxy* m_pAutoProxy; + HICON m_hIcon; + + BOOL CanExit(); + + // Generated message map functions + //{{AFX_MSG(CIEPatcherDlg) + virtual BOOL OnInitDialog(); + afx_msg void OnPaint(); + afx_msg HCURSOR OnQueryDragIcon(); + afx_msg void OnClose(); + afx_msg void OnScan(); + afx_msg void OnClickFilelist(NMHDR* pNMHDR, LRESULT* pResult); + afx_msg void OnPatch(); + //}}AFX_MSG + afx_msg LONG OnUpdateFileStatus(WPARAM, LPARAM); + DECLARE_MESSAGE_MAP() +}; + +//{{AFX_INSERT_LOCATION}} +// Microsoft Developer Studio will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_IEPATCHERDLG_H__A603167C_3B36_11D2_B44D_00600819607E__INCLUDED_) + diff --git a/mozilla/embedding/browser/activex/tests/IEPatcher/ScanForFilesDlg.cpp b/mozilla/embedding/browser/activex/tests/IEPatcher/ScanForFilesDlg.cpp new file mode 100644 index 00000000000..08846cc43ac --- /dev/null +++ b/mozilla/embedding/browser/activex/tests/IEPatcher/ScanForFilesDlg.cpp @@ -0,0 +1,110 @@ +// ScanForFilesDlg.cpp : implementation file +// + +#include "stdafx.h" +#include "IEPatcher.h" +#include "ScanForFilesDlg.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// CScanForFilesDlg dialog + + +CScanForFilesDlg::CScanForFilesDlg(CWnd* pParent /*=NULL*/) + : CDialog(CScanForFilesDlg::IDD, pParent) +{ + //{{AFX_DATA_INIT(CScanForFilesDlg) + m_sFilePattern = _T(""); + //}}AFX_DATA_INIT +} + + +void CScanForFilesDlg::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + //{{AFX_DATA_MAP(CScanForFilesDlg) + DDX_Text(pDX, IDC_FILEPATTERN, m_sFilePattern); + //}}AFX_DATA_MAP +} + + +BEGIN_MESSAGE_MAP(CScanForFilesDlg, CDialog) + //{{AFX_MSG_MAP(CScanForFilesDlg) + ON_BN_CLICKED(IDC_SELECTFILE, OnSelectFile) + ON_BN_CLICKED(IDC_SELECTFOLDER, OnSelectFolder) + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// CScanForFilesDlg message handlers + +void CScanForFilesDlg::OnOK() +{ + UpdateData(); + CDialog::OnOK(); +} + +void CScanForFilesDlg::OnSelectFile() +{ + CFileDialog dlg(TRUE, NULL, _T("*.*")); + + if (dlg.DoModal() == IDOK) + { + m_sFilePattern = dlg.GetPathName(); + UpdateData(FALSE); + } +} + +void CScanForFilesDlg::OnSelectFolder() +{ + BROWSEINFO bi; + TCHAR szFolder[MAX_PATH + 1]; + + memset(szFolder, 0, sizeof(szFolder)); + + memset(&bi, 0, sizeof(bi)); + bi.hwndOwner = GetSafeHwnd(); + bi.pidlRoot = NULL; + bi.pszDisplayName = szFolder; + bi.lpszTitle = _T("Pick a folder to scan"); + + // Open the folder browser dialog + LPITEMIDLIST pItemList = SHBrowseForFolder(&bi); + if (pItemList) + { + IMalloc *pShellAllocator = NULL; + + SHGetMalloc(&pShellAllocator); + if (pShellAllocator) + { + char szPath[MAX_PATH + 1]; + + if (SHGetPathFromIDList(pItemList, szPath)) + { + // Chop off the end path seperator + int nPathSize = strlen(szPath); + if (nPathSize > 0) + { + if (szPath[nPathSize - 1] == '\\') + { + szPath[nPathSize - 1] = '\0'; + } + } + + // Form the file pattern + USES_CONVERSION; + m_sFilePattern.Format(_T("%s\\*.*"), A2T(szPath)); + UpdateData(FALSE); + } + + pShellAllocator->Free(pItemList); + pShellAllocator->Release(); + } + + } +} diff --git a/mozilla/embedding/browser/activex/tests/IEPatcher/ScanForFilesDlg.h b/mozilla/embedding/browser/activex/tests/IEPatcher/ScanForFilesDlg.h new file mode 100644 index 00000000000..eefcf3384f3 --- /dev/null +++ b/mozilla/embedding/browser/activex/tests/IEPatcher/ScanForFilesDlg.h @@ -0,0 +1,48 @@ +#if !defined(AFX_SCANFORFILESDLG_H__2CAAFC02_6C47_11D2_A1F5_000000000000__INCLUDED_) +#define AFX_SCANFORFILESDLG_H__2CAAFC02_6C47_11D2_A1F5_000000000000__INCLUDED_ + +#if _MSC_VER >= 1000 +#pragma once +#endif // _MSC_VER >= 1000 +// ScanForFilesDlg.h : header file +// + +///////////////////////////////////////////////////////////////////////////// +// CScanForFilesDlg dialog + +class CScanForFilesDlg : public CDialog +{ +// Construction +public: + CScanForFilesDlg(CWnd* pParent = NULL); // standard constructor + +// Dialog Data + //{{AFX_DATA(CScanForFilesDlg) + enum { IDD = IDD_SCANFORFILES }; + CString m_sFilePattern; + //}}AFX_DATA + + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CScanForFilesDlg) + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + //}}AFX_VIRTUAL + +// Implementation +protected: + + // Generated message map functions + //{{AFX_MSG(CScanForFilesDlg) + virtual void OnOK(); + afx_msg void OnSelectFile(); + afx_msg void OnSelectFolder(); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +}; + +//{{AFX_INSERT_LOCATION}} +// Microsoft Developer Studio will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_SCANFORFILESDLG_H__2CAAFC02_6C47_11D2_A1F5_000000000000__INCLUDED_) diff --git a/mozilla/embedding/browser/activex/tests/IEPatcher/ScannerThread.cpp b/mozilla/embedding/browser/activex/tests/IEPatcher/ScannerThread.cpp new file mode 100644 index 00000000000..b837d908b87 --- /dev/null +++ b/mozilla/embedding/browser/activex/tests/IEPatcher/ScannerThread.cpp @@ -0,0 +1,46 @@ +// ScannerThread.cpp : implementation file +// + +#include "stdafx.h" +#include "iepatcher.h" +#include "ScannerThread.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// CScannerThread + +IMPLEMENT_DYNCREATE(CScannerThread, CWinThread) + +CScannerThread::CScannerThread() +{ +} + +CScannerThread::~CScannerThread() +{ +} + +BOOL CScannerThread::InitInstance() +{ + m_cScannerWnd.Create(AfxRegisterWndClass(0), _T("Scanner"), 0L, CRect(0, 0, 0, 0), AfxGetMainWnd(), 1); + return TRUE; +} + +int CScannerThread::ExitInstance() +{ + // TODO: perform any per-thread cleanup here + return CWinThread::ExitInstance(); +} + +BEGIN_MESSAGE_MAP(CScannerThread, CWinThread) + //{{AFX_MSG_MAP(CScannerThread) + // NOTE - the ClassWizard will add and remove mapping macros here. + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// CScannerThread message handlers diff --git a/mozilla/embedding/browser/activex/tests/IEPatcher/ScannerThread.h b/mozilla/embedding/browser/activex/tests/IEPatcher/ScannerThread.h new file mode 100644 index 00000000000..430240664f3 --- /dev/null +++ b/mozilla/embedding/browser/activex/tests/IEPatcher/ScannerThread.h @@ -0,0 +1,54 @@ +#if !defined(AFX_SCANNERTHREAD_H__2CAAFC04_6C47_11D2_A1F5_000000000000__INCLUDED_) +#define AFX_SCANNERTHREAD_H__2CAAFC04_6C47_11D2_A1F5_000000000000__INCLUDED_ + +#if _MSC_VER >= 1000 +#pragma once +#endif // _MSC_VER >= 1000 +// ScannerThread.h : header file +// + +#include "ScannerWnd.h" + + +///////////////////////////////////////////////////////////////////////////// +// CScannerThread thread + +class CScannerThread : public CWinThread +{ + DECLARE_DYNCREATE(CScannerThread) +protected: + CScannerThread(); // protected constructor used by dynamic creation + +// Attributes +public: + CScannerWnd m_cScannerWnd; + +// Operations +public: + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CScannerThread) + public: + virtual BOOL InitInstance(); + virtual int ExitInstance(); + //}}AFX_VIRTUAL + +// Implementation +protected: + virtual ~CScannerThread(); + + // Generated message map functions + //{{AFX_MSG(CScannerThread) + // NOTE - the ClassWizard will add and remove member functions here. + //}}AFX_MSG + + DECLARE_MESSAGE_MAP() +}; + +///////////////////////////////////////////////////////////////////////////// + +//{{AFX_INSERT_LOCATION}} +// Microsoft Developer Studio will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_SCANNERTHREAD_H__2CAAFC04_6C47_11D2_A1F5_000000000000__INCLUDED_) diff --git a/mozilla/embedding/browser/activex/tests/IEPatcher/ScannerWnd.cpp b/mozilla/embedding/browser/activex/tests/IEPatcher/ScannerWnd.cpp new file mode 100644 index 00000000000..db95aa64a05 --- /dev/null +++ b/mozilla/embedding/browser/activex/tests/IEPatcher/ScannerWnd.cpp @@ -0,0 +1,82 @@ +// ScannerWnd.cpp : implementation file +// + +#include "stdafx.h" +#include "iepatcher.h" +#include "ScannerWnd.h" +#include "IEPatcherDlg.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// CScannerWnd + +CScannerWnd::CScannerWnd() +{ +} + +CScannerWnd::~CScannerWnd() +{ +} + + +BEGIN_MESSAGE_MAP(CScannerWnd, CWnd) + //{{AFX_MSG_MAP(CScannerWnd) + ON_WM_TIMER() + ON_WM_CREATE() + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + + +///////////////////////////////////////////////////////////////////////////// +// CScannerWnd message handlers + + +int CScannerWnd::OnCreate(LPCREATESTRUCT lpCreateStruct) +{ + if (CWnd::OnCreate(lpCreateStruct) == -1) + return -1; + + SetTimer(1, 500, NULL); + + return 0; +} + + +void CScannerWnd::OnTimer(UINT nIDEvent) +{ + CIEPatcherDlg * pDlg = ((CIEPatcherApp *) AfxGetApp())->m_pIEPatcherDlg; + if (pDlg) + { + CString sFileToProcess; + if (pDlg->GetPendingFileToScan(sFileToProcess)) + { + PatchStatus ps = CIEPatcherDlg::ScanFile(sFileToProcess); + AfxGetMainWnd()->SendMessage(WM_UPDATEFILESTATUS, (WPARAM) ps, (LPARAM) (const TCHAR *) sFileToProcess); + } + else if (pDlg->GetPendingFileToPatch(sFileToProcess)) + { + TCHAR szDrive[_MAX_DRIVE]; + TCHAR szDir[_MAX_DIR]; + TCHAR szFile[_MAX_FNAME]; + TCHAR szExt[_MAX_EXT]; + + _tsplitpath(sFileToProcess, szDrive, szDir, szFile, szExt); + + CString sFileOut; + TCHAR szPath[_MAX_PATH]; + sFileOut.Format(_T("moz_%s"), szFile); + _tmakepath(szPath, szDrive, szDir, sFileOut, szExt); + + PatchStatus ps; + CIEPatcherDlg::PatchFile(sFileToProcess, szPath, &ps); + AfxGetMainWnd()->SendMessage(WM_UPDATEFILESTATUS, (WPARAM) ps, (LPARAM) (const TCHAR *) sFileToProcess); + } + } + + CWnd::OnTimer(nIDEvent); +} diff --git a/mozilla/embedding/browser/activex/tests/IEPatcher/ScannerWnd.h b/mozilla/embedding/browser/activex/tests/IEPatcher/ScannerWnd.h new file mode 100644 index 00000000000..7c4c02d63ef --- /dev/null +++ b/mozilla/embedding/browser/activex/tests/IEPatcher/ScannerWnd.h @@ -0,0 +1,48 @@ +#if !defined(AFX_SCANNERWND_H__2CAAFC05_6C47_11D2_A1F5_000000000000__INCLUDED_) +#define AFX_SCANNERWND_H__2CAAFC05_6C47_11D2_A1F5_000000000000__INCLUDED_ + +#if _MSC_VER >= 1000 +#pragma once +#endif // _MSC_VER >= 1000 +// ScannerWnd.h : header file +// + +///////////////////////////////////////////////////////////////////////////// +// CScannerWnd window + +class CScannerWnd : public CWnd +{ +// Construction +public: + CScannerWnd(); + +// Attributes +public: + +// Operations +public: + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CScannerWnd) + //}}AFX_VIRTUAL + +// Implementation +public: + virtual ~CScannerWnd(); + + // Generated message map functions +protected: + //{{AFX_MSG(CScannerWnd) + afx_msg void OnTimer(UINT nIDEvent); + afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +}; + +///////////////////////////////////////////////////////////////////////////// + +//{{AFX_INSERT_LOCATION}} +// Microsoft Developer Studio will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_SCANNERWND_H__2CAAFC05_6C47_11D2_A1F5_000000000000__INCLUDED_) diff --git a/mozilla/embedding/browser/activex/tests/IEPatcher/StdAfx.cpp b/mozilla/embedding/browser/activex/tests/IEPatcher/StdAfx.cpp new file mode 100644 index 00000000000..ee987d4d8c7 --- /dev/null +++ b/mozilla/embedding/browser/activex/tests/IEPatcher/StdAfx.cpp @@ -0,0 +1,6 @@ +// stdafx.cpp : source file that includes just the standard includes +// IEPatcher.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information + +#include "stdafx.h" + diff --git a/mozilla/embedding/browser/activex/tests/IEPatcher/StdAfx.h b/mozilla/embedding/browser/activex/tests/IEPatcher/StdAfx.h new file mode 100644 index 00000000000..59b4a1767e6 --- /dev/null +++ b/mozilla/embedding/browser/activex/tests/IEPatcher/StdAfx.h @@ -0,0 +1,42 @@ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, but +// are changed infrequently +// + +#if !defined(AFX_STDAFX_H__A6031681_3B36_11D2_B44D_00600819607E__INCLUDED_) +#define AFX_STDAFX_H__A6031681_3B36_11D2_B44D_00600819607E__INCLUDED_ + +#if _MSC_VER >= 1000 +#pragma once +#endif // _MSC_VER >= 1000 + +#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers + +#include // MFC core and standard components +#include // MFC extensions +#include // MFC OLE automation classes +#ifndef _AFX_NO_AFXCMN_SUPPORT +#include // MFC support for Windows Common Controls +#endif // _AFX_NO_AFXCMN_SUPPORT +#include +#include +#include + +#include + +// This macro is the same as IMPLEMENT_OLECREATE, except it passes TRUE +// for the bMultiInstance parameter to the COleObjectFactory constructor. +// We want a separate instance of this application to be launched for +// each OLE automation proxy object requested by automation controllers. +#ifndef IMPLEMENT_OLECREATE2 +#define IMPLEMENT_OLECREATE2(class_name, external_name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \ + AFX_DATADEF COleObjectFactory class_name::factory(class_name::guid, \ + RUNTIME_CLASS(class_name), TRUE, _T(external_name)); \ + const AFX_DATADEF GUID class_name::guid = \ + { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } }; +#endif // IMPLEMENT_OLECREATE2 + +//{{AFX_INSERT_LOCATION}} +// Microsoft Developer Studio will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_STDAFX_H__A6031681_3B36_11D2_B44D_00600819607E__INCLUDED_) diff --git a/mozilla/embedding/browser/activex/tests/IEPatcher/res/IEPatcher.ico b/mozilla/embedding/browser/activex/tests/IEPatcher/res/IEPatcher.ico new file mode 100644 index 0000000000000000000000000000000000000000..7eef0bcbe6580a6f464d688906172c2d9de44262 GIT binary patch literal 1078 zcmc&zF>b>!3}jLb9s)T}@Kod(893@u8ajANzT`op9^o+)S?=nU(FD@%0s)Sg^oyC8{H z9myetc;MEP)59v(LMa~xK8Yu^jIR*H22uCFiq5%C{s7(PJi>o15i^bmX4(vPxWAio z9ryY#AU_jfnd047-@`)XzL?%iS$gQyFP{44kS9X)fN{{QoL~hO-&=q&20Zr*cxFAt PkaNE{wR~2C$NfnjhSXWT literal 0 HcmV?d00001 diff --git a/mozilla/embedding/browser/activex/tests/IEPatcher/res/IEPatcher.rc2 b/mozilla/embedding/browser/activex/tests/IEPatcher/res/IEPatcher.rc2 new file mode 100644 index 00000000000..227cb5a3f68 --- /dev/null +++ b/mozilla/embedding/browser/activex/tests/IEPatcher/res/IEPatcher.rc2 @@ -0,0 +1,13 @@ +// +// IEPATCHER.RC2 - resources Microsoft Visual C++ does not edit directly +// + +#ifdef APSTUDIO_INVOKED + #error this file is not editable by Microsoft Visual C++ +#endif //APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// Add manually edited resources here... + +///////////////////////////////////////////////////////////////////////////// diff --git a/mozilla/embedding/browser/activex/tests/IEPatcher/res/containsie.ico b/mozilla/embedding/browser/activex/tests/IEPatcher/res/containsie.ico new file mode 100644 index 0000000000000000000000000000000000000000..68cdc08251780f429101a447929a88708546641d GIT binary patch literal 318 zcmZvXu@1s83`8#~h%uR1VdNh`q5~tJ#Ly38h{S4%U#Zlk1IWE|i;xgb&S$?wkpm>I zQVJA@1Z?G$$ev1AF#|R7ztjQT=(^dMS)$fT*MY}|yDExHNa-7`S!LH;%?!xH$wq=a z+@2$G_9Hoaf82xni$L6oTeuWuq)l0Ue|g}c^&uwl-J3+(C7+8_7; DK*~sS literal 0 HcmV?d00001 diff --git a/mozilla/embedding/browser/activex/tests/IEPatcher/res/doesntcontainie.ico b/mozilla/embedding/browser/activex/tests/IEPatcher/res/doesntcontainie.ico new file mode 100644 index 0000000000000000000000000000000000000000..811358fb803c7fd81ff49557befbb7d2ad4f8147 GIT binary patch literal 318 zcmbu3K@NZ*3vAp4KP%1Dpkqn3zbryG<8Lr9_lcU_NYy$7rc^|rHd;@$<_ZvQnchyuy)b`hAIcUb>EcBN4gIN)we|feWd%y l{4=-a{Og^%_celF@rC~&_8=F+Av==8j%sD!Xzs5615Y8&O}zjB literal 0 HcmV?d00001 diff --git a/mozilla/embedding/browser/activex/tests/IEPatcher/resource.h b/mozilla/embedding/browser/activex/tests/IEPatcher/resource.h new file mode 100644 index 00000000000..3c1baaaa51e --- /dev/null +++ b/mozilla/embedding/browser/activex/tests/IEPatcher/resource.h @@ -0,0 +1,35 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Developer Studio generated include file. +// Used by IEPatcher.rc +// +#define IDP_OLE_INIT_FAILED 100 +#define IDD_IEPATCHER_DIALOG 102 +#define IDR_MAINFRAME 128 +#define IDI_CONTAINSIE 129 +#define IDI_DOESNTCONTAINIE 130 +#define IDI_CONTAINSMOZILLA 131 +#define IDD_SCANFORFILES 132 +#define IDI_UNKNOWNSTATUS 133 +#define IDC_FILENAME 1000 +#define IDC_SCAN 1001 +#define IDC_PROGRESS 1002 +#define IDC_PATCHFILE 1003 +#define IDC_DESTINATION_FILENAME 1004 +#define IDC_PICKSOURCE 1005 +#define IDC_PICKDESTINATION 1006 +#define IDC_FILELIST 1007 +#define IDC_PATCH 1008 +#define IDC_FILEPATTERN 1009 +#define IDC_SELECTFILE 1011 +#define IDC_SELECTFOLDER 1012 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 134 +#define _APS_NEXT_COMMAND_VALUE 32771 +#define _APS_NEXT_CONTROL_VALUE 1012 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/mozilla/embedding/browser/activex/tests/RegMozCtl/MozillaBrowser.ico b/mozilla/embedding/browser/activex/tests/RegMozCtl/MozillaBrowser.ico new file mode 100644 index 0000000000000000000000000000000000000000..01c6f785d3e017ea6566acd7417bd92193112f33 GIT binary patch literal 4710 zcmeH~PiP!f9LImVNp-1#B(mF6in}i!rYqgXo!vtN#Tpl(fkL9Bdnwe@;7vTWh|oc> ziUukOC39)RMnwli>9MChd9ZVCF9w1=RBFH!FQKh@etz%mCQaOwdhld_yT5tw_vih7 z-}${a^WKQ$WLV1OF;V(0FY+es*qE1toJeg*u&Y(%+k(iMVYPet-2)<9BO(D}89oVX zJf)aegDJ*{C60Z=m9BKVU0O9*_ZMrm2lG>vUUsN3|N4%gy|)*3$p;qR+6!QpJQa`S zxwCDWUwE-Ty)DU9E@wJvPd270!};md%SObQ$v5(;myI!H6b4c4`LZ$9vf%9Hx=HJu z&XjtmlOjVV?P#|=#HB+dZ6?#|iiWR?YE!~ZrpwiQYJ8ZowxYCmurqHH4dGD_w zQUZ0#Z3S>=bnsQ}eRQ3{2BM5m!vFATMmZ5;LrmKdDxc!p7*vYuL;0I8o%{ z18aNXo#w&^KRoOx`X0qM(sVhU>WeIe8|m_o+oE;~z1)4}r#s$G#lm_DvUZDg@Hjt0 zR^AXAv0cA(wupr&oA3s_26ua`eYM*d#%OVZbBuo;9)(}BkGdD_)&-W_`|v~9ldkhI zxD5B#d6)iRido}WSktcIO84p4dG2EdL%BKM9vCy)sh9Iie%|CwHDx(f%T?Chv|9lk zW>Ko0ytW#)qQ`0~N@Ioi=r9=LTDC`|>+W6o z;=Aw35W*3hz?m0AbRoJBU8p*4L|r2E5uFHqgg!#A!xHof`UD|CpP;9a41I<^L!Y6@ zv>?b9*=8BB?3phidHfIAl~=0+Dsm_I zxl)rm0aHTKgaiqg5^^UP6LKfyPRQ-1!{tU#{)GGq`E`mC@+Z_L0Yd_YggWT7Q5ARh zXlS|WG*W|%d>Pm>aAf3jQ>!?rK?aUYad2a9x*3##B?C(ah>V1834kSIV1`qMA_EJ5 zm^jQy29`|g;jrjx&{;qS1`7rY1`7rY1`7taoWPKQ!GghpAp-+pVEn;g!C=8)!9Zvj zJs2z)EEp^REcr8nSq561B4R|y5jd=itv-=d-!eg9^mRXg6kRK*1-04$qs(gb62@As zvD<#ERtx4@SjW}efOhOP&{PcSASf1#J@d95E#bJKiiTCv(T#q7Z&tObm~CsLk8e%~ z_lXd0tPc0%fz>Beji6$@14_lGHs|b}7*+{%EPu84%t)ZqMEHW%rxZ~~N6xMe8jCy8 z;ncV3t*We10q(ES&`PKrX#Jawo=Yzf_Q1u!UQ&F}86QNU^wYWUGv3U#?L79FgB`mI z(j?Qb^FA1^L1~v=+E$8J*L$%PU8$enr&+RMu34G2noEa&zMbB8u36jEbA&V3PVKRZ zEG=DY;LvXLYrDr|*4+juD~-nd9-E3q&Ifvx7!-F=qRbKQS%p8M=am1= zIc1%#-@Qh81t|S~qO?mconRODCOLZaXz4H;vfIb!I8amqwnpC2*!`v)u$A({M%29t zLcvvzsaL>u$zG|l+XLM;ucAAbuurv{&2|%ik7wzsumzoEL~mbOwM(lOdk+n-_ICSh zt=9XTL|dF~A9Jz#9=!PnzTLOK1=swyGoQ`>_#RZ9ekVTCZ$afz&Uo*+W1svD!0_@; literal 0 HcmV?d00001 diff --git a/mozilla/embedding/browser/activex/tests/RegMozCtl/ReadMe.txt b/mozilla/embedding/browser/activex/tests/RegMozCtl/ReadMe.txt new file mode 100644 index 00000000000..76a553ecfc2 --- /dev/null +++ b/mozilla/embedding/browser/activex/tests/RegMozCtl/ReadMe.txt @@ -0,0 +1,88 @@ +======================================================================== + MICROSOFT FOUNDATION CLASS LIBRARY : RegMozCtl +======================================================================== + + +AppWizard has created this RegMozCtl application for you. This application +not only demonstrates the basics of using the Microsoft Foundation classes +but is also a starting point for writing your application. + +This file contains a summary of what you will find in each of the files that +make up your RegMozCtl application. + +RegMozCtl.dsp + This file (the project file) contains information at the project level and + is used to build a single project or subproject. Other users can share the + project (.dsp) file, but they should export the makefiles locally. + +RegMozCtl.h + This is the main header file for the application. It includes other + project specific headers (including Resource.h) and declares the + CRegMozCtlApp application class. + +RegMozCtl.cpp + This is the main application source file that contains the application + class CRegMozCtlApp. + +RegMozCtl.rc + This is a listing of all of the Microsoft Windows resources that the + program uses. It includes the icons, bitmaps, and cursors that are stored + in the RES subdirectory. This file can be directly edited in Microsoft + Visual C++. + +RegMozCtl.clw + This file contains information used by ClassWizard to edit existing + classes or add new classes. ClassWizard also uses this file to store + information needed to create and edit message maps and dialog data + maps and to create prototype member functions. + +res\RegMozCtl.ico + This is an icon file, which is used as the application's icon. This + icon is included by the main resource file RegMozCtl.rc. + +res\RegMozCtl.rc2 + This file contains resources that are not edited by Microsoft + Visual C++. You should place all resources not editable by + the resource editor in this file. + + + + +///////////////////////////////////////////////////////////////////////////// + +AppWizard creates one dialog class: + +RegMozCtlDlg.h, RegMozCtlDlg.cpp - the dialog + These files contain your CRegMozCtlDlg class. This class defines + the behavior of your application's main dialog. The dialog's + template is in RegMozCtl.rc, which can be edited in Microsoft + Visual C++. + + +///////////////////////////////////////////////////////////////////////////// +Other standard files: + +StdAfx.h, StdAfx.cpp + These files are used to build a precompiled header (PCH) file + named RegMozCtl.pch and a precompiled types file named StdAfx.obj. + +Resource.h + This is the standard header file, which defines new resource IDs. + Microsoft Visual C++ reads and updates this file. + +///////////////////////////////////////////////////////////////////////////// +Other notes: + +AppWizard uses "TODO:" to indicate parts of the source code you +should add to or customize. + +If your application uses MFC in a shared DLL, and your application is +in a language other than the operating system's current language, you +will need to copy the corresponding localized resources MFC42XXX.DLL +from the Microsoft Visual C++ CD-ROM onto the system or system32 directory, +and rename it to be MFCLOC.DLL. ("XXX" stands for the language abbreviation. +For example, MFC42DEU.DLL contains resources translated to German.) If you +don't do this, some of the UI elements of your application will remain in the +language of the operating system. + +///////////////////////////////////////////////////////////////////////////// diff --git a/mozilla/embedding/browser/activex/tests/RegMozCtl/RegMozCtl.cpp b/mozilla/embedding/browser/activex/tests/RegMozCtl/RegMozCtl.cpp new file mode 100644 index 00000000000..ab0e4da9b4a --- /dev/null +++ b/mozilla/embedding/browser/activex/tests/RegMozCtl/RegMozCtl.cpp @@ -0,0 +1,74 @@ +// RegMozCtl.cpp : Defines the class behaviors for the application. +// + +#include "stdafx.h" +#include "RegMozCtl.h" +#include "RegMozCtlDlg.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// CRegMozCtlApp + +BEGIN_MESSAGE_MAP(CRegMozCtlApp, CWinApp) + //{{AFX_MSG_MAP(CRegMozCtlApp) + // NOTE - the ClassWizard will add and remove mapping macros here. + // DO NOT EDIT what you see in these blocks of generated code! + //}}AFX_MSG + ON_COMMAND(ID_HELP, CWinApp::OnHelp) +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// CRegMozCtlApp construction + +CRegMozCtlApp::CRegMozCtlApp() +{ + // TODO: add construction code here, + // Place all significant initialization in InitInstance +} + +///////////////////////////////////////////////////////////////////////////// +// The one and only CRegMozCtlApp object + +CRegMozCtlApp theApp; + +///////////////////////////////////////////////////////////////////////////// +// CRegMozCtlApp initialization + +BOOL CRegMozCtlApp::InitInstance() +{ + AfxEnableControlContainer(); + + // Standard initialization + // If you are not using these features and wish to reduce the size + // of your final executable, you should remove from the following + // the specific initialization routines you do not need. + +#ifdef _AFXDLL + Enable3dControls(); // Call this when using MFC in a shared DLL +#else + Enable3dControlsStatic(); // Call this when linking to MFC statically +#endif + + CRegMozCtlDlg dlg; + m_pMainWnd = &dlg; + int nResponse = dlg.DoModal(); + if (nResponse == IDOK) + { + // TODO: Place code here to handle when the dialog is + // dismissed with OK + } + else if (nResponse == IDCANCEL) + { + // TODO: Place code here to handle when the dialog is + // dismissed with Cancel + } + + // Since the dialog has been closed, return FALSE so that we exit the + // application, rather than start the application's message pump. + return FALSE; +} diff --git a/mozilla/embedding/browser/activex/tests/RegMozCtl/RegMozCtl.dsp b/mozilla/embedding/browser/activex/tests/RegMozCtl/RegMozCtl.dsp new file mode 100644 index 00000000000..2fcd77565a2 --- /dev/null +++ b/mozilla/embedding/browser/activex/tests/RegMozCtl/RegMozCtl.dsp @@ -0,0 +1,150 @@ +# Microsoft Developer Studio Project File - Name="RegMozCtl" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Application" 0x0101 + +CFG=RegMozCtl - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "RegMozCtl.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "RegMozCtl.mak" CFG="RegMozCtl - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "RegMozCtl - Win32 Release" (based on "Win32 (x86) Application") +!MESSAGE "RegMozCtl - Win32 Debug" (based on "Win32 (x86) Application") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "RegMozCtl - Win32 Release" + +# PROP BASE Use_MFC 5 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 5 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /Yu"stdafx.h" /FD /c +# ADD CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /Yu"stdafx.h" /FD /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x809 /d "NDEBUG" +# ADD RSC /l 0x809 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 /nologo /subsystem:windows /machine:I386 +# ADD LINK32 /nologo /subsystem:windows /machine:I386 + +!ELSEIF "$(CFG)" == "RegMozCtl - Win32 Debug" + +# PROP BASE Use_MFC 5 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 5 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /Yu"stdafx.h" /FD /GZ /c +# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x809 /d "_DEBUG" +# ADD RSC /l 0x809 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept +# ADD LINK32 /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept + +!ENDIF + +# Begin Target + +# Name "RegMozCtl - Win32 Release" +# Name "RegMozCtl - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=.\RegMozCtl.cpp +# End Source File +# Begin Source File + +SOURCE=.\RegMozCtl.rc +# End Source File +# Begin Source File + +SOURCE=.\RegMozCtlDlg.cpp +# End Source File +# Begin Source File + +SOURCE=.\StdAfx.cpp +# ADD CPP /Yc"stdafx.h" +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=.\RegMozCtl.h +# End Source File +# Begin Source File + +SOURCE=.\RegMozCtlDlg.h +# End Source File +# Begin Source File + +SOURCE=.\Resource.h +# End Source File +# Begin Source File + +SOURCE=.\StdAfx.h +# End Source File +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# Begin Source File + +SOURCE=.\MozillaBrowser.ico +# End Source File +# Begin Source File + +SOURCE=.\res\RegMozCtl.ico +# End Source File +# Begin Source File + +SOURCE=.\res\RegMozCtl.rc2 +# End Source File +# End Group +# Begin Source File + +SOURCE=.\ReadMe.txt +# End Source File +# End Target +# End Project diff --git a/mozilla/embedding/browser/activex/tests/RegMozCtl/RegMozCtl.h b/mozilla/embedding/browser/activex/tests/RegMozCtl/RegMozCtl.h new file mode 100644 index 00000000000..695a7a08247 --- /dev/null +++ b/mozilla/embedding/browser/activex/tests/RegMozCtl/RegMozCtl.h @@ -0,0 +1,49 @@ +// RegMozCtl.h : main header file for the REGMOZCTL application +// + +#if !defined(AFX_REGMOZCTL_H__C7C0A786_F424_11D2_A27B_000000000000__INCLUDED_) +#define AFX_REGMOZCTL_H__C7C0A786_F424_11D2_A27B_000000000000__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#ifndef __AFXWIN_H__ + #error include 'stdafx.h' before including this file for PCH +#endif + +#include "resource.h" // main symbols + +///////////////////////////////////////////////////////////////////////////// +// CRegMozCtlApp: +// See RegMozCtl.cpp for the implementation of this class +// + +class CRegMozCtlApp : public CWinApp +{ +public: + CRegMozCtlApp(); + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CRegMozCtlApp) + public: + virtual BOOL InitInstance(); + //}}AFX_VIRTUAL + +// Implementation + + //{{AFX_MSG(CRegMozCtlApp) + // NOTE - the ClassWizard will add and remove member functions here. + // DO NOT EDIT what you see in these blocks of generated code ! + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +}; + + +///////////////////////////////////////////////////////////////////////////// + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_REGMOZCTL_H__C7C0A786_F424_11D2_A27B_000000000000__INCLUDED_) diff --git a/mozilla/embedding/browser/activex/tests/RegMozCtl/RegMozCtl.rc b/mozilla/embedding/browser/activex/tests/RegMozCtl/RegMozCtl.rc new file mode 100644 index 00000000000..cef8bc10930 --- /dev/null +++ b/mozilla/embedding/browser/activex/tests/RegMozCtl/RegMozCtl.rc @@ -0,0 +1,205 @@ +//Microsoft Developer Studio generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "afxres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_REGMOZCTL_DIALOG DIALOGEX 0, 0, 210, 199 +STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +EXSTYLE WS_EX_APPWINDOW +CAPTION "RegMozCtl" +FONT 8, "MS Sans Serif" +BEGIN + ICON IDI_MOZILLA,IDC_STATIC,7,7,20,20 + LTEXT "This application registers/deregisters the Mozilla Control and ensures that its dependent DLLs are listed as SHARED so that they can be found when the control is used by other applications.", + IDC_STATIC,34,7,169,35 + LTEXT "You must choose the directory containing the Mozilla control and click on the Register or Deregister as appropriate.", + IDC_STATIC,7,47,196,17 + EDITTEXT IDC_MOZILLADIR,7,70,182,14,ES_AUTOHSCROLL + PUSHBUTTON "...",IDC_PICKDIR,190,70,13,14 + LTEXT "Now choose the component registry file and component directory the control uses or let RegMozCtl try to guess correct values for you.", + IDC_STATIC,7,89,196,27 + EDITTEXT IDC_COMPONENTFILE,7,134,182,14,ES_AUTOHSCROLL | + WS_DISABLED + PUSHBUTTON "...",IDC_PICKCOMPONENTFILE,190,134,13,14,WS_DISABLED + EDITTEXT IDC_COMPONENTPATH,7,157,182,14,ES_AUTOHSCROLL | + WS_DISABLED + PUSHBUTTON "...",IDC_PICKCOMPONENTPATH,190,157,13,14,WS_DISABLED + DEFPUSHBUTTON "&Register",IDC_REGISTER,7,178,50,14 + PUSHBUTTON "&Unregister",IDC_UNREGISTER,80,178,50,14 + PUSHBUTTON "&Close",IDCANCEL,153,178,50,14 + CONTROL "Automatic",IDC_AUTOMATIC,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,7,119,46,10 +END + + +#ifndef _MAC +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,0,0,1 + PRODUCTVERSION 1,0,0,1 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x4L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904B0" + BEGIN + VALUE "CompanyName", "\0" + VALUE "FileDescription", "RegMozCtl MFC Application\0" + VALUE "FileVersion", "1, 0, 0, 1\0" + VALUE "InternalName", "RegMozCtl\0" + VALUE "LegalCopyright", "Copyright (C) 1999\0" + VALUE "LegalTrademarks", "\0" + VALUE "OriginalFilename", "RegMozCtl.EXE\0" + VALUE "ProductName", "RegMozCtl Application\0" + VALUE "ProductVersion", "1, 0, 0, 1\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + +#endif // !_MAC + + +///////////////////////////////////////////////////////////////////////////// +// +// DESIGNINFO +// + +#ifdef APSTUDIO_INVOKED +GUIDELINES DESIGNINFO DISCARDABLE +BEGIN + IDD_REGMOZCTL_DIALOG, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 203 + TOPMARGIN, 7 + BOTTOMMARGIN, 192 + END +END +#endif // APSTUDIO_INVOKED + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + +///////////////////////////////////////////////////////////////////////////// +// English (U.K.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENG) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK +#pragma code_page(1252) +#endif //_WIN32 + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE DISCARDABLE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE DISCARDABLE +BEGIN + "#include ""afxres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE DISCARDABLE +BEGIN + "#define _AFX_NO_SPLITTER_RESOURCES\r\n" + "#define _AFX_NO_OLE_RESOURCES\r\n" + "#define _AFX_NO_TRACKER_RESOURCES\r\n" + "#define _AFX_NO_PROPERTY_RESOURCES\r\n" + "\r\n" + "#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n" + "#ifdef _WIN32\r\n" + "LANGUAGE 9, 1\r\n" + "#pragma code_page(1252)\r\n" + "#endif //_WIN32\r\n" + "#include ""res\\RegMozCtl.rc2"" // non-Microsoft Visual C++ edited resources\r\n" + "#include ""afxres.rc"" // Standard components\r\n" + "#endif\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDR_MAINFRAME ICON DISCARDABLE "res\\RegMozCtl.ico" +IDI_MOZILLA ICON DISCARDABLE "MozillaBrowser.ico" +#endif // English (U.K.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// +#define _AFX_NO_SPLITTER_RESOURCES +#define _AFX_NO_OLE_RESOURCES +#define _AFX_NO_TRACKER_RESOURCES +#define _AFX_NO_PROPERTY_RESOURCES + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE 9, 1 +#pragma code_page(1252) +#endif //_WIN32 +#include "res\RegMozCtl.rc2" // non-Microsoft Visual C++ edited resources +#include "afxres.rc" // Standard components +#endif + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/mozilla/embedding/browser/activex/tests/RegMozCtl/RegMozCtlDlg.cpp b/mozilla/embedding/browser/activex/tests/RegMozCtl/RegMozCtlDlg.cpp new file mode 100644 index 00000000000..c24d85c4bb1 --- /dev/null +++ b/mozilla/embedding/browser/activex/tests/RegMozCtl/RegMozCtlDlg.cpp @@ -0,0 +1,337 @@ +// RegMozCtlDlg.cpp : implementation file +// + +#include "stdafx.h" +#include "RegMozCtl.h" +#include "RegMozCtlDlg.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +#define MOZ_CONTROL_REG_KEY _T("Software\\Mozilla\\") +#define MOZ_CONTROL_REG_VALUE_DIR _T("Dir") +#define MOZ_CONTROL_REG_VALUE_COMPONENT_PATH _T("ComponentPath") +#define MOZ_CONTROL_REG_VALUE_COMPONENT_FILE _T("ComponentFile") + +///////////////////////////////////////////////////////////////////////////// +// CRegMozCtlDlg dialog + +CRegMozCtlDlg::CRegMozCtlDlg(CWnd* pParent /*=NULL*/) + : CDialog(CRegMozCtlDlg::IDD, pParent) +{ + //{{AFX_DATA_INIT(CRegMozCtlDlg) + m_szMozillaDir = _T(""); + m_szComponentPath = _T(""); + m_szComponentFile = _T(""); + m_bAutomatic = FALSE; + //}}AFX_DATA_INIT + // Note that LoadIcon does not require a subsequent DestroyIcon in Win32 + m_hIcon = AfxGetApp()->LoadIcon(IDI_MOZILLA); + + m_bAutomatic = TRUE; + GetCurrentDirectory(1024, m_szMozillaDir.GetBuffer(1024)); + m_szMozillaDir.ReleaseBuffer(); +} + +void CRegMozCtlDlg::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + //{{AFX_DATA_MAP(CRegMozCtlDlg) + DDX_Control(pDX, IDC_COMPONENTPATH, m_edtComponentPath); + DDX_Control(pDX, IDC_COMPONENTFILE, m_edtComponentFile); + DDX_Control(pDX, IDC_PICKCOMPONENTPATH, m_btnPickComponentPath); + DDX_Control(pDX, IDC_PICKCOMPONENTFILE, m_btnPickComponentFile); + DDX_Text(pDX, IDC_MOZILLADIR, m_szMozillaDir); + DDX_Text(pDX, IDC_COMPONENTPATH, m_szComponentPath); + DDX_Text(pDX, IDC_COMPONENTFILE, m_szComponentFile); + DDX_Check(pDX, IDC_AUTOMATIC, m_bAutomatic); + //}}AFX_DATA_MAP +} + +BEGIN_MESSAGE_MAP(CRegMozCtlDlg, CDialog) + //{{AFX_MSG_MAP(CRegMozCtlDlg) + ON_WM_PAINT() + ON_WM_QUERYDRAGICON() + ON_BN_CLICKED(IDC_REGISTER, OnRegister) + ON_BN_CLICKED(IDC_UNREGISTER, OnUnregister) + ON_BN_CLICKED(IDC_PICKDIR, OnPickDir) + ON_BN_CLICKED(IDC_PICKCOMPONENTFILE, OnPickComponentFile) + ON_BN_CLICKED(IDC_PICKCOMPONENTPATH, OnPickComponentPath) + ON_BN_CLICKED(IDC_AUTOMATIC, OnAutomatic) + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// CRegMozCtlDlg message handlers + +BOOL CRegMozCtlDlg::OnInitDialog() +{ + // Set the icon for this dialog. The framework does this automatically + // when the application's main window is not a dialog + SetIcon(m_hIcon, TRUE); // Set big icon + SetIcon(m_hIcon, FALSE); // Set small icon + + // Get values from the registry + TCHAR szValue[1024]; + DWORD dwSize = sizeof(szValue) / sizeof(szValue[0]); + CRegKey cKey; + cKey.Create(HKEY_LOCAL_MACHINE, MOZ_CONTROL_REG_KEY); + + memset(szValue, 0, sizeof(szValue)); + if (cKey.QueryValue(szValue, MOZ_CONTROL_REG_VALUE_COMPONENT_PATH, &dwSize) == ERROR_SUCCESS) + { + m_szComponentPath = CString(szValue); + } + + dwSize = sizeof(szValue) / sizeof(szValue[0]); + memset(szValue, 0, sizeof(szValue)); + if (cKey.QueryValue(szValue, MOZ_CONTROL_REG_VALUE_COMPONENT_FILE, &dwSize) == ERROR_SUCCESS) + { + m_szComponentFile = CString(szValue); + } + + dwSize = sizeof(szValue) / sizeof(szValue[0]); + memset(szValue, 0, sizeof(szValue)); + if (cKey.QueryValue(szValue, MOZ_CONTROL_REG_VALUE_DIR, &dwSize) == ERROR_SUCCESS) + { + m_szMozillaDir = CString(szValue); + } + + CDialog::OnInitDialog(); + + return TRUE; // return TRUE unless you set the focus to a control +} + +// If you add a minimize button to your dialog, you will need the code below +// to draw the icon. For MFC applications using the document/view model, +// this is automatically done for you by the framework. + +void CRegMozCtlDlg::OnPaint() +{ + if (IsIconic()) + { + CPaintDC dc(this); // device context for painting + + SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0); + + // Center icon in client rectangle + int cxIcon = GetSystemMetrics(SM_CXICON); + int cyIcon = GetSystemMetrics(SM_CYICON); + CRect rect; + GetClientRect(&rect); + int x = (rect.Width() - cxIcon + 1) / 2; + int y = (rect.Height() - cyIcon + 1) / 2; + + // Draw the icon + dc.DrawIcon(x, y, m_hIcon); + } + else + { + CDialog::OnPaint(); + } +} + +// The system calls this to obtain the cursor to display while the user drags +// the minimized window. +HCURSOR CRegMozCtlDlg::OnQueryDragIcon() +{ + return (HCURSOR) m_hIcon; +} + +void CRegMozCtlDlg::OnRegister() +{ + RegisterMozillaControl(TRUE); +} + +void CRegMozCtlDlg::OnUnregister() +{ + RegisterMozillaControl(FALSE); +} + +void CRegMozCtlDlg::RegisterMozillaControl(BOOL bRegister) +{ + UpdateData(); + + CFileFind cFind; + CString szFile; + CString szPath; + + SetCurrentDirectory(m_szMozillaDir); + + CRegKey cKey; + if (cKey.Open(HKEY_LOCAL_MACHINE, _T("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\SharedDlls")) != ERROR_SUCCESS) + { + AfxMessageBox(_T("Can't open registry key \"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\SharedDlls\"")); + return; + } + + // Iterate through directory registering each DLL as a shared DLL + BOOL bWorking = cFind.FindFile("*.dll"); + while (bWorking) + { + bWorking = cFind.FindNextFile(); + szFile = cFind.GetFileName(); + szPath = m_szMozillaDir + CString(_T("\\")) + szFile; + if (bRegister) + { + cKey.SetValue(1, szPath); + } + else + { + cKey.DeleteValue(szPath); + } + } + cKey.Close(); + + cKey.Create(HKEY_LOCAL_MACHINE, MOZ_CONTROL_REG_KEY); + cKey.SetValue(m_szMozillaDir, MOZ_CONTROL_REG_VALUE_DIR); + cKey.Close(); + + // Now register the mozilla control + CString szMozCtl = m_szMozillaDir + CString(_T("\\npmozctl.dll")); + HINSTANCE hMod = LoadLibrary(szMozCtl); + if (hMod == NULL) + { + AfxMessageBox(_T("Can't find npmozctl.dll in current directory")); + } + FARPROC pfn = GetProcAddress(hMod, bRegister ? _T("DllRegisterServer") : _T("DllUnregisterServer")); + if (pfn) + { + pfn(); + } + FreeLibrary(hMod); + + AfxMessageBox(bRegister ? _T("Register completed") : _T("Unregister completed")); +} + +void CRegMozCtlDlg::OnPickDir() +{ + BROWSEINFO bi; + TCHAR szFolder[MAX_PATH + 1]; + + memset(szFolder, 0, sizeof(szFolder)); + + memset(&bi, 0, sizeof(bi)); + bi.hwndOwner = GetSafeHwnd(); + bi.pidlRoot = NULL; + bi.pszDisplayName = szFolder; + bi.lpszTitle = _T("Pick a folder to scan"); + + // Open the folder browser dialog + LPITEMIDLIST pItemList = SHBrowseForFolder(&bi); + if (pItemList) + { + IMalloc *pShellAllocator = NULL; + + SHGetMalloc(&pShellAllocator); + if (pShellAllocator) + { + char szPath[MAX_PATH + 1]; + + if (SHGetPathFromIDList(pItemList, szPath)) + { + // Chop off the end path separator + int nPathSize = strlen(szPath); + if (nPathSize > 0) + { + if (szPath[nPathSize - 1] == '\\') + { + szPath[nPathSize - 1] = '\0'; + } + } + + m_szMozillaDir = CString(szPath); + if (m_bAutomatic) + { + m_szComponentPath = m_szMozillaDir + "\\components"; + m_szComponentFile = m_szMozillaDir + "\\component.reg"; + } + + UpdateData(FALSE); + } + + pShellAllocator->Free(pItemList); + pShellAllocator->Release(); + } + } +} + +void CRegMozCtlDlg::OnPickComponentFile() +{ + CFileDialog dlg(TRUE, NULL, m_szComponentFile); + if (dlg.DoModal() == IDOK) + { + m_szComponentFile = dlg.GetPathName(); + UpdateData(FALSE); + } +} + +void CRegMozCtlDlg::OnPickComponentPath() +{ + BROWSEINFO bi; + TCHAR szFolder[MAX_PATH + 1]; + + memset(szFolder, 0, sizeof(szFolder)); + + memset(&bi, 0, sizeof(bi)); + bi.hwndOwner = GetSafeHwnd(); + bi.pidlRoot = NULL; + bi.pszDisplayName = szFolder; + bi.lpszTitle = _T("Pick a folder to scan"); + + // Open the folder browser dialog + LPITEMIDLIST pItemList = SHBrowseForFolder(&bi); + if (pItemList) + { + IMalloc *pShellAllocator = NULL; + + SHGetMalloc(&pShellAllocator); + if (pShellAllocator) + { + char szPath[MAX_PATH + 1]; + + if (SHGetPathFromIDList(pItemList, szPath)) + { + // Chop off the end path separator + int nPathSize = strlen(szPath); + if (nPathSize > 0) + { + if (szPath[nPathSize - 1] == '\\') + { + szPath[nPathSize - 1] = '\0'; + } + } + + m_szComponentPath = CString(szPath); + UpdateData(FALSE); + } + + pShellAllocator->Free(pItemList); + pShellAllocator->Release(); + } + } +} + +void CRegMozCtlDlg::OnAutomatic() +{ + UpdateData(TRUE); + m_edtComponentFile.EnableWindow(!m_bAutomatic); + m_btnPickComponentFile.EnableWindow(!m_bAutomatic); + m_edtComponentPath.EnableWindow(!m_bAutomatic); + m_btnPickComponentPath.EnableWindow(!m_bAutomatic); +} + +CString CRegMozCtlDlg::GetSystemPath() +{ + // TODO + return _T(""); +} + +BOOL CRegMozCtlDlg::SetSystemPath(const CString &szNewPath) +{ + // TODO + return TRUE; +} diff --git a/mozilla/embedding/browser/activex/tests/RegMozCtl/RegMozCtlDlg.h b/mozilla/embedding/browser/activex/tests/RegMozCtl/RegMozCtlDlg.h new file mode 100644 index 00000000000..617df382aaf --- /dev/null +++ b/mozilla/embedding/browser/activex/tests/RegMozCtl/RegMozCtlDlg.h @@ -0,0 +1,65 @@ +// RegMozCtlDlg.h : header file +// + +#if !defined(AFX_REGMOZCTLDLG_H__C7C0A788_F424_11D2_A27B_000000000000__INCLUDED_) +#define AFX_REGMOZCTLDLG_H__C7C0A788_F424_11D2_A27B_000000000000__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +///////////////////////////////////////////////////////////////////////////// +// CRegMozCtlDlg dialog + +class CRegMozCtlDlg : public CDialog +{ +// Construction +public: + CRegMozCtlDlg(CWnd* pParent = NULL); // standard constructor + +// Dialog Data + //{{AFX_DATA(CRegMozCtlDlg) + enum { IDD = IDD_REGMOZCTL_DIALOG }; + CEdit m_edtComponentPath; + CEdit m_edtComponentFile; + CButton m_btnPickComponentPath; + CButton m_btnPickComponentFile; + CString m_szMozillaDir; + CString m_szComponentPath; + CString m_szComponentFile; + BOOL m_bAutomatic; + //}}AFX_DATA + + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CRegMozCtlDlg) + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + //}}AFX_VIRTUAL + +// Implementation +protected: + HICON m_hIcon; + + // Generated message map functions + //{{AFX_MSG(CRegMozCtlDlg) + virtual BOOL OnInitDialog(); + afx_msg void OnPaint(); + afx_msg HCURSOR OnQueryDragIcon(); + afx_msg void OnRegister(); + afx_msg void OnUnregister(); + afx_msg void OnPickDir(); + afx_msg void OnPickComponentFile(); + afx_msg void OnPickComponentPath(); + afx_msg void OnAutomatic(); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() + + void RegisterMozillaControl(BOOL bRegister); + BOOL SetSystemPath(const CString &szNewPath); + CString GetSystemPath(); +}; + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_REGMOZCTLDLG_H__C7C0A788_F424_11D2_A27B_000000000000__INCLUDED_) diff --git a/mozilla/embedding/browser/activex/tests/RegMozCtl/StdAfx.cpp b/mozilla/embedding/browser/activex/tests/RegMozCtl/StdAfx.cpp new file mode 100644 index 00000000000..aeedd8dd8eb --- /dev/null +++ b/mozilla/embedding/browser/activex/tests/RegMozCtl/StdAfx.cpp @@ -0,0 +1,8 @@ +// stdafx.cpp : source file that includes just the standard includes +// RegMozCtl.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information + +#include "stdafx.h" + + + diff --git a/mozilla/embedding/browser/activex/tests/RegMozCtl/StdAfx.h b/mozilla/embedding/browser/activex/tests/RegMozCtl/StdAfx.h new file mode 100644 index 00000000000..8d9fe79dc6d --- /dev/null +++ b/mozilla/embedding/browser/activex/tests/RegMozCtl/StdAfx.h @@ -0,0 +1,29 @@ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, but +// are changed infrequently +// + +#if !defined(AFX_STDAFX_H__C7C0A78A_F424_11D2_A27B_000000000000__INCLUDED_) +#define AFX_STDAFX_H__C7C0A78A_F424_11D2_A27B_000000000000__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers + +#include // MFC core and standard components +#include // MFC extensions +#include // MFC Automation classes +#include // MFC support for Internet Explorer 4 Common Controls +#ifndef _AFX_NO_AFXCMN_SUPPORT +#include // MFC support for Windows Common Controls +#endif // _AFX_NO_AFXCMN_SUPPORT +#include + + + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_STDAFX_H__C7C0A78A_F424_11D2_A27B_000000000000__INCLUDED_) diff --git a/mozilla/embedding/browser/activex/tests/RegMozCtl/res/RegMozCtl.ico b/mozilla/embedding/browser/activex/tests/RegMozCtl/res/RegMozCtl.ico new file mode 100644 index 0000000000000000000000000000000000000000..7eef0bcbe6580a6f464d688906172c2d9de44262 GIT binary patch literal 1078 zcmc&zF>b>!3}jLb9s)T}@Kod(893@u8ajANzT`op9^o+)S?=nU(FD@%0s)Sg^oyC8{H z9myetc;MEP)59v(LMa~xK8Yu^jIR*H22uCFiq5%C{s7(PJi>o15i^bmX4(vPxWAio z9ryY#AU_jfnd047-@`)XzL?%iS$gQyFP{44kS9X)fN{{QoL~hO-&=q&20Zr*cxFAt PkaNE{wR~2C$NfnjhSXWT literal 0 HcmV?d00001 diff --git a/mozilla/embedding/browser/activex/tests/RegMozCtl/res/RegMozCtl.rc2 b/mozilla/embedding/browser/activex/tests/RegMozCtl/res/RegMozCtl.rc2 new file mode 100644 index 00000000000..57afbe6e741 --- /dev/null +++ b/mozilla/embedding/browser/activex/tests/RegMozCtl/res/RegMozCtl.rc2 @@ -0,0 +1,13 @@ +// +// REGMOZCTL.RC2 - resources Microsoft Visual C++ does not edit directly +// + +#ifdef APSTUDIO_INVOKED + #error this file is not editable by Microsoft Visual C++ +#endif //APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// Add manually edited resources here... + +///////////////////////////////////////////////////////////////////////////// diff --git a/mozilla/embedding/browser/activex/tests/RegMozCtl/resource.h b/mozilla/embedding/browser/activex/tests/RegMozCtl/resource.h new file mode 100644 index 00000000000..f36eb8c6b7e --- /dev/null +++ b/mozilla/embedding/browser/activex/tests/RegMozCtl/resource.h @@ -0,0 +1,27 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Developer Studio generated include file. +// Used by RegMozCtl.rc +// +#define IDD_REGMOZCTL_DIALOG 102 +#define IDR_MAINFRAME 128 +#define IDI_MOZILLA 130 +#define IDC_REGISTER 1001 +#define IDC_UNREGISTER 1002 +#define IDC_MOZILLADIR 1003 +#define IDC_PICKDIR 1004 +#define IDC_COMPONENTFILE 1005 +#define IDC_PICKCOMPONENTFILE 1006 +#define IDC_COMPONENTPATH 1007 +#define IDC_PICKCOMPONENTPATH 1008 +#define IDC_AUTOMATIC 1009 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 131 +#define _APS_NEXT_COMMAND_VALUE 32771 +#define _APS_NEXT_CONTROL_VALUE 1010 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/mozilla/embedding/browser/activex/tests/cbrowse/CBrowseDlg.cpp b/mozilla/embedding/browser/activex/tests/cbrowse/CBrowseDlg.cpp new file mode 100644 index 00000000000..a2cc0fbe3d8 --- /dev/null +++ b/mozilla/embedding/browser/activex/tests/cbrowse/CBrowseDlg.cpp @@ -0,0 +1,846 @@ +// CBrowseDlg.cpp : implementation file +// + +#include "stdafx.h" + +#include "cbrowse.h" +#include "CBrowseDlg.h" +#include "ControlEventSink.h" +#include "..\..\DHTMLCmdIds.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +#include +#include +#include + +#include + +#include + +void __cdecl fperr(int sig) +{ + CString sError; + sError.Format("FP Error %08x", sig); + AfxMessageBox(sError); +} + +TCHAR *aURLs[] = +{ + _T("http://whippy/calendar.html"), + _T("http://www.mozilla.org"), + _T("http://www.yahoo.com"), + _T("http://www.netscape.com"), + _T("http://www.microsoft.com") +}; + +CBrowseDlg *CBrowseDlg::m_pBrowseDlg = NULL; + +///////////////////////////////////////////////////////////////////////////// +// CBrowseDlg dialog + +CBrowseDlg::CBrowseDlg(CWnd* pParent /*=NULL*/) + : CDialog(CBrowseDlg::IDD, pParent) +{ + signal(SIGFPE, fperr); + double x = 0.0; + double y = 1.0/x; + + //{{AFX_DATA_INIT(CBrowseDlg) + m_bNewWindow = FALSE; + //}}AFX_DATA_INIT + // Note that LoadIcon does not require a subsequent DestroyIcon in Win32 + m_pBrowseDlg = this; + m_pControlSite = NULL; + m_clsid = CLSID_NULL; + m_bUseCustomPopupMenu = FALSE; + m_bUseCustomDropTarget = FALSE; +} + +void CBrowseDlg::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + //{{AFX_DATA_MAP(CBrowseDlg) + DDX_Control(pDX, IDC_EDITMODE, m_btnEditMode); + DDX_Control(pDX, IDC_URL, m_cmbURLs); + DDX_Check(pDX, IDC_NEWWINDOW, m_bNewWindow); + //}}AFX_DATA_MAP +} + +BEGIN_MESSAGE_MAP(CBrowseDlg, CDialog) + //{{AFX_MSG_MAP(CBrowseDlg) + ON_WM_PAINT() + ON_WM_QUERYDRAGICON() + ON_BN_CLICKED(IDC_GO, OnGo) + ON_BN_CLICKED(IDC_BACKWARD, OnBackward) + ON_BN_CLICKED(IDC_FORWARD, OnForward) + ON_WM_CLOSE() + ON_WM_DESTROY() + ON_WM_SIZE() + ON_BN_CLICKED(IDC_EDITMODE, OnEditMode) + ON_COMMAND(ID_FILE_EXIT, OnFileExit) + ON_COMMAND(ID_VIEW_GOTO_BACK, OnViewGotoBack) + ON_COMMAND(ID_VIEW_GOTO_FORWARD, OnViewGotoForward) + ON_COMMAND(ID_VIEW_GOTO_HOME, OnViewGotoHome) + ON_COMMAND(ID_EDIT_COPY, OnEditCopy) + ON_COMMAND(ID_EDIT_CUT, OnEditCut) + ON_COMMAND(ID_EDIT_PASTE, OnEditPaste) + ON_COMMAND(ID_HELP_ABOUT, OnHelpAbout) + ON_UPDATE_COMMAND_UI(ID_VIEW_GOTO_BACK, OnUpdateViewGotoBack) + ON_UPDATE_COMMAND_UI(ID_VIEW_GOTO_FORWARD, OnUpdateViewGotoForward) + ON_COMMAND(ID_EDIT_SELECTALL, OnEditSelectAll) + ON_COMMAND(ID_VIEW_REFRESH, OnViewRefresh) + //}}AFX_MSG_MAP + ON_COMMAND(IDB_BOLD, OnEditBold) + ON_COMMAND(IDB_ITALIC, OnEditItalic) + ON_COMMAND(IDB_UNDERLINE, OnEditUnderline) +END_MESSAGE_MAP() + +#define IL_CLOSEDFOLDER 0 +#define IL_OPENFOLDER 1 +#define IL_TEST 2 +#define IL_TESTFAILED 3 +#define IL_TESTPASSED 4 +#define IL_TESTPARTIAL 5 +#define IL_NODE IL_TEST + +///////////////////////////////////////////////////////////////////////////// +// CBrowseDlg message handlers + +BOOL CBrowseDlg::OnInitDialog() +{ + CDialog::OnInitDialog(); + + CWinApp *pApp = AfxGetApp(); + m_szTestURL = pApp->GetProfileString(SECTION_TEST, KEY_TESTURL, KEY_TESTURL_DEFAULTVALUE); + m_szTestCGI = pApp->GetProfileString(SECTION_TEST, KEY_TESTCGI, KEY_TESTCGI_DEFAULTVALUE); + + // Set the icon for this dialog. The framework does this automatically + // when the application's main window is not a dialog + SetIcon(m_hIcon, TRUE); // Set big icon + SetIcon(m_hIcon, FALSE); // Set small icon + + CRect rcTabMarker; + GetDlgItem(IDC_TAB_MARKER)->GetWindowRect(&rcTabMarker); + ScreenToClient(rcTabMarker); +// GetDlgItem(IDC_TAB_MARKER)->DestroyWindow(); + + m_dlgPropSheet.AddPage(&m_TabMessages); + m_dlgPropSheet.AddPage(&m_TabTests); + m_dlgPropSheet.AddPage(&m_TabDOM); + + m_TabMessages.m_pBrowseDlg = this; + m_TabTests.m_pBrowseDlg = this; + m_TabDOM.m_pBrowseDlg = this; + + m_dlgPropSheet.Create(this, WS_CHILD | WS_VISIBLE, 0); + m_dlgPropSheet.ModifyStyleEx (0, WS_EX_CONTROLPARENT); + m_dlgPropSheet.ModifyStyle( 0, WS_TABSTOP ); + m_dlgPropSheet.SetWindowPos( NULL, rcTabMarker.left-7, rcTabMarker.top-7, 0, 0, SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE ); + + // Image list + m_cImageList.Create(16, 16, ILC_COLOR | ILC_MASK, 0, 10); + m_cImageList.Add(AfxGetApp()->LoadIcon(IDI_CLOSEDFOLDER)); + m_cImageList.Add(AfxGetApp()->LoadIcon(IDI_OPENFOLDER)); + m_cImageList.Add(AfxGetApp()->LoadIcon(IDI_TEST)); + m_cImageList.Add(AfxGetApp()->LoadIcon(IDI_TESTFAILED)); + m_cImageList.Add(AfxGetApp()->LoadIcon(IDI_TESTPASSED)); + m_cImageList.Add(AfxGetApp()->LoadIcon(IDI_TESTPARTIAL)); + + // Set up the editor bar + CRect rcEditBarMarker; + GetDlgItem(IDC_EDITBAR_MARKER)->GetWindowRect(&rcEditBarMarker); + ScreenToClient(rcEditBarMarker); + GetDlgItem(IDC_EDITBAR_MARKER)->DestroyWindow(); + + m_EditBar.Create(this); + m_EditBar.LoadToolBar(IDR_DHTMLEDIT); + m_EditBar.SetWindowPos(&wndTop, rcEditBarMarker.left, rcEditBarMarker.top, + rcEditBarMarker.Width(), rcEditBarMarker.Height(), SWP_SHOWWINDOW); + + // Set up some URLs. The first couple are internal + m_cmbURLs.AddString(m_szTestURL); + for (int i = 0; i < sizeof(aURLs) / sizeof(aURLs[0]); i++) + { + m_cmbURLs.AddString(aURLs[i]); + } + m_cmbURLs.SetCurSel(0); + + // Create the contained web browser + CreateWebBrowser(); + + // Load the menu + m_menu.LoadMenu(IDR_MAIN); + SetMenu(&m_menu); + m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); + + return TRUE; // return TRUE unless you set the focus to a control +} + + +// If you add a minimize button to your dialog, you will need the code below +// to draw the icon. For MFC applications using the document/view model, +// this is automatically done for you by the framework. + +void CBrowseDlg::OnPaint() +{ + if (IsIconic()) + { + CPaintDC dc(this); // device context for painting + + SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0); + + // Center icon in client rectangle + int cxIcon = GetSystemMetrics(SM_CXICON); + int cyIcon = GetSystemMetrics(SM_CYICON); + CRect rect; + GetClientRect(&rect); + int x = (rect.Width() - cxIcon + 1) / 2; + int y = (rect.Height() - cyIcon + 1) / 2; + + // Draw the icon + dc.DrawIcon(x, y, m_hIcon); + } + else + { + CPaintDC dc(this); + + m_pControlSite->Draw(dc.m_hDC); + } +} + +// The system calls this to obtain the cursor to display while the user drags +// the minimized window. +HCURSOR CBrowseDlg::OnQueryDragIcon() +{ + return (HCURSOR) m_hIcon; +} + +struct EnumData +{ + CBrowseDlg *pBrowseDlg; + CSize sizeDelta; +}; + +BOOL CALLBACK EnumChildProc(HWND hwnd, LPARAM lParam) +{ + EnumData *pData = (EnumData *) lParam; + CBrowseDlg *pThis = pData->pBrowseDlg; + + switch (::GetDlgCtrlID(hwnd)) + { + case IDC_BROWSER_MARKER: + { + CWnd *pMarker = pThis->GetDlgItem(IDC_BROWSER_MARKER); + CRect rcMarker; + pMarker->GetWindowRect(&rcMarker); + pThis->ScreenToClient(rcMarker); + + rcMarker.right += pData->sizeDelta.cx; + rcMarker.bottom += pData->sizeDelta.cy; + + if (rcMarker.Width() > 10 && rcMarker.Height() > 10) + { + pMarker->SetWindowPos(&CWnd::wndBottom, 0, 0, rcMarker.Width(), rcMarker.Height(), + SWP_NOMOVE | SWP_NOACTIVATE | SWP_HIDEWINDOW); + pThis->m_pControlSite->SetPosition(rcMarker); + } + } + break; + case IDC_TAB_MARKER: + { + CWnd *pMarker = pThis->GetDlgItem(IDC_TAB_MARKER); + CRect rcMarker; + pMarker->GetWindowRect(&rcMarker); + pThis->ScreenToClient(rcMarker); + + rcMarker.top += pData->sizeDelta.cy; + + if (rcMarker.top > 70) + { + pMarker->SetWindowPos(&CWnd::wndBottom, rcMarker.left, rcMarker.top, 0, 0, + SWP_NOSIZE | SWP_NOACTIVATE | SWP_HIDEWINDOW); + pThis->m_dlgPropSheet.SetWindowPos(NULL, rcMarker.left - 7, rcMarker.top - 7, 0, 0, + SWP_NOREPOSITION | SWP_NOSIZE | SWP_NOACTIVATE); + } + } + + } + + return TRUE; +} + +void CBrowseDlg::OnSize(UINT nType, int cx, int cy) +{ + CDialog::OnSize(nType, cx, cy); + + if (m_hWnd == NULL) + { + return; + } + + static CSize sizeOld(-1, -1); + CSize sizeNew(cx, cy); + + if (sizeOld.cx != -1) + { + EnumData data; + data.pBrowseDlg = this; + data.sizeDelta = sizeNew - sizeOld; + ::EnumChildWindows(GetSafeHwnd(), EnumChildProc, (LPARAM) &data); + } + sizeOld = sizeNew; +} + +HRESULT CBrowseDlg::CreateWebBrowser() +{ + // Get the position of the browser marker + CRect rcMarker; + GetDlgItem(IDC_BROWSER_MARKER)->GetWindowRect(&rcMarker); + ScreenToClient(rcMarker); + GetDlgItem(IDC_BROWSER_MARKER)->ShowWindow(FALSE); + +// GetDlgItem(IDC_BROWSER_MARKER)->DestroyWindow(); + + CBrowserCtlSiteInstance::CreateInstance(&m_pControlSite); + if (m_pControlSite == NULL) + { + OutputString(_T("Error: could not create control site")); + return E_OUTOFMEMORY; + } + + CControlEventSinkInstance *pEventSink = NULL; + CControlEventSinkInstance::CreateInstance(&pEventSink); + if (pEventSink == NULL) + { + m_pControlSite->Release(); + m_pControlSite = NULL; + OutputString(_T("Error: could not create event sink")); + return E_OUTOFMEMORY; + } + pEventSink->m_pBrowseDlg = this; + + HRESULT hr; + + PropertyList pl; + m_pControlSite->AddRef(); + m_pControlSite->m_bUseCustomPopupMenu = m_bUseCustomPopupMenu; + m_pControlSite->m_bUseCustomDropTarget = m_bUseCustomDropTarget; + m_pControlSite->Create(m_clsid, pl); + hr = m_pControlSite->Attach(GetSafeHwnd(), rcMarker, NULL); + if (hr != S_OK) + { + OutputString(_T("Error: Cannot attach to browser control, hr = 0x%08x"), hr); + } + else + { + OutputString(_T("Sucessfully attached to browser control")); + } + + m_pControlSite->SetPosition(rcMarker); + hr = m_pControlSite->Advise(pEventSink, DIID_DWebBrowserEvents2, &m_dwCookie); + if (hr != S_OK) + { + OutputString(_T("Error: Cannot subscribe to DIID_DWebBrowserEvents2 events, hr = 0x%08x"), hr); + } + else + { + OutputString(_T("Sucessfully subscribed to events")); + } + + CComPtr spUnkBrowser; + m_pControlSite->GetControlUnknown(&spUnkBrowser); + + CIPtr(IWebBrowser2) spWebBrowser = spUnkBrowser; + if (spWebBrowser) + { + spWebBrowser->put_RegisterAsDropTarget(VARIANT_TRUE); + } + + return S_OK; +} + + +HRESULT CBrowseDlg::DestroyWebBrowser() +{ + if (m_pControlSite) + { + m_pControlSite->Unadvise(DIID_DWebBrowserEvents2, m_dwCookie); + m_pControlSite->Detach(); + m_pControlSite->Release(); + m_pControlSite = NULL; + } + + return S_OK; +} + +void CBrowseDlg::PopulateTests() +{ + // Create the test tree + CTreeCtrl &tc = m_TabTests.m_tcTests; + + tc.SetImageList(&m_cImageList, TVSIL_NORMAL); + for (int i = 0; i < nTestSets; i++) + { + TestSet *pTestSet = &aTestSets[i]; + HTREEITEM hParent = tc.InsertItem(pTestSet->szName, IL_CLOSEDFOLDER, IL_CLOSEDFOLDER); + m_TabTests.m_tcTests.SetItemData(hParent, (DWORD) pTestSet); + + if (pTestSet->pfnPopulator) + { + pTestSet->pfnPopulator(pTestSet); + } + + for (int j = 0; j < pTestSet->nTests; j++) + { + Test *pTest = &pTestSet->aTests[j]; + HTREEITEM hTest = tc.InsertItem(pTest->szName, IL_TEST, IL_TEST, hParent); + if (hTest) + { + tc.SetItemData(hTest, (DWORD) pTest); + } + } + } +} + +HRESULT CBrowseDlg::GetWebBrowser(IWebBrowser **pWebBrowser) +{ + if (pWebBrowser == NULL) + { + return E_INVALIDARG; + } + + *pWebBrowser = NULL; + + if (m_pControlSite) + { + IUnknown *pIUnkBrowser = NULL; + m_pControlSite->GetControlUnknown(&pIUnkBrowser); + if (pIUnkBrowser) + { + pIUnkBrowser->QueryInterface(IID_IWebBrowser, (void **) pWebBrowser); + if (*pWebBrowser) + { + return S_OK; + } + pIUnkBrowser->Release(); + } + } + + return E_FAIL; +} + +void CBrowseDlg::OnGo() +{ + UpdateData(); + + IWebBrowser *pIWebBrowser = NULL; + if (SUCCEEDED(GetWebBrowser(&pIWebBrowser))) + { + CString szURL; + m_cmbURLs.GetWindowText(szURL); +// int nItem = m_cmbURLs.GetCurSel(); +// CString szURL = (nItem == 0) ? m_szTestURL : aURLs[nItem - 1]; + + CComVariant vFlags(m_bNewWindow ? navOpenInNewWindow : 0); + + BSTR bstrURL = szURL.AllocSysString(); + pIWebBrowser->Navigate(bstrURL, &vFlags, NULL, NULL, NULL); + ::SysFreeString(bstrURL); + pIWebBrowser->Release(); + } +} + +void CBrowseDlg::OnBackward() +{ + IWebBrowser *pIWebBrowser = NULL; + if (SUCCEEDED(GetWebBrowser(&pIWebBrowser))) + { + pIWebBrowser->GoBack(); + pIWebBrowser->Release(); + } +} + +void CBrowseDlg::OnForward() +{ + IWebBrowser *pIWebBrowser = NULL; + if (SUCCEEDED(GetWebBrowser(&pIWebBrowser))) + { + pIWebBrowser->GoForward(); + pIWebBrowser->Release(); + } +} + +void CBrowseDlg::RunTestSet(TestSet *pTestSet) +{ + ASSERT(pTestSet); + if (pTestSet == NULL) + { + return; + } + + for (int j = 0; j < pTestSet->nTests; j++) + { + Test *pTest = &pTestSet->aTests[j]; + RunTest(pTest); + } +} + + +TestResult CBrowseDlg::RunTest(Test *pTest) +{ + ASSERT(pTest); + TestResult nResult = trFailed; + + CString szMsg; + szMsg.Format(_T("Running test \"%s\""), pTest->szName); + OutputString(szMsg); + + if (pTest && pTest->pfn) + { + BrowserInfo cInfo; + + cInfo.pTest = pTest; + cInfo.clsid = m_clsid; + cInfo.pControlSite = m_pControlSite; + cInfo.pIUnknown = NULL; + cInfo.pBrowseDlg = this; + cInfo.szTestURL = m_szTestURL; + cInfo.szTestCGI = m_szTestCGI; + if (cInfo.pControlSite) + { + cInfo.pControlSite->GetControlUnknown(&cInfo.pIUnknown); + } + nResult = pTest->pfn(cInfo); + pTest->nLastResult = nResult; + if (cInfo.pIUnknown) + { + cInfo.pIUnknown->Release(); + } + } + + switch (nResult) + { + case trFailed: + OutputString(_T("Test failed")); + break; + case trPassed: + OutputString(_T("Test passed")); + break; + case trPartial: + OutputString(_T("Test partial")); + break; + default: + break; + } + + return nResult; +} + +void CBrowseDlg::OutputString(const TCHAR *szMessage, ...) +{ + if (m_pBrowseDlg == NULL) + { + return; + } + + TCHAR szBuffer[256]; + + va_list cArgs; + va_start(cArgs, szMessage); + _vstprintf(szBuffer, szMessage, cArgs); + va_end(cArgs); + + CString szOutput; + szOutput.Format(_T("%s"), szBuffer); + + m_TabMessages.m_lbMessages.AddString(szOutput); + m_TabMessages.m_lbMessages.SetTopIndex(m_TabMessages.m_lbMessages.GetCount() - 1); +} + +void CBrowseDlg::UpdateTest(HTREEITEM hItem, TestResult nResult) +{ + if (nResult == trPassed) + { + m_TabTests.m_tcTests.SetItemImage(hItem, IL_TESTPASSED, IL_TESTPASSED); + } + else if (nResult == trFailed) + { + m_TabTests.m_tcTests.SetItemImage(hItem, IL_TESTFAILED, IL_TESTFAILED); + } + else if (nResult == trPartial) + { + m_TabTests.m_tcTests.SetItemImage(hItem, IL_TESTPARTIAL, IL_TESTPARTIAL); + } +} + +void CBrowseDlg::UpdateTestSet(HTREEITEM hItem) +{ + // Examine the results + HTREEITEM hTest = m_TabTests.m_tcTests.GetNextItem(hItem, TVGN_CHILD); + while (hTest) + { + Test *pTest = (Test *) m_TabTests.m_tcTests.GetItemData(hTest); + UpdateTest(hTest, pTest->nLastResult); + hTest = m_TabTests.m_tcTests.GetNextItem(hTest, TVGN_NEXT); + } +} + +void CBrowseDlg::OnRunTest() +{ + HTREEITEM hItem = m_TabTests.m_tcTests.GetNextItem(NULL, TVGN_FIRSTVISIBLE); + while (hItem) + { + UINT nState = m_TabTests.m_tcTests.GetItemState(hItem, TVIS_SELECTED); + if (!(nState & TVIS_SELECTED)) + { + hItem = m_TabTests.m_tcTests.GetNextItem(hItem, TVGN_NEXTVISIBLE); + continue; + } + + if (m_TabTests.m_tcTests.ItemHasChildren(hItem)) + { + // Run complete set of tests + TestSet *pTestSet = (TestSet *) m_TabTests.m_tcTests.GetItemData(hItem); + RunTestSet(pTestSet); + UpdateTestSet(hItem); + } + else + { + // Find the test + Test *pTest = (Test *) m_TabTests.m_tcTests.GetItemData(hItem); + TestResult nResult = RunTest(pTest); + UpdateTest(hItem, nResult); + } + + hItem = m_TabTests.m_tcTests.GetNextItem(hItem, TVGN_NEXTVISIBLE); + } +} + +struct _ElementPos +{ + HTREEITEM m_htiParent; + CIPtr(IHTMLElementCollection) m_cpElementCollection; + int m_nIndex; + + _ElementPos(HTREEITEM htiParent, IHTMLElementCollection *pElementCollection, int nIndex) + { + m_htiParent = htiParent; + m_cpElementCollection = pElementCollection; + m_nIndex = nIndex; + } + _ElementPos() + { + } +}; + +void CBrowseDlg::OnRefreshDOM() +{ + m_TabDOM.m_tcDOM.DeleteAllItems(); + + std::stack<_ElementPos> cStack; + + CComPtr cpUnkPtr; + m_pControlSite->GetControlUnknown(&cpUnkPtr); + CIPtr(IWebBrowserApp) cpWebBrowser = cpUnkPtr; + if (cpWebBrowser == NULL) + { + return; + } + + CIPtr(IDispatch) cpDispDocument; + cpWebBrowser->get_Document(&cpDispDocument); + if (cpDispDocument == NULL) + { + return; + } + + // Recurse the DOM, building a tree + + CIPtr(IHTMLDocument2) cpDocElement = cpDispDocument; + + CIPtr(IHTMLElementCollection) cpColl; + HRESULT hr = cpDocElement->get_all( &cpColl ); + + cStack.push(_ElementPos(NULL, cpColl, 0)); + while (!cStack.empty()) + { + // Pop next position from stack + _ElementPos pos = cStack.top(); + cStack.pop(); + + // Iterate through elemenets in collection + LONG nElements = 0;; + pos.m_cpElementCollection->get_length(&nElements); + for (int i = pos.m_nIndex; i < nElements; i++ ) + { + CComVariant vName(i); + CComVariant vIndex; + CIPtr(IDispatch) cpDisp; + + hr = pos.m_cpElementCollection->item( vName, vIndex, &cpDisp ); + if ( hr != S_OK ) + { + continue; + } + CIPtr(IHTMLElement) cpElem = cpDisp; + if (cpElem == NULL) + { + continue; + } + + // Get tag name + BSTR bstrTagName = NULL; + hr = cpElem->get_tagName(&bstrTagName); + CString szTagName = bstrTagName; + SysFreeString(bstrTagName); + + // Add an icon to the tree + HTREEITEM htiParent = m_TabDOM.m_tcDOM.InsertItem(szTagName, IL_CLOSEDFOLDER, IL_CLOSEDFOLDER, pos.m_htiParent); + + CIPtr(IDispatch) cpDispColl; + hr = cpElem->get_children(&cpDispColl); + if (hr == S_OK) + { + CIPtr(IHTMLElementCollection) cpChildColl = cpDispColl; + cStack.push(_ElementPos(pos.m_htiParent, pos.m_cpElementCollection, pos.m_nIndex + 1)); + cStack.push(_ElementPos(htiParent, cpChildColl, 0)); + break; + } + } + } +} + + +void CBrowseDlg::OnClose() +{ + DestroyWebBrowser(); + DestroyWindow(); +} + + +void CBrowseDlg::OnDestroy() +{ + CDialog::OnDestroy(); + delete this; +} + +void CBrowseDlg::ExecOleCommand(const GUID *pguidGroup, DWORD nCmdId) +{ + CComPtr spUnkBrowser; + m_pControlSite->GetControlUnknown(&spUnkBrowser); + + CIPtr(IOleCommandTarget) spCommandTarget = spUnkBrowser; + if (spCommandTarget) + { + HRESULT hr = spCommandTarget->Exec(&CGID_MSHTML, nCmdId, 0, NULL, NULL); + OutputString(_T("Exec(%d), returned %08x"), (int) nCmdId, hr); + } + else + { + OutputString(_T("Error: Browser does not support IOleCommandTarget")); + } +} + + +void CBrowseDlg::OnEditMode() +{ + DWORD nCmdID = (m_btnEditMode.GetCheck()) ? IDM_EDITMODE : IDM_BROWSEMODE; + ExecOleCommand(&CGID_MSHTML, nCmdID); + +// if (m_pControlSite) +// { +// m_pControlSite->SetAmbientUserMode((m_btnEditMode.GetCheck() == 0) ? FALSE : TRUE); +// } +} + + +void CBrowseDlg::OnEditBold() +{ + ExecOleCommand(&CGID_MSHTML, IDM_BOLD); +} + +void CBrowseDlg::OnEditItalic() +{ + ExecOleCommand(&CGID_MSHTML, IDM_ITALIC); +} + +void CBrowseDlg::OnEditUnderline() +{ + ExecOleCommand(&CGID_MSHTML, IDM_UNDERLINE); +} + +void CBrowseDlg::OnFileExit() +{ + OnClose(); +} + +void CBrowseDlg::OnViewRefresh() +{ + IWebBrowser *pIWebBrowser = NULL; + if (SUCCEEDED(GetWebBrowser(&pIWebBrowser))) + { + CComVariant vValue(REFRESH_COMPLETELY); + pIWebBrowser->Refresh2(&vValue); + pIWebBrowser->Release(); + } +} + +void CBrowseDlg::OnViewGotoBack() +{ + OnBackward(); +} + +void CBrowseDlg::OnViewGotoForward() +{ + OnForward(); +} + +void CBrowseDlg::OnUpdateViewGotoBack(CCmdUI* pCmdUI) +{ + // TODO: Add your command update UI handler code here +} + +void CBrowseDlg::OnUpdateViewGotoForward(CCmdUI* pCmdUI) +{ + // TODO: Add your command update UI handler code here +} + +void CBrowseDlg::OnViewGotoHome() +{ + IWebBrowser *pIWebBrowser = NULL; + if (SUCCEEDED(GetWebBrowser(&pIWebBrowser))) + { + pIWebBrowser->GoHome(); + pIWebBrowser->Release(); + } +} + +void CBrowseDlg::OnEditCopy() +{ + ExecOleCommand(NULL, OLECMDID_COPY); +} + +void CBrowseDlg::OnEditCut() +{ + ExecOleCommand(NULL, OLECMDID_CUT); +} + +void CBrowseDlg::OnEditPaste() +{ + ExecOleCommand(NULL, OLECMDID_PASTE); +} + +void CBrowseDlg::OnEditSelectAll() +{ + ExecOleCommand(NULL, OLECMDID_SELECTALL); +} + +void CBrowseDlg::OnHelpAbout() +{ + AfxMessageBox(_T("CBrowse - Browser Control Test Harness")); +} diff --git a/mozilla/embedding/browser/activex/tests/cbrowse/CBrowseDlg.h b/mozilla/embedding/browser/activex/tests/cbrowse/CBrowseDlg.h new file mode 100644 index 00000000000..6fc9c31d056 --- /dev/null +++ b/mozilla/embedding/browser/activex/tests/cbrowse/CBrowseDlg.h @@ -0,0 +1,110 @@ +// CBrowseDlg.h : header file +// + +#if !defined(AFX_CBROWSEDLG_H__5121F5E6_5324_11D2_93E1_000000000000__INCLUDED_) +#define AFX_CBROWSEDLG_H__5121F5E6_5324_11D2_93E1_000000000000__INCLUDED_ + +#if _MSC_VER >= 1000 +#pragma once +#endif // _MSC_VER >= 1000 + +#include "TabMessages.h" +#include "TabTests.h" +#include "TabDOM.h" + +///////////////////////////////////////////////////////////////////////////// +// CBrowseDlg dialog + +class CBrowseDlg : public CDialog +{ +// Construction +public: + CBrowserCtlSiteInstance *m_pControlSite; + CLSID m_clsid; + BOOL m_bUseCustomPopupMenu; + BOOL m_bUseCustomDropTarget; + CMenu m_menu; + + CBrowseDlg(CWnd* pParent = NULL); // standard constructor + + static CBrowseDlg *m_pBrowseDlg; + + HRESULT CreateWebBrowser(); + HRESULT DestroyWebBrowser(); + HRESULT GetWebBrowser(IWebBrowser **pWebBrowser); + + void RunTestSet(TestSet *pTestSet); + TestResult RunTest(Test *pTest); + void UpdateTest(HTREEITEM hItem, TestResult nResult); + void UpdateTestSet(HTREEITEM hItem); + void OutputString(const TCHAR *szMessage, ...); + void ExecOleCommand(const GUID *pguidGroup, DWORD nCmdId); + +// Dialog Data + //{{AFX_DATA(CBrowseDlg) + enum { IDD = IDD_CBROWSE_DIALOG }; + CButton m_btnEditMode; + CComboBox m_cmbURLs; + BOOL m_bNewWindow; + //}}AFX_DATA + + CToolBar m_EditBar; + CPropertySheet m_dlgPropSheet; + CTabMessages m_TabMessages; + CTabTests m_TabTests; + CTabDOM m_TabDOM; + CImageList m_cImageList; + + void OnRefreshDOM(); + void OnRunTest(); + void PopulateTests(); + + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CBrowseDlg) + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + //}}AFX_VIRTUAL + +// Implementation +protected: + HICON m_hIcon; + CString m_szTestURL; + CString m_szTestCGI; + DWORD m_dwCookie; + + // Generated message map functions + //{{AFX_MSG(CBrowseDlg) + virtual BOOL OnInitDialog(); + afx_msg void OnPaint(); + afx_msg HCURSOR OnQueryDragIcon(); + afx_msg void OnGo(); + afx_msg void OnBackward(); + afx_msg void OnForward(); + afx_msg void OnClose(); + afx_msg void OnDestroy(); + afx_msg void OnSize(UINT nType, int cx, int cy); + afx_msg void OnEditMode(); + afx_msg void OnFileExit(); + afx_msg void OnViewGotoBack(); + afx_msg void OnViewGotoForward(); + afx_msg void OnViewGotoHome(); + afx_msg void OnEditCopy(); + afx_msg void OnEditCut(); + afx_msg void OnEditPaste(); + afx_msg void OnHelpAbout(); + afx_msg void OnUpdateViewGotoBack(CCmdUI* pCmdUI); + afx_msg void OnUpdateViewGotoForward(CCmdUI* pCmdUI); + afx_msg void OnEditSelectAll(); + afx_msg void OnViewRefresh(); + //}}AFX_MSG + afx_msg void OnEditBold(); + afx_msg void OnEditItalic(); + afx_msg void OnEditUnderline(); + + DECLARE_MESSAGE_MAP() +}; + +//{{AFX_INSERT_LOCATION}} +// Microsoft Developer Studio will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_CBROWSEDLG_H__5121F5E6_5324_11D2_93E1_000000000000__INCLUDED_) diff --git a/mozilla/embedding/browser/activex/tests/cbrowse/CBrowserCtlSite.cpp b/mozilla/embedding/browser/activex/tests/cbrowse/CBrowserCtlSite.cpp new file mode 100644 index 00000000000..d7c0cecf071 --- /dev/null +++ b/mozilla/embedding/browser/activex/tests/cbrowse/CBrowserCtlSite.cpp @@ -0,0 +1,172 @@ +// CBrowserCtlSite.cpp : Implementation of CBrowserCtlSite +#include "stdafx.h" +#include "Cbrowse.h" +#include "CBrowserCtlSite.h" + +#include +#include + +///////////////////////////////////////////////////////////////////////////// +// CBrowserCtlSite + +CBrowserCtlSite::CBrowserCtlSite() +{ + m_bUseCustomPopupMenu = TRUE; + m_bUseCustomDropTarget = FALSE; +} + +static void _InsertMenuItem(HMENU hmenu, int nPos, int nID, const TCHAR *szItemText) +{ + MENUITEMINFO mii; + memset(&mii, 0, sizeof(mii)); + mii.cbSize = sizeof(mii); + mii.fMask = MIIM_TYPE; + mii.fType = MFT_STRING; + mii.fState = MFS_ENABLED; + mii.dwTypeData = (LPTSTR) szItemText; + mii.cch = _tcslen(szItemText); + InsertMenuItem(hmenu, nPos, TRUE, &mii); +} + +static void _InsertMenuSeperator(HMENU hmenu, int nPos) +{ + MENUITEMINFO mii; + memset(&mii, 0, sizeof(mii)); + mii.cbSize = sizeof(mii); + mii.fMask = MIIM_TYPE; + mii.fType = MFT_SEPARATOR; + mii.fState = MFS_ENABLED; + InsertMenuItem(hmenu, nPos, TRUE, &mii); +} + +///////////////////////////////////////////////////////////////////////////// +// IDocHostUIHandler + +HRESULT STDMETHODCALLTYPE CBrowserCtlSite::ShowContextMenu(/* [in] */ DWORD dwID, /* [in] */ POINT __RPC_FAR *ppt, /* [in] */ IUnknown __RPC_FAR *pcmdtReserved, /* [in] */ IDispatch __RPC_FAR *pdispReserved) +{ + if (m_bUseCustomPopupMenu) + { + tstring szMenuText(_T("Unknown context")); + HMENU hmenu = CreatePopupMenu(); + _InsertMenuItem(hmenu, 0, 1, _T("CBrowse context popup")); + _InsertMenuSeperator(hmenu, 1); + switch (dwID) + { + case CONTEXT_MENU_DEFAULT: + szMenuText = _T("Default context"); + break; + case CONTEXT_MENU_IMAGE: + szMenuText = _T("Image context"); + break; + case CONTEXT_MENU_CONTROL: + szMenuText = _T("Control context"); + break; + case CONTEXT_MENU_TABLE: + szMenuText = _T("Table context"); + break; + case CONTEXT_MENU_TEXTSELECT: + szMenuText = _T("TextSelect context"); + break; + case CONTEXT_MENU_ANCHOR: + szMenuText = _T("Anchor context"); + break; + case CONTEXT_MENU_UNKNOWN: + szMenuText = _T("Unknown context"); + break; + } + + _InsertMenuItem(hmenu, 2, 2, szMenuText.c_str()); + + POINT pt; + GetCursorPos(&pt); + TrackPopupMenu(hmenu, TPM_RETURNCMD, pt.x, pt.y, 0, AfxGetMainWnd()->GetSafeHwnd(), NULL); + DestroyMenu(hmenu); + return S_OK; + } + return S_FALSE; +} + +HRESULT STDMETHODCALLTYPE CBrowserCtlSite::GetHostInfo(/* [out][in] */ DOCHOSTUIINFO __RPC_FAR *pInfo) +{ + return E_NOTIMPL; +} + +HRESULT STDMETHODCALLTYPE CBrowserCtlSite::ShowUI(/* [in] */ DWORD dwID, /* [in] */ IOleInPlaceActiveObject __RPC_FAR *pActiveObject, /* [in] */ IOleCommandTarget __RPC_FAR *pCommandTarget, /* [in] */ IOleInPlaceFrame __RPC_FAR *pFrame, /* [in] */ IOleInPlaceUIWindow __RPC_FAR *pDoc) +{ + return E_NOTIMPL; +} + +HRESULT STDMETHODCALLTYPE CBrowserCtlSite::HideUI(void) +{ + return E_NOTIMPL; +} + +HRESULT STDMETHODCALLTYPE CBrowserCtlSite::UpdateUI(void) +{ + return E_NOTIMPL; +} + +HRESULT STDMETHODCALLTYPE CBrowserCtlSite::EnableModeless(/* [in] */ BOOL fEnable) +{ + return E_NOTIMPL; +} + +HRESULT STDMETHODCALLTYPE CBrowserCtlSite::OnDocWindowActivate(/* [in] */ BOOL fActivate) +{ + return E_NOTIMPL; +} + +HRESULT STDMETHODCALLTYPE CBrowserCtlSite::OnFrameWindowActivate(/* [in] */ BOOL fActivate) +{ + return E_NOTIMPL; +} + +HRESULT STDMETHODCALLTYPE CBrowserCtlSite::ResizeBorder(/* [in] */ LPCRECT prcBorder, /* [in] */ IOleInPlaceUIWindow __RPC_FAR *pUIWindow, /* [in] */ BOOL fRameWindow) +{ + return E_NOTIMPL; +} + +HRESULT STDMETHODCALLTYPE CBrowserCtlSite::TranslateAccelerator(/* [in] */ LPMSG lpMsg, /* [in] */ const GUID __RPC_FAR *pguidCmdGroup, /* [in] */ DWORD nCmdID) +{ + return E_NOTIMPL; +} + +HRESULT STDMETHODCALLTYPE CBrowserCtlSite::GetOptionKeyPath(/* [out] */ LPOLESTR __RPC_FAR *pchKey, /* [in] */ DWORD dw) +{ + return E_NOTIMPL; +} + +HRESULT STDMETHODCALLTYPE CBrowserCtlSite::GetDropTarget(/* [in] */ IDropTarget __RPC_FAR *pDropTarget, /* [out] */ IDropTarget __RPC_FAR *__RPC_FAR *ppDropTarget) +{ + return E_NOTIMPL; +} + +HRESULT STDMETHODCALLTYPE CBrowserCtlSite::GetExternal(/* [out] */ IDispatch __RPC_FAR *__RPC_FAR *ppDispatch) +{ + return E_NOTIMPL; +} + +HRESULT STDMETHODCALLTYPE CBrowserCtlSite::TranslateUrl(/* [in] */ DWORD dwTranslate, /* [in] */ OLECHAR __RPC_FAR *pchURLIn, /* [out] */ OLECHAR __RPC_FAR *__RPC_FAR *ppchURLOut) +{ + return E_NOTIMPL; +} + +HRESULT STDMETHODCALLTYPE CBrowserCtlSite::FilterDataObject(/* [in] */ IDataObject __RPC_FAR *pDO, /* [out] */ IDataObject __RPC_FAR *__RPC_FAR *ppDORet) +{ + return E_NOTIMPL; +} + + +/////////////////////////////////////////////////////////////////////////////// +// IDocHostShowUI + +HRESULT STDMETHODCALLTYPE CBrowserCtlSite::ShowMessage(/* [in] */ HWND hwnd, /* [in] */ LPOLESTR lpstrText, /* [in] */ LPOLESTR lpstrCaption, /* [in] */ DWORD dwType, /* [in] */ LPOLESTR lpstrHelpFile, /* [in] */ DWORD dwHelpContext,/* [out] */ LRESULT __RPC_FAR *plResult) +{ + return S_FALSE; +} + +HRESULT STDMETHODCALLTYPE CBrowserCtlSite::ShowHelp(/* [in] */ HWND hwnd, /* [in] */ LPOLESTR pszHelpFile, /* [in] */ UINT uCommand, /* [in] */ DWORD dwData, /* [in] */ POINT ptMouse, /* [out] */ IDispatch __RPC_FAR *pDispatchObjectHit) +{ + return S_FALSE; +} + diff --git a/mozilla/embedding/browser/activex/tests/cbrowse/CBrowserCtlSite.h b/mozilla/embedding/browser/activex/tests/cbrowse/CBrowserCtlSite.h new file mode 100644 index 00000000000..f4b911e2fd7 --- /dev/null +++ b/mozilla/embedding/browser/activex/tests/cbrowse/CBrowserCtlSite.h @@ -0,0 +1,56 @@ +// CBrowserCtlSite.h : Declaration of the CBrowserCtlSite + +#ifndef __CBROWSERCTLSITE_H_ +#define __CBROWSERCTLSITE_H_ + +#include "resource.h" // main symbols + +///////////////////////////////////////////////////////////////////////////// +// CBrowserCtlSite +class ATL_NO_VTABLE CBrowserCtlSite : + public CControlSite, + public IDocHostUIHandler, + public IDocHostShowUI +{ +public: + CBrowserCtlSite(); + +DECLARE_REGISTRY_RESOURCEID(IDR_CBROWSERCTLSITE) + +DECLARE_PROTECT_FINAL_CONSTRUCT() + +BEGIN_COM_MAP(CBrowserCtlSite) + CCONTROLSITE_INTERFACES() + COM_INTERFACE_ENTRY(IDocHostUIHandler) + COM_INTERFACE_ENTRY(IDocHostShowUI) +END_COM_MAP() + + BOOL m_bUseCustomPopupMenu; + BOOL m_bUseCustomDropTarget; + +public: +// IDocHostUIHandler + virtual HRESULT STDMETHODCALLTYPE ShowContextMenu(/* [in] */ DWORD dwID, /* [in] */ POINT __RPC_FAR *ppt, /* [in] */ IUnknown __RPC_FAR *pcmdtReserved, /* [in] */ IDispatch __RPC_FAR *pdispReserved); + virtual HRESULT STDMETHODCALLTYPE GetHostInfo(/* [out][in] */ DOCHOSTUIINFO __RPC_FAR *pInfo); + virtual HRESULT STDMETHODCALLTYPE ShowUI(/* [in] */ DWORD dwID, /* [in] */ IOleInPlaceActiveObject __RPC_FAR *pActiveObject, /* [in] */ IOleCommandTarget __RPC_FAR *pCommandTarget, /* [in] */ IOleInPlaceFrame __RPC_FAR *pFrame, /* [in] */ IOleInPlaceUIWindow __RPC_FAR *pDoc); + virtual HRESULT STDMETHODCALLTYPE HideUI(void); + virtual HRESULT STDMETHODCALLTYPE UpdateUI(void); + virtual HRESULT STDMETHODCALLTYPE EnableModeless(/* [in] */ BOOL fEnable); + virtual HRESULT STDMETHODCALLTYPE OnDocWindowActivate(/* [in] */ BOOL fActivate); + virtual HRESULT STDMETHODCALLTYPE OnFrameWindowActivate(/* [in] */ BOOL fActivate); + virtual HRESULT STDMETHODCALLTYPE ResizeBorder(/* [in] */ LPCRECT prcBorder, /* [in] */ IOleInPlaceUIWindow __RPC_FAR *pUIWindow, /* [in] */ BOOL fRameWindow); + virtual HRESULT STDMETHODCALLTYPE TranslateAccelerator(/* [in] */ LPMSG lpMsg, /* [in] */ const GUID __RPC_FAR *pguidCmdGroup, /* [in] */ DWORD nCmdID); + virtual HRESULT STDMETHODCALLTYPE GetOptionKeyPath(/* [out] */ LPOLESTR __RPC_FAR *pchKey, /* [in] */ DWORD dw); + virtual HRESULT STDMETHODCALLTYPE GetDropTarget(/* [in] */ IDropTarget __RPC_FAR *pDropTarget, /* [out] */ IDropTarget __RPC_FAR *__RPC_FAR *ppDropTarget); + virtual HRESULT STDMETHODCALLTYPE GetExternal(/* [out] */ IDispatch __RPC_FAR *__RPC_FAR *ppDispatch); + virtual HRESULT STDMETHODCALLTYPE TranslateUrl(/* [in] */ DWORD dwTranslate, /* [in] */ OLECHAR __RPC_FAR *pchURLIn, /* [out] */ OLECHAR __RPC_FAR *__RPC_FAR *ppchURLOut); + virtual HRESULT STDMETHODCALLTYPE FilterDataObject(/* [in] */ IDataObject __RPC_FAR *pDO, /* [out] */ IDataObject __RPC_FAR *__RPC_FAR *ppDORet); + +// IDocHostShowUI + virtual HRESULT STDMETHODCALLTYPE ShowMessage(/* [in] */ HWND hwnd, /* [in] */ LPOLESTR lpstrText, /* [in] */ LPOLESTR lpstrCaption, /* [in] */ DWORD dwType, /* [in] */ LPOLESTR lpstrHelpFile, /* [in] */ DWORD dwHelpContext,/* [out] */ LRESULT __RPC_FAR *plResult); + virtual HRESULT STDMETHODCALLTYPE ShowHelp(/* [in] */ HWND hwnd, /* [in] */ LPOLESTR pszHelpFile, /* [in] */ UINT uCommand, /* [in] */ DWORD dwData, /* [in] */ POINT ptMouse, /* [out] */ IDispatch __RPC_FAR *pDispatchObjectHit); +}; + +typedef CComObject CBrowserCtlSiteInstance; + +#endif //__CBROWSERCTLSITE_H_ diff --git a/mozilla/embedding/browser/activex/tests/cbrowse/CBrowserCtlSite.rgs b/mozilla/embedding/browser/activex/tests/cbrowse/CBrowserCtlSite.rgs new file mode 100644 index 00000000000..1e1f11f1d40 --- /dev/null +++ b/mozilla/embedding/browser/activex/tests/cbrowse/CBrowserCtlSite.rgs @@ -0,0 +1,24 @@ +HKCR +{ + Cbrowse.CBrowserCtlSite.1 = s 'CBrowserCtlSite Class' + { + CLSID = s '{8EC06081-21DE-11D3-941E-000000000000}' + } + Cbrowse.CBrowserCtlSite = s 'CBrowserCtlSite Class' + { + CLSID = s '{8EC06081-21DE-11D3-941E-000000000000}' + CurVer = s 'Cbrowse.CBrowserCtlSite.1' + } + NoRemove CLSID + { + ForceRemove {8EC06081-21DE-11D3-941E-000000000000} = s 'CBrowserCtlSite Class' + { + ProgID = s 'Cbrowse.CBrowserCtlSite.1' + VersionIndependentProgID = s 'Cbrowse.CBrowserCtlSite' + ForceRemove 'Programmable' + LocalServer32 = s '%MODULE%' + val AppID = s '{5B209214-F756-11D2-A27F-000000000000}' + 'TypeLib' = s '{5B209213-F756-11D2-A27F-000000000000}' + } + } +} diff --git a/mozilla/embedding/browser/activex/tests/cbrowse/Cbrowse.idl b/mozilla/embedding/browser/activex/tests/cbrowse/Cbrowse.idl new file mode 100644 index 00000000000..40ee7d59e4b --- /dev/null +++ b/mozilla/embedding/browser/activex/tests/cbrowse/Cbrowse.idl @@ -0,0 +1,68 @@ + + // Cbrowse.idl : IDL source for Cbrowse.exe +// +// This file will be processed by the MIDL tool to +// produce the type library (Cbrowse.tlb) and marshalling code. +import "oaidl.idl"; +import "ocidl.idl"; + +typedef enum +{ + trNotRun, + trFailed, + trPassed, + trPartial +} TestResult; + + [ + object, + uuid(95AF1AB1-FA66-11D2-A284-000000000000), + dual, + helpstring("DITestScriptHelper Interface"), + pointer_default(unique) + ] + interface DITestScriptHelper : IDispatch + { + [id(1), helpstring("method OutputString")] HRESULT OutputString(BSTR bstrMessage); + [propget, id(2), helpstring("property WebBrowser")] HRESULT WebBrowser([out, retval] LPDISPATCH *pVal); + [propput, id(3), helpstring("property Result")] HRESULT Result([in] TestResult newVal); + [propget, id(4), helpstring("property TestURL")] HRESULT TestURL([out, retval] BSTR *pVal); + [propget, id(5), helpstring("property TestCGI")] HRESULT TestCGI([out, retval] BSTR *pVal); + }; + +[ + uuid(5B209213-F756-11D2-A27F-000000000000), + version(1.0), + helpstring("Cbrowse 1.0 Type Library") +] +library CbrowseLib +{ + importlib("stdole32.tlb"); + importlib("stdole2.tlb"); + [ + uuid(95AF1AB2-FA66-11D2-A284-000000000000), + helpstring("TestScriptHelper Class") + ] + coclass TestScriptHelper + { + [default] interface DITestScriptHelper; + }; + [ + uuid(31204F42-FCE8-11D2-A289-000000000000), + helpstring("ControlEventSink Class") + ] + coclass ControlEventSink + { + [default] interface IDispatch; + }; + [ + uuid(8EC06081-21DE-11D3-941E-000000000000), + helpstring("CBrowserCtlSite Class") + ] + coclass CBrowserCtlSite + { + [default] interface IUnknown; + }; +}; + + \ No newline at end of file diff --git a/mozilla/embedding/browser/activex/tests/cbrowse/Cbrowse.rgs b/mozilla/embedding/browser/activex/tests/cbrowse/Cbrowse.rgs new file mode 100644 index 00000000000..e3325c9c8e3 --- /dev/null +++ b/mozilla/embedding/browser/activex/tests/cbrowse/Cbrowse.rgs @@ -0,0 +1,11 @@ +HKCR +{ + NoRemove AppID + { + {5B209214-F756-11D2-A27F-000000000000} = s 'Cbrowse' + 'Cbrowse.EXE' + { + val AppID = s {5B209214-F756-11D2-A27F-000000000000} + } + } +} diff --git a/mozilla/embedding/browser/activex/tests/cbrowse/ControlEventSink.cpp b/mozilla/embedding/browser/activex/tests/cbrowse/ControlEventSink.cpp new file mode 100644 index 00000000000..f8b6f898c43 --- /dev/null +++ b/mozilla/embedding/browser/activex/tests/cbrowse/ControlEventSink.cpp @@ -0,0 +1,144 @@ +// ControlEventSink.cpp : Implementation of CControlEventSink +#include "stdafx.h" +#include "Cbrowse.h" +#include "ControlEventSink.h" + +///////////////////////////////////////////////////////////////////////////// +// CControlEventSink + +HRESULT STDMETHODCALLTYPE CControlEventSink::GetTypeInfoCount( + /* [out] */ UINT __RPC_FAR *pctinfo) +{ + return E_NOTIMPL; +} + +HRESULT STDMETHODCALLTYPE CControlEventSink::GetTypeInfo( + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo __RPC_FAR *__RPC_FAR *ppTInfo) +{ + return E_NOTIMPL; +} + +HRESULT STDMETHODCALLTYPE CControlEventSink::GetIDsOfNames( + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR __RPC_FAR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID __RPC_FAR *rgDispId) +{ + return E_NOTIMPL; +} + +HRESULT STDMETHODCALLTYPE CControlEventSink:: Invoke( + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS __RPC_FAR *pDispParams, + /* [out] */ VARIANT __RPC_FAR *pVarResult, + /* [out] */ EXCEPINFO __RPC_FAR *pExcepInfo, + /* [out] */ UINT __RPC_FAR *puArgErr) +{ + CString szEvent; + + switch (dispIdMember) + { + case 0x66: + { + USES_CONVERSION; + CString szText(OLE2T(pDispParams->rgvarg[0].bstrVal)); + szEvent.Format(_T("StatusTextChange: \"%s\""), szText); + m_pBrowseDlg->m_TabMessages.m_szStatus = szText; + m_pBrowseDlg->m_TabMessages.UpdateData(FALSE); + } + break; + case 0x6c: + { + LONG nProgress = pDispParams->rgvarg[1].lVal; + LONG nProgressMax = pDispParams->rgvarg[0].lVal; + szEvent.Format("ProgressChange(%d of %d)", nProgress, nProgressMax); + CProgressCtrl &pc = m_pBrowseDlg->m_TabMessages.m_pcProgress; + pc.SetRange(0, nProgressMax); + pc.SetPos(nProgress); + } + break; + case 0x69: + szEvent = _T("CommandStateChange"); + break; + case 0x6a: + szEvent = _T("DownloadBegin"); + break; + case 0x68: + szEvent = _T("DownloadComplete"); + break; + case 0x71: + szEvent = _T("TitleChange"); + break; + case 0x70: + szEvent = _T("PropertyChange"); + break; + case 0xfa: + { + szEvent = _T("BeforeNavigate2"); + } + break; + case 0xfb: + { + szEvent = _T("NewWindow2"); + + VARIANTARG *pvars = pDispParams->rgvarg; + CBrowseDlg *pDlg = new CBrowseDlg; + if (pDlg) + { + pDlg->m_clsid = m_pBrowseDlg->m_clsid; + pDlg->Create(IDD_CBROWSE_DIALOG); + + if (pDlg->m_pControlSite) + { + CIUnkPtr spUnkBrowser; + pDlg->m_pControlSite->GetControlUnknown(&spUnkBrowser); + + pvars[0].byref = (void *) VARIANT_FALSE; + spUnkBrowser->QueryInterface(IID_IDispatch, (void **) pvars[1].byref); + } + } + } + break; + case 0xfc: + szEvent = _T("NavigateComplete2"); + break; + case 0x103: + szEvent = _T("DocumentComplete"); + break; + case 0xfd: + szEvent = _T("OnQuit"); + break; + case 0xfe: + szEvent = _T("OnVisible"); + break; + case 0xff: + szEvent = _T("OnToolBar"); + break; + case 0x100: + szEvent = _T("OnMenuBar"); + break; + case 0x101: + szEvent = _T("OnStatusBar"); + break; + case 0x102: + szEvent = _T("OnFullScreen"); + break; + case 0x104: + szEvent = _T("OnTheaterMode"); + break; + default: + szEvent.Format(_T("%d"), dispIdMember); + } + + if (m_pBrowseDlg) + { + m_pBrowseDlg->OutputString(_T("Event %s"), szEvent); + } + return S_OK; +} diff --git a/mozilla/embedding/browser/activex/tests/cbrowse/ControlEventSink.h b/mozilla/embedding/browser/activex/tests/cbrowse/ControlEventSink.h new file mode 100644 index 00000000000..597a8900b34 --- /dev/null +++ b/mozilla/embedding/browser/activex/tests/cbrowse/ControlEventSink.h @@ -0,0 +1,60 @@ +// ControlEventSink.h : Declaration of the CControlEventSink + +#ifndef __CONTROLEVENTSINK_H_ +#define __CONTROLEVENTSINK_H_ + +#include "CBrowseDlg.h" +#include "resource.h" // main symbols + +///////////////////////////////////////////////////////////////////////////// +// CControlEventSink +class ATL_NO_VTABLE CControlEventSink : + public CComObjectRootEx, + public CComCoClass, + public IDispatch +{ +public: + CControlEventSink() + { + m_pBrowseDlg = NULL; + } + + CBrowseDlg *m_pBrowseDlg; + +DECLARE_REGISTRY_RESOURCEID(IDR_CONTROLEVENTSINK) + +DECLARE_PROTECT_FINAL_CONSTRUCT() + +BEGIN_COM_MAP(CControlEventSink) + COM_INTERFACE_ENTRY(IDispatch) + COM_INTERFACE_ENTRY_IID(DIID_DWebBrowserEvents2, IDispatch) +END_COM_MAP() + +// IDispatch +public: + virtual HRESULT STDMETHODCALLTYPE GetTypeInfoCount( + /* [out] */ UINT __RPC_FAR *pctinfo); + virtual HRESULT STDMETHODCALLTYPE GetTypeInfo( + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo __RPC_FAR *__RPC_FAR *ppTInfo); + virtual HRESULT STDMETHODCALLTYPE GetIDsOfNames( + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR __RPC_FAR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID __RPC_FAR *rgDispId); + virtual /* [local] */ HRESULT STDMETHODCALLTYPE Invoke( + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS __RPC_FAR *pDispParams, + /* [out] */ VARIANT __RPC_FAR *pVarResult, + /* [out] */ EXCEPINFO __RPC_FAR *pExcepInfo, + /* [out] */ UINT __RPC_FAR *puArgErr); +}; + +typedef CComObject CControlEventSinkInstance; + +#endif //__CONTROLEVENTSINK_H_ diff --git a/mozilla/embedding/browser/activex/tests/cbrowse/ControlEventSink.rgs b/mozilla/embedding/browser/activex/tests/cbrowse/ControlEventSink.rgs new file mode 100644 index 00000000000..b6504637115 --- /dev/null +++ b/mozilla/embedding/browser/activex/tests/cbrowse/ControlEventSink.rgs @@ -0,0 +1,24 @@ +HKCR +{ + Cbrowse.ControlEventSink.1 = s 'ControlEventSink Class' + { + CLSID = s '{31204F42-FCE8-11D2-A289-000000000000}' + } + Cbrowse.ControlEventSink = s 'ControlEventSink Class' + { + CLSID = s '{31204F42-FCE8-11D2-A289-000000000000}' + CurVer = s 'Cbrowse.ControlEventSink.1' + } + NoRemove CLSID + { + ForceRemove {31204F42-FCE8-11D2-A289-000000000000} = s 'ControlEventSink Class' + { + ProgID = s 'Cbrowse.ControlEventSink.1' + VersionIndependentProgID = s 'Cbrowse.ControlEventSink' + ForceRemove 'Programmable' + LocalServer32 = s '%MODULE%' + val AppID = s '{5B209214-F756-11D2-A27F-000000000000}' + 'TypeLib' = s '{5B209213-F756-11D2-A27F-000000000000}' + } + } +} diff --git a/mozilla/embedding/browser/activex/tests/cbrowse/EditToolBar.cpp b/mozilla/embedding/browser/activex/tests/cbrowse/EditToolBar.cpp new file mode 100644 index 00000000000..7bfafcaab42 --- /dev/null +++ b/mozilla/embedding/browser/activex/tests/cbrowse/EditToolBar.cpp @@ -0,0 +1,33 @@ +// EditToolBar.cpp : implementation file +// + +#include "stdafx.h" +#include "cbrowse.h" +#include "EditToolBar.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// CEditToolBar + +CEditToolBar::CEditToolBar() +{ +} + +CEditToolBar::~CEditToolBar() +{ +} + + +BEGIN_MESSAGE_MAP(CEditToolBar, CToolBarCtrl) + //{{AFX_MSG_MAP(CEditToolBar) + // NOTE - the ClassWizard will add and remove mapping macros here. + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// CEditToolBar message handlers diff --git a/mozilla/embedding/browser/activex/tests/cbrowse/EditToolBar.h b/mozilla/embedding/browser/activex/tests/cbrowse/EditToolBar.h new file mode 100644 index 00000000000..06de03dd395 --- /dev/null +++ b/mozilla/embedding/browser/activex/tests/cbrowse/EditToolBar.h @@ -0,0 +1,48 @@ +#if !defined(AFX_EDITTOOLBAR_H__39B3B0A1_5412_11D3_9441_000000000000__INCLUDED_) +#define AFX_EDITTOOLBAR_H__39B3B0A1_5412_11D3_9441_000000000000__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 +// EditToolBar.h : header file +// + +///////////////////////////////////////////////////////////////////////////// +// CEditToolBar window + +class CEditToolBar : public CToolBarCtrl +{ +// Construction +public: + CEditToolBar(); + +// Attributes +public: + +// Operations +public: + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CEditToolBar) + //}}AFX_VIRTUAL + +// Implementation +public: + virtual ~CEditToolBar(); + + // Generated message map functions +protected: + //{{AFX_MSG(CEditToolBar) + // NOTE - the ClassWizard will add and remove member functions here. + //}}AFX_MSG + + DECLARE_MESSAGE_MAP() +}; + +///////////////////////////////////////////////////////////////////////////// + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_EDITTOOLBAR_H__39B3B0A1_5412_11D3_9441_000000000000__INCLUDED_) diff --git a/mozilla/embedding/browser/activex/tests/cbrowse/Html/main.htm b/mozilla/embedding/browser/activex/tests/cbrowse/Html/main.htm new file mode 100644 index 00000000000..825ae19eb44 --- /dev/null +++ b/mozilla/embedding/browser/activex/tests/cbrowse/Html/main.htm @@ -0,0 +1,32 @@ + + + + + + + +This is the main test page for the Mozilla control + + + + +

This is the main test page for the Mozilla control

+

Try out some links:

+

http://www.yahoo.com

+

http://www.netscape.com

+

http://www.excite.com

+

http://www.mozilla.org

+

How about a nice form to test out the PostData value in BeforeNavigate2?

+

Ok then! An Altavista Search -

+
+ + + + +
+

 

+

 

+ + + + diff --git a/mozilla/embedding/browser/activex/tests/cbrowse/PickerDlg.cpp b/mozilla/embedding/browser/activex/tests/cbrowse/PickerDlg.cpp new file mode 100644 index 00000000000..a223987342e --- /dev/null +++ b/mozilla/embedding/browser/activex/tests/cbrowse/PickerDlg.cpp @@ -0,0 +1,129 @@ +// PickerDlg.cpp : implementation file +// + +#include "stdafx.h" +#include "cbrowse.h" +#include "PickerDlg.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +// CLSIDs for the Mozilla and IE browser controls + +static const CLSID CLSID_Mozilla = +{ 0x1339B54C, 0x3453, 0x11D2, { 0x93, 0xB9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }; + +static const CLSID CLSID_InternetExplorer = +{ 0x8856F961, 0x340A, 0x11D0, { 0xA9, 0x6B, 0x00, 0xC0, 0x4F, 0xD7, 0x05, 0xA2 } }; + +static const CLSID CLSID_MSHTML = +{ 0x2D360200, 0xFFF5, 0x11D1, { 0x8D, 0x03, 0x00, 0xA0, 0xC9, 0x59, 0xBC, 0x0A } }; + +struct BrowserControl +{ + TCHAR *szName; + const CLSID *clsid; +}; + +BrowserControl aControls[] = +{ + { _T("Mozilla Control"), &CLSID_Mozilla }, + { _T("Internet Explorer Control"), &CLSID_InternetExplorer } +}; + + +///////////////////////////////////////////////////////////////////////////// +// CPickerDlg dialog + + +CPickerDlg::CPickerDlg(CWnd* pParent /*=NULL*/) + : CDialog(CPickerDlg::IDD, pParent) +{ + //{{AFX_DATA_INIT(CPickerDlg) + m_szTestURL = _T(""); + m_szTestCGI = _T(""); + m_bDebugging = FALSE; + m_sDebugFlags = _T(""); + m_bUseCustom = FALSE; + //}}AFX_DATA_INIT + m_clsid = CLSID_NULL; + + CWinApp *pApp = AfxGetApp(); + m_szTestURL = pApp->GetProfileString(SECTION_TEST, KEY_TESTURL, KEY_TESTURL_DEFAULTVALUE); + m_szTestCGI = pApp->GetProfileString(SECTION_TEST, KEY_TESTCGI, KEY_TESTCGI_DEFAULTVALUE); + m_sDebugFlags = _T("NSPR_LOG_MODULES=nsComponentManager:5"); +} + +void CPickerDlg::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + //{{AFX_DATA_MAP(CPickerDlg) + DDX_Control(pDX, IDC_LISTBROWSER, m_lbPicker); + DDX_Text(pDX, IDC_TESTURL, m_szTestURL); + DDX_Text(pDX, IDC_TESTCGI, m_szTestCGI); + DDX_Check(pDX, IDC_CHECK1, m_bDebugging); + DDX_Text(pDX, IDC_EDIT1, m_sDebugFlags); + DDX_Check(pDX, IDC_OVERRIDE, m_bUseCustom); + //}}AFX_DATA_MAP +} + + +BEGIN_MESSAGE_MAP(CPickerDlg, CDialog) + //{{AFX_MSG_MAP(CPickerDlg) + ON_BN_CLICKED(IDOK, OnOk) + ON_LBN_DBLCLK(IDC_LISTBROWSER, OnDblclkListbrowser) + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// CPickerDlg message handlers + +BOOL CPickerDlg::OnInitDialog() +{ + CDialog::OnInitDialog(); + + for (int i = 0; i < sizeof(aControls) / sizeof(aControls[0]); i++) + { + m_lbPicker.AddString(aControls[i].szName); + } + m_lbPicker.SetCurSel(0); + + return TRUE; // return TRUE unless you set the focus to a control + // EXCEPTION: OCX Property Pages should return FALSE +} + + +void CPickerDlg::OnOk() +{ + UpdateData(); + + int nItem = m_lbPicker.GetCurSel(); + if (nItem == LB_ERR) + { + AfxMessageBox(IDS_CHOOSEBROWSER); + return; + } + + m_clsid = *aControls[nItem].clsid; + + CWinApp *pApp = AfxGetApp(); + pApp->WriteProfileString(SECTION_TEST, KEY_TESTURL, m_szTestURL); + pApp->WriteProfileString(SECTION_TEST, KEY_TESTCGI, m_szTestCGI); + + if (m_bDebugging) + { + putenv("NSPR_LOG_FILE=.\\mozilla.log"); + putenv(m_sDebugFlags); + } + + EndDialog(IDOK); +} + + +void CPickerDlg::OnDblclkListbrowser() +{ + OnOk(); +} diff --git a/mozilla/embedding/browser/activex/tests/cbrowse/PickerDlg.h b/mozilla/embedding/browser/activex/tests/cbrowse/PickerDlg.h new file mode 100644 index 00000000000..36663e2b262 --- /dev/null +++ b/mozilla/embedding/browser/activex/tests/cbrowse/PickerDlg.h @@ -0,0 +1,54 @@ +#if !defined(AFX_PICKERDLG_H__648FC652_D34B_11D2_A255_000000000000__INCLUDED_) +#define AFX_PICKERDLG_H__648FC652_D34B_11D2_A255_000000000000__INCLUDED_ + +#if _MSC_VER >= 1000 +#pragma once +#endif // _MSC_VER >= 1000 +// PickerDlg.h : header file +// + +///////////////////////////////////////////////////////////////////////////// +// CPickerDlg dialog + +class CPickerDlg : public CDialog +{ +// Construction +public: + CPickerDlg(CWnd* pParent = NULL); // standard constructor + +// Dialog Data + //{{AFX_DATA(CPickerDlg) + enum { IDD = IDD_PICKBROWSER }; + CListBox m_lbPicker; + CString m_szTestURL; + CString m_szTestCGI; + BOOL m_bDebugging; + CString m_sDebugFlags; + BOOL m_bUseCustom; + //}}AFX_DATA + + CLSID m_clsid; + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CPickerDlg) + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + //}}AFX_VIRTUAL + +// Implementation +protected: + + // Generated message map functions + //{{AFX_MSG(CPickerDlg) + afx_msg void OnOk(); + virtual BOOL OnInitDialog(); + afx_msg void OnDblclkListbrowser(); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +}; + +//{{AFX_INSERT_LOCATION}} +// Microsoft Developer Studio will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_PICKERDLG_H__648FC652_D34B_11D2_A255_000000000000__INCLUDED_) diff --git a/mozilla/embedding/browser/activex/tests/cbrowse/Scripts/Basic.vbs b/mozilla/embedding/browser/activex/tests/cbrowse/Scripts/Basic.vbs new file mode 100644 index 00000000000..4b722c11997 --- /dev/null +++ b/mozilla/embedding/browser/activex/tests/cbrowse/Scripts/Basic.vbs @@ -0,0 +1,4 @@ +' A simple test just to prove things are sane + +OutputString "Simple Navigation Test" +WebBrowser.Navigate TestURL diff --git a/mozilla/embedding/browser/activex/tests/cbrowse/Scripts/NewWindow.vbs b/mozilla/embedding/browser/activex/tests/cbrowse/Scripts/NewWindow.vbs new file mode 100644 index 00000000000..69e4ddb8068 --- /dev/null +++ b/mozilla/embedding/browser/activex/tests/cbrowse/Scripts/NewWindow.vbs @@ -0,0 +1,4 @@ +' Opens a new window + +OutputString "Navigate in new window" +WebBrowser.Navigate TestURL, 1 diff --git a/mozilla/embedding/browser/activex/tests/cbrowse/Scripts/Post.vbs b/mozilla/embedding/browser/activex/tests/cbrowse/Scripts/Post.vbs new file mode 100644 index 00000000000..80d77dcf8c1 --- /dev/null +++ b/mozilla/embedding/browser/activex/tests/cbrowse/Scripts/Post.vbs @@ -0,0 +1,6 @@ +' Opens a URL and POST data + + +sPostData = "name1=value1" +OutputString "CGI script POST test to URL " + TestCGI + sPostData +WebBrowser.Navigate TestCGI, 0, , sPostData diff --git a/mozilla/embedding/browser/activex/tests/cbrowse/StdAfx.cpp b/mozilla/embedding/browser/activex/tests/cbrowse/StdAfx.cpp new file mode 100644 index 00000000000..d1706d0e211 --- /dev/null +++ b/mozilla/embedding/browser/activex/tests/cbrowse/StdAfx.cpp @@ -0,0 +1,13 @@ +// stdafx.cpp : source file that includes just the standard includes +// cbrowse.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information + +#include "stdafx.h" + +#ifdef _ATL_STATIC_REGISTRY +#include +#endif +#include +#include +#include + diff --git a/mozilla/embedding/browser/activex/tests/cbrowse/StdAfx.h b/mozilla/embedding/browser/activex/tests/cbrowse/StdAfx.h new file mode 100644 index 00000000000..1bd0cbab3ab --- /dev/null +++ b/mozilla/embedding/browser/activex/tests/cbrowse/StdAfx.h @@ -0,0 +1,75 @@ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, but +// are changed infrequently +// + +#if !defined(AFX_STDAFX_H__5121F5E8_5324_11D2_93E1_000000000000__INCLUDED_) +#define AFX_STDAFX_H__5121F5E8_5324_11D2_93E1_000000000000__INCLUDED_ + +#if _MSC_VER >= 1000 +#pragma once +#endif // _MSC_VER >= 1000 + +#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers + +#include // MFC core and standard components +#include // MFC extensions +#include // MFC OLE automation classes +#ifndef _AFX_NO_AFXCMN_SUPPORT +#include // MFC support for Windows Common Controls +#endif // _AFX_NO_AFXCMN_SUPPORT + +#define _ATL_APARTMENT_THREADED +#define _ATL_DEBUG_INTERFACES + +// ATL headers +#include + +class CBrowseModule : public CComModule +{ +public: + DWORD dwThreadID; + + LPCTSTR FindOneOf(LPCTSTR p1, LPCTSTR p2); + virtual LONG Unlock(); + virtual LONG Lock(); +}; + +extern CBrowseModule _Module; + +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include + +#include "..\..\ActiveXTypes.h" +#include "..\..\BrowserDiagnostics.h" +#include "..\..\PropertyList.h" +#include "..\..\PropertyBag.h" +#include "..\..\ControlSiteIPFrame.h" +#include "..\..\ControlSite.h" +#include "..\..\ActiveScriptSite.h" + +#include "CBrowserCtlSite.h" +#include "Tests.h" + +#define SECTION_TEST _T("Test") +#define KEY_TESTURL _T("TestURL") +#define KEY_TESTCGI _T("TestCGI") +#define KEY_TESTURL_DEFAULTVALUE _T("http://www.mozilla.org") +#define KEY_TESTCGI_DEFAULTVALUE _T("http://www.mozilla.org") + + + +//{{AFX_INSERT_LOCATION}} +// Microsoft Developer Studio will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_STDAFX_H__5121F5E8_5324_11D2_93E1_000000000000__INCLUDED_) diff --git a/mozilla/embedding/browser/activex/tests/cbrowse/TabDOM.cpp b/mozilla/embedding/browser/activex/tests/cbrowse/TabDOM.cpp new file mode 100644 index 00000000000..efd6a25b3e0 --- /dev/null +++ b/mozilla/embedding/browser/activex/tests/cbrowse/TabDOM.cpp @@ -0,0 +1,69 @@ +// TabDOM.cpp : implementation file +// + +#include "stdafx.h" +#include "cbrowse.h" +#include "TabDOM.h" +#include "CBrowseDlg.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// CTabDOM property page + +IMPLEMENT_DYNCREATE(CTabDOM, CPropertyPage) + +CTabDOM::CTabDOM() : CPropertyPage(CTabDOM::IDD, CTabDOM::IDD) +{ + //{{AFX_DATA_INIT(CTabDOM) + // NOTE: the ClassWizard will add member initialization here + //}}AFX_DATA_INIT +} + + +CTabDOM::~CTabDOM() +{ +} + + +void CTabDOM::DoDataExchange(CDataExchange* pDX) +{ + CPropertyPage::DoDataExchange(pDX); + //{{AFX_DATA_MAP(CTabDOM) + DDX_Control(pDX, IDC_DOMLIST, m_tcDOM); + //}}AFX_DATA_MAP +} + + +BEGIN_MESSAGE_MAP(CTabDOM, CPropertyPage) + //{{AFX_MSG_MAP(CTabDOM) + ON_BN_CLICKED(IDC_REFRESHDOM, OnRefreshDOM) + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// CTabDOM message handlers + +void CTabDOM::OnRefreshDOM() +{ + if (m_pBrowseDlg) + { + m_pBrowseDlg->OnRefreshDOM(); + } +} + + +BOOL CTabDOM::OnInitDialog() +{ + CPropertyPage::OnInitDialog(); + + // Create the DOM tree + m_tcDOM.SetImageList(&m_pBrowseDlg->m_cImageList, TVSIL_NORMAL); + + return TRUE; // return TRUE unless you set the focus to a control + // EXCEPTION: OCX Property Pages should return FALSE +} diff --git a/mozilla/embedding/browser/activex/tests/cbrowse/TabDOM.h b/mozilla/embedding/browser/activex/tests/cbrowse/TabDOM.h new file mode 100644 index 00000000000..ed301d22553 --- /dev/null +++ b/mozilla/embedding/browser/activex/tests/cbrowse/TabDOM.h @@ -0,0 +1,54 @@ +#if !defined(AFX_TABDOM_H__5216DE08_12D4_11D3_9407_000000000000__INCLUDED_) +#define AFX_TABDOM_H__5216DE08_12D4_11D3_9407_000000000000__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 +// TabDOM.h : header file +// + +class CBrowseDlg; + +///////////////////////////////////////////////////////////////////////////// +// CTabDOM dialog + +class CTabDOM : public CPropertyPage +{ + DECLARE_DYNCREATE(CTabDOM) + +// Construction +public: + CTabDOM(); + ~CTabDOM(); + + CBrowseDlg *m_pBrowseDlg; + +// Dialog Data + //{{AFX_DATA(CTabDOM) + enum { IDD = IDD_TAB_DOM }; + CTreeCtrl m_tcDOM; + //}}AFX_DATA + + +// Overrides + // ClassWizard generate virtual function overrides + //{{AFX_VIRTUAL(CTabDOM) + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + //}}AFX_VIRTUAL + +// Implementation +protected: + // Generated message map functions + //{{AFX_MSG(CTabDOM) + afx_msg void OnRefreshDOM(); + virtual BOOL OnInitDialog(); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() + +}; + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_TABDOM_H__5216DE08_12D4_11D3_9407_000000000000__INCLUDED_) diff --git a/mozilla/embedding/browser/activex/tests/cbrowse/TabMessages.cpp b/mozilla/embedding/browser/activex/tests/cbrowse/TabMessages.cpp new file mode 100644 index 00000000000..ae72388141b --- /dev/null +++ b/mozilla/embedding/browser/activex/tests/cbrowse/TabMessages.cpp @@ -0,0 +1,50 @@ +// TabMessages.cpp : implementation file +// + +#include "stdafx.h" +#include "cbrowse.h" +#include "TabMessages.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// CTabMessages property page + +IMPLEMENT_DYNCREATE(CTabMessages, CPropertyPage) + +CTabMessages::CTabMessages() : CPropertyPage(CTabMessages::IDD, CTabMessages::IDD) +{ + //{{AFX_DATA_INIT(CTabMessages) + m_szStatus = _T(""); + //}}AFX_DATA_INIT +} + + +CTabMessages::~CTabMessages() +{ +} + + +void CTabMessages::DoDataExchange(CDataExchange* pDX) +{ + CPropertyPage::DoDataExchange(pDX); + //{{AFX_DATA_MAP(CTabMessages) + DDX_Control(pDX, IDC_PROGRESS, m_pcProgress); + DDX_Control(pDX, IDC_OUTPUT, m_lbMessages); + DDX_Text(pDX, IDC_STATUS, m_szStatus); + //}}AFX_DATA_MAP +} + + +BEGIN_MESSAGE_MAP(CTabMessages, CPropertyPage) + //{{AFX_MSG_MAP(CTabMessages) + // NOTE: the ClassWizard will add message map macros here + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// CTabMessages message handlers diff --git a/mozilla/embedding/browser/activex/tests/cbrowse/TabMessages.h b/mozilla/embedding/browser/activex/tests/cbrowse/TabMessages.h new file mode 100644 index 00000000000..629401ef94a --- /dev/null +++ b/mozilla/embedding/browser/activex/tests/cbrowse/TabMessages.h @@ -0,0 +1,55 @@ +#if !defined(AFX_TABMESSAGES_H__33D0A350_12E1_11D3_9407_000000000000__INCLUDED_) +#define AFX_TABMESSAGES_H__33D0A350_12E1_11D3_9407_000000000000__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 +// TabMessages.h : header file +// + +class CBrowseDlg; + +///////////////////////////////////////////////////////////////////////////// +// CTabMessages dialog + +class CTabMessages : public CPropertyPage +{ + DECLARE_DYNCREATE(CTabMessages) + +// Construction +public: + CTabMessages(); + ~CTabMessages(); + + CBrowseDlg *m_pBrowseDlg; + +// Dialog Data + //{{AFX_DATA(CTabMessages) + enum { IDD = IDD_TAB_MESSAGES }; + CProgressCtrl m_pcProgress; + CListBox m_lbMessages; + CString m_szStatus; + //}}AFX_DATA + + +// Overrides + // ClassWizard generate virtual function overrides + //{{AFX_VIRTUAL(CTabMessages) + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + //}}AFX_VIRTUAL + +// Implementation +protected: + // Generated message map functions + //{{AFX_MSG(CTabMessages) + // NOTE: the ClassWizard will add member functions here + //}}AFX_MSG + DECLARE_MESSAGE_MAP() + +}; + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_TABMESSAGES_H__33D0A350_12E1_11D3_9407_000000000000__INCLUDED_) diff --git a/mozilla/embedding/browser/activex/tests/cbrowse/TabTests.cpp b/mozilla/embedding/browser/activex/tests/cbrowse/TabTests.cpp new file mode 100644 index 00000000000..4f1e355075e --- /dev/null +++ b/mozilla/embedding/browser/activex/tests/cbrowse/TabTests.cpp @@ -0,0 +1,114 @@ +// TabTests.cpp : implementation file +// + +#include "stdafx.h" +#include "cbrowse.h" +#include "TabTests.h" +#include "CBrowseDlg.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// CTabTests property page + +IMPLEMENT_DYNCREATE(CTabTests, CPropertyPage) + +CTabTests::CTabTests() : CPropertyPage(CTabTests::IDD, CTabTests::IDD) +{ + //{{AFX_DATA_INIT(CTabTests) + m_szTestDescription = _T(""); + //}}AFX_DATA_INIT +} + + +CTabTests::~CTabTests() +{ +} + + +void CTabTests::DoDataExchange(CDataExchange* pDX) +{ + CPropertyPage::DoDataExchange(pDX); + //{{AFX_DATA_MAP(CTabTests) + DDX_Control(pDX, IDC_RUNTEST, m_btnRunTest); + DDX_Control(pDX, IDC_TESTLIST, m_tcTests); + DDX_Text(pDX, IDC_TESTDESCRIPTION, m_szTestDescription); + //}}AFX_DATA_MAP +} + + +BEGIN_MESSAGE_MAP(CTabTests, CPropertyPage) + //{{AFX_MSG_MAP(CTabTests) + ON_BN_CLICKED(IDC_RUNTEST, OnRunTest) + ON_NOTIFY(TVN_SELCHANGED, IDC_TESTLIST, OnSelchangedTestlist) + ON_NOTIFY(NM_DBLCLK, IDC_TESTLIST, OnDblclkTestlist) + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// CTabTests message handlers + +void CTabTests::OnRunTest() +{ + m_pBrowseDlg->OnRunTest(); +} + + +void CTabTests::OnSelchangedTestlist(NMHDR* pNMHDR, LRESULT* pResult) +{ + NM_TREEVIEW* pNMTreeView = (NM_TREEVIEW*)pNMHDR; + + BOOL bItemSelected = FALSE; + m_szTestDescription.Empty(); + + HTREEITEM hItem = m_tcTests.GetNextItem(NULL, TVGN_FIRSTVISIBLE); + while (hItem) + { + UINT nState; + + nState = m_tcTests.GetItemState(hItem, TVIS_SELECTED); + if (nState & TVIS_SELECTED) + { + bItemSelected = TRUE; + if (m_tcTests.ItemHasChildren(hItem)) + { + TestSet *pTestSet = (TestSet *) m_tcTests.GetItemData(hItem); + m_szTestDescription = pTestSet->szDesc; + } + else + { + Test *pTest = (Test *) m_tcTests.GetItemData(hItem); + m_szTestDescription = pTest->szDesc; + } + } + + hItem = m_tcTests.GetNextItem(hItem, TVGN_NEXTVISIBLE); + } + + UpdateData(FALSE); + m_btnRunTest.EnableWindow(bItemSelected); + + *pResult = 0; +} + + +void CTabTests::OnDblclkTestlist(NMHDR* pNMHDR, LRESULT* pResult) +{ + OnRunTest(); + *pResult = 0; +} + + +BOOL CTabTests::OnInitDialog() +{ + CPropertyPage::OnInitDialog(); + + m_pBrowseDlg->PopulateTests(); + + return TRUE; // return TRUE unless you set the focus to a control + // EXCEPTION: OCX Property Pages should return FALSE +} diff --git a/mozilla/embedding/browser/activex/tests/cbrowse/TabTests.h b/mozilla/embedding/browser/activex/tests/cbrowse/TabTests.h new file mode 100644 index 00000000000..97ad46c87c4 --- /dev/null +++ b/mozilla/embedding/browser/activex/tests/cbrowse/TabTests.h @@ -0,0 +1,58 @@ +#if !defined(AFX_TABTESTS_H__33D0A351_12E1_11D3_9407_000000000000__INCLUDED_) +#define AFX_TABTESTS_H__33D0A351_12E1_11D3_9407_000000000000__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 +// TabTests.h : header file +// + +class CBrowseDlg; + +///////////////////////////////////////////////////////////////////////////// +// CTabTests dialog + +class CTabTests : public CPropertyPage +{ + DECLARE_DYNCREATE(CTabTests) + +// Construction +public: + CTabTests(); + ~CTabTests(); + + CBrowseDlg *m_pBrowseDlg; + +// Dialog Data + //{{AFX_DATA(CTabTests) + enum { IDD = IDD_TAB_TESTS }; + CButton m_btnRunTest; + CTreeCtrl m_tcTests; + CString m_szTestDescription; + //}}AFX_DATA + + +// Overrides + // ClassWizard generate virtual function overrides + //{{AFX_VIRTUAL(CTabTests) + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + //}}AFX_VIRTUAL + +// Implementation +protected: + // Generated message map functions + //{{AFX_MSG(CTabTests) + afx_msg void OnRunTest(); + afx_msg void OnSelchangedTestlist(NMHDR* pNMHDR, LRESULT* pResult); + afx_msg void OnDblclkTestlist(NMHDR* pNMHDR, LRESULT* pResult); + virtual BOOL OnInitDialog(); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() + +}; + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_TABTESTS_H__33D0A351_12E1_11D3_9407_000000000000__INCLUDED_) diff --git a/mozilla/embedding/browser/activex/tests/cbrowse/TestScriptHelper.cpp b/mozilla/embedding/browser/activex/tests/cbrowse/TestScriptHelper.cpp new file mode 100644 index 00000000000..0cecabdd2d6 --- /dev/null +++ b/mozilla/embedding/browser/activex/tests/cbrowse/TestScriptHelper.cpp @@ -0,0 +1,98 @@ +// TestScriptHelper.cpp : Implementation of CTestScriptHelper +#include "stdafx.h" +#include "Cbrowse.h" +#include "TestScriptHelper.h" + +///////////////////////////////////////////////////////////////////////////// +// CTestScriptHelper + + +STDMETHODIMP CTestScriptHelper::OutputString(BSTR bstrMessage) +{ + AFX_MANAGE_STATE(AfxGetStaticModuleState()) + + if (bstrMessage == NULL) + { + return E_INVALIDARG; + } + if (m_pBrowserInfo == NULL) + { + return E_UNEXPECTED; + } + + USES_CONVERSION; + m_pBrowserInfo->OutputString(OLE2T(bstrMessage)); + return S_OK; +} + + +STDMETHODIMP CTestScriptHelper::get_WebBrowser(LPDISPATCH *pVal) +{ + AFX_MANAGE_STATE(AfxGetStaticModuleState()) + + if (pVal == NULL) + { + return E_INVALIDARG; + } + + *pVal = NULL; + if (m_pBrowserInfo == NULL) + { + return E_UNEXPECTED; + } + + CIPtr(IWebBrowserApp) spWebBrowserApp; + m_pBrowserInfo->GetWebBrowser(&spWebBrowserApp); + return spWebBrowserApp->QueryInterface(IID_IDispatch, (void **) pVal); +} + + +STDMETHODIMP CTestScriptHelper::put_Result(TestResult newVal) +{ + AFX_MANAGE_STATE(AfxGetStaticModuleState()) + + if (m_pBrowserInfo == NULL) + { + return E_UNEXPECTED; + } + + m_pBrowserInfo->nResult = newVal; + + return S_OK; +} + + +STDMETHODIMP CTestScriptHelper::get_TestURL(BSTR *pVal) +{ + AFX_MANAGE_STATE(AfxGetStaticModuleState()) + + if (pVal == NULL) + { + return E_INVALIDARG; + } + if (m_pBrowserInfo) + { + USES_CONVERSION; + *pVal = SysAllocString(T2OLE(m_pBrowserInfo->szTestURL)); + } + + return S_OK; +} + + +STDMETHODIMP CTestScriptHelper::get_TestCGI(BSTR *pVal) +{ + AFX_MANAGE_STATE(AfxGetStaticModuleState()) + + if (pVal == NULL) + { + return E_INVALIDARG; + } + if (m_pBrowserInfo) + { + USES_CONVERSION; + *pVal = SysAllocString(T2OLE(m_pBrowserInfo->szTestCGI)); + } + + return S_OK; +} diff --git a/mozilla/embedding/browser/activex/tests/cbrowse/TestScriptHelper.h b/mozilla/embedding/browser/activex/tests/cbrowse/TestScriptHelper.h new file mode 100644 index 00000000000..8dfffebd791 --- /dev/null +++ b/mozilla/embedding/browser/activex/tests/cbrowse/TestScriptHelper.h @@ -0,0 +1,43 @@ +// TestScriptHelper.h : Declaration of the CTestScriptHelper + +#ifndef __TESTSCRIPTHELPER_H_ +#define __TESTSCRIPTHELPER_H_ + +#include "resource.h" // main symbols + +///////////////////////////////////////////////////////////////////////////// +// CTestScriptHelper +class ATL_NO_VTABLE CTestScriptHelper : + public CComObjectRootEx, + public CComCoClass, + public IDispatchImpl +{ +public: + CTestScriptHelper() + { + m_pBrowserInfo = NULL; + } + + BrowserInfo *m_pBrowserInfo; + +DECLARE_REGISTRY_RESOURCEID(IDR_TESTSCRIPTHELPER) + +DECLARE_PROTECT_FINAL_CONSTRUCT() + +BEGIN_COM_MAP(CTestScriptHelper) + COM_INTERFACE_ENTRY(DITestScriptHelper) + COM_INTERFACE_ENTRY(IDispatch) +END_COM_MAP() + +// DITestScriptHelper +public: + STDMETHOD(get_TestCGI)(/*[out, retval]*/ BSTR *pVal); + STDMETHOD(get_TestURL)(/*[out, retval]*/ BSTR *pVal); + STDMETHOD(put_Result)(/*[in]*/ TestResult newVal); + STDMETHOD(get_WebBrowser)(/*[out, retval]*/ LPDISPATCH *pVal); + STDMETHOD(OutputString)(BSTR bstrMessage); +}; + +typedef CComObject CTestScriptHelperInstance; + +#endif //__TESTSCRIPTHELPER_H_ diff --git a/mozilla/embedding/browser/activex/tests/cbrowse/TestScriptHelper.rgs b/mozilla/embedding/browser/activex/tests/cbrowse/TestScriptHelper.rgs new file mode 100644 index 00000000000..591f8eb0bdd --- /dev/null +++ b/mozilla/embedding/browser/activex/tests/cbrowse/TestScriptHelper.rgs @@ -0,0 +1,24 @@ +HKCR +{ + Cbrowse.TestScriptHelper.1 = s 'TestScriptHelper Class' + { + CLSID = s '{95AF1AB2-FA66-11D2-A284-000000000000}' + } + Cbrowse.TestScriptHelper = s 'TestScriptHelper Class' + { + CLSID = s '{95AF1AB2-FA66-11D2-A284-000000000000}' + CurVer = s 'Cbrowse.TestScriptHelper.1' + } + NoRemove CLSID + { + ForceRemove {95AF1AB2-FA66-11D2-A284-000000000000} = s 'TestScriptHelper Class' + { + ProgID = s 'Cbrowse.TestScriptHelper.1' + VersionIndependentProgID = s 'Cbrowse.TestScriptHelper' + ForceRemove 'Programmable' + LocalServer32 = s '%MODULE%' + val AppID = s '{5B209214-F756-11D2-A27F-000000000000}' + 'TypeLib' = s '{5B209213-F756-11D2-A27F-000000000000}' + } + } +} diff --git a/mozilla/embedding/browser/activex/tests/cbrowse/Tests.cpp b/mozilla/embedding/browser/activex/tests/cbrowse/Tests.cpp new file mode 100644 index 00000000000..6281322deaa --- /dev/null +++ b/mozilla/embedding/browser/activex/tests/cbrowse/Tests.cpp @@ -0,0 +1,491 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + */ + +#include "stdafx.h" + +#include "resource.h" +#include "Cbrowse.h" +#include "CBrowseDlg.h" +#include "TestScriptHelper.h" + +/////////////////////////////////////////////////////////////////////////////// + +void BrowserInfo::OutputString(const TCHAR *szMessage, ...) +{ + TCHAR szBuffer[256]; + + va_list cArgs; + va_start(cArgs, szMessage); + _vstprintf(szBuffer, szMessage, cArgs); + va_end(cArgs); + + CString szOutput; + szOutput.Format(_T(" Test: %s"), szBuffer); + + pBrowseDlg->OutputString(szOutput); +} + + +HRESULT BrowserInfo::GetWebBrowser(IWebBrowserApp **pWebBrowser) +{ + if (pIUnknown == NULL) + { + return E_FAIL; + } + return pIUnknown->QueryInterface(IID_IWebBrowserApp, (void **) pWebBrowser); +} + + +HRESULT BrowserInfo::GetDocument(IHTMLDocument2 **pDocument) +{ + CIPtr(IWebBrowserApp) cpWebBrowser; + if (FAILED(GetWebBrowser(&cpWebBrowser))) + { + return E_FAIL; + } + + CIPtr(IDispatch) cpDispDocument; + cpWebBrowser->get_Document(&cpDispDocument); + if (cpDispDocument == NULL) + { + return E_FAIL; + } + + return cpDispDocument->QueryInterface(IID_IHTMLDocument2, (void **) pDocument); +} + +/////////////////////////////////////////////////////////////////////////////// + +struct InterfaceInfo +{ + const IID *piid; + const TCHAR *szName; +}; + + +static InterfaceInfo aDocIIDs[] = +{ + { &IID_IOleCommandTarget, _T("IOleCommandTarget") }, + { &IID_IHTMLDocument, _T("IHTMLDocument") }, + { &IID_IHTMLDocument2, _T("IHTMLDocument2") }, + { &IID_IHTMLElementCollection, _T("IHTMLElementCollection") }, + { &IID_IHTMLElement, _T("IHTMLElement") } +}; + + +TestResult __cdecl tstDocument(BrowserInfo &cInfo) +{ + CIPtr(IHTMLDocument2) cpDocElement; + cInfo.GetDocument(&cpDocElement); + if (cpDocElement == NULL) + { + cInfo.OutputString(_T("Error: No document")); + return trFailed; + } + + // Dump out all the interfaces supported by the document element + for (int i = 0; i < sizeof(aDocIIDs) / sizeof(aDocIIDs[0]); i++) + { + IUnknown *pUnkI = NULL; + if (SUCCEEDED(cpDocElement->QueryInterface(*(aDocIIDs[i].piid), (void **) &pUnkI))) + { + cInfo.OutputString(_T("Info: Document supports interface %s"), aDocIIDs[i].szName); + pUnkI->Release(); + } + else + { + cInfo.OutputString(_T("Info: Document doesn't support interface %s"), aDocIIDs[i].szName); + } + } + + return trPassed; +} + + +TestResult __cdecl tstCollectionEnum(BrowserInfo &cInfo) +{ + CIPtr(IHTMLDocument2) cpDocElement; + cInfo.GetDocument(&cpDocElement); + if (cpDocElement == NULL) + { + cInfo.OutputString(_T("Error: No document")); + return trFailed; + } + + CIPtr(IHTMLElementCollection) cpColl; + HRESULT hr = cpDocElement->get_all( &cpColl ); + if (hr == S_OK) + { + CComPtr cpUnkEnum; + cpColl->get__newEnum(&cpUnkEnum); + if (cpUnkEnum == NULL) + { + cInfo.OutputString(_T("Error: No collection")); + return trFailed; + } + + CIPtr(IEnumVARIANT) cpEnumVARIANT = cpUnkEnum; + if (cpEnumVARIANT) + { + cInfo.OutputString(_T("Collection has IEnumVARIANT")); + } + CIPtr(IEnumUnknown) cpEnumUnknown = cpUnkEnum; + if (cpEnumUnknown) + { + cInfo.OutputString(_T("Collection has IEnumUnknown")); + } + } + else + { + cInfo.OutputString(_T("Error: No collection from document")); + return trFailed; + } + + return trPassed; +} + + +void tstDrillerLevel(BrowserInfo &cInfo, IHTMLElementCollection *pCollection, int nLevel) +{ + if (pCollection == NULL) + { + return; + } + + LONG nElements = 0;; + HRESULT hr = pCollection->get_length( &nElements ); + if (FAILED(hr)) + { + cInfo.OutputString(_T("Error: Collection failed to return number of elements!")); + return; + } + + USES_CONVERSION; + char szLevel[256]; + memset(szLevel, 0, sizeof(szLevel)); + memset(szLevel, ' ', nLevel); + TCHAR *szIndent = A2T(szLevel); + + cInfo.OutputString(_T("%sParsing collection..."), szIndent); + cInfo.OutputString(_T("%sCollection with %d elements"), szIndent, (int) nElements); + + for ( int i=0; i< nElements; i++ ) + { + VARIANT varIndex; + varIndex.vt = VT_UINT; + varIndex.lVal = i; + + VARIANT var2; + VariantInit( &var2 ); + CIPtr(IDispatch) cpDisp; + + hr = pCollection->item( varIndex, var2, &cpDisp ); + if ( hr != S_OK ) + { + continue; + } + + CIPtr(IHTMLElement) cpElem; + + hr = cpDisp->QueryInterface( IID_IHTMLElement, (void **)&cpElem ); + if ( hr == S_OK ) + { + + BSTR bstrTagName = NULL; + hr = cpElem->get_tagName(&bstrTagName); + CString szTagName = bstrTagName; + SysFreeString(bstrTagName); + + BSTR bstrID = NULL; + hr = cpElem->get_id(&bstrID); + CString szID = bstrID; + SysFreeString(bstrID); + + BSTR bstrClassName = NULL; + hr = cpElem->get_className(&bstrClassName); + CString szClassName = bstrClassName; + SysFreeString(bstrClassName); + + cInfo.OutputString(_T("%sElement at %d is %s"), szIndent, i, szTagName); + cInfo.OutputString(_T("%s id=%s"), szIndent, szID); + cInfo.OutputString(_T("%s classname=%s"), szIndent, szClassName); + + CIPtr(IHTMLImgElement) cpImgElem; + hr = cpDisp->QueryInterface( IID_IHTMLImgElement, (void **)&cpImgElem ); + if ( hr == S_OK ) + { +// cpImgElem->get_href(&bstr); + } + else + { + CIPtr(IHTMLAnchorElement) cpAnchElem; + hr = cpDisp->QueryInterface( IID_IHTMLAnchorElement, (void **)&cpAnchElem ); + if ( hr == S_OK ) + { +// cpAnchElem->get_href(&bstr); + } + } + + CIPtr(IDispatch) cpDispColl; + hr = cpElem->get_children(&cpDispColl); + if (hr == S_OK) + { + CIPtr(IHTMLElementCollection) cpColl = cpDispColl; + tstDrillerLevel(cInfo, cpColl, nLevel + 1); + } + } + } + + cInfo.OutputString(_T("%sEnd collection"), szIndent); +} + + +TestResult __cdecl tstDriller(BrowserInfo &cInfo) +{ + CIPtr(IHTMLDocument2) cpDocElement; + cInfo.GetDocument(&cpDocElement); + if (cpDocElement == NULL) + { + cInfo.OutputString(_T("Error: No document")); + return trFailed; + } + + CIPtr(IHTMLElementCollection) cpColl; + HRESULT hr = cpDocElement->get_all( &cpColl ); + if (hr == S_OK) + { + tstDrillerLevel(cInfo, cpColl, 0); + } + + return trPassed; +} + + +TestResult __cdecl tstTesters(BrowserInfo &cInfo) +{ + cInfo.OutputString("Test architecture is reasonably sane!"); + return trPassed; +} + + +TestResult __cdecl tstControlActive(BrowserInfo &cInfo) +{ + CBrowserCtlSiteInstance *pControlSite = cInfo.pControlSite; + if (pControlSite == NULL) + { + cInfo.OutputString(_T("Error: No control site")); + return trFailed; + } + + if (!pControlSite->IsInPlaceActive()) + { + cInfo.OutputString(_T("Error: Control is not in-place active")); + return trFailed; + } + + return trPassed; +} + + +TestResult __cdecl tstIWebBrowser(BrowserInfo &cInfo) +{ + if (cInfo.pIUnknown == NULL) + { + cInfo.OutputString(_T("Error: No control")); + return trFailed; + } + + CIPtr(IWebBrowser) cpIWebBrowser = cInfo.pIUnknown; + if (cpIWebBrowser) + { + return trPassed; + } + + cInfo.OutputString(_T("Error: No IWebBrowser")); + return trFailed; +} + + +TestResult __cdecl tstIWebBrowser2(BrowserInfo &cInfo) +{ + if (cInfo.pIUnknown == NULL) + { + cInfo.OutputString(_T("Error: No control")); + return trFailed; + } + CIPtr(IWebBrowser2) cpIWebBrowser = cInfo.pIUnknown; + if (cpIWebBrowser) + { + return trPassed; + } + + cInfo.OutputString(_T("Error: No IWebBrowser2")); + return trFailed; +} + + +TestResult __cdecl tstIWebBrowserApp(BrowserInfo &cInfo) +{ + if (cInfo.pIUnknown == NULL) + { + cInfo.OutputString(_T("Error: No control")); + return trFailed; + } + + CIPtr(IWebBrowserApp) cpIWebBrowser = cInfo.pIUnknown; + if (cpIWebBrowser) + { + return trPassed; + } + + cInfo.OutputString(_T("Error: No IWebBrowserApp")); + return trFailed; +} + + +TestResult __cdecl tstNavigate2(BrowserInfo &cInfo) +{ + return trFailed; +} + + +TestResult __cdecl tstScriptTest(BrowserInfo &cInfo) +{ + cInfo.nResult = trFailed; + + CTestScriptHelperInstance *pHelper = NULL; + CTestScriptHelperInstance::CreateInstance(&pHelper); + if (pHelper) + { + pHelper->m_pBrowserInfo = &cInfo; + + CActiveScriptSiteInstance *pSite = NULL; + CActiveScriptSiteInstance::CreateInstance(&pSite); + if (pSite) + { + // TODO read from registry + CString szScript; + szScript.Format(_T("Scripts\\%s"), cInfo.pTest->szName); + + pSite->AddRef(); + pSite->AttachVBScript(); + pSite->AddNamedObject(_T("BrowserInfo"), pHelper, TRUE); + pSite->ParseScriptFile(szScript); + pSite->PlayScript(); + pSite->Detach(); + pSite->Release(); + } + } + + return cInfo.nResult; +} + + +Test aScripts[] = +{ + { _T("Script test"), _T("Test that the scripting engine is sane"), tstScriptTest } +}; + + +void __cdecl ScriptSetPopulator(TestSet *pTestSet) +{ + // TODO read from registry + CString szTestDir(_T("Scripts")); + + CStringList cStringList; + CFileFind cFinder; + CString szPattern; + + + szPattern.Format(_T("%s\\*.vbs"), szTestDir); + BOOL bWorking = cFinder.FindFile(szPattern); + while (bWorking) + { + bWorking = cFinder.FindNextFile(); + cStringList.AddTail(cFinder.GetFileName()); + } + + szPattern.Format(_T("%s\\*.js"), szTestDir); + bWorking = cFinder.FindFile(szPattern); + while (bWorking) + { + bWorking = cFinder.FindNextFile(); + cStringList.AddTail(cFinder.GetFileName()); + } + + // Create a set of tests from the scripts found + Test *pTests = (Test *) malloc(sizeof(Test) * cStringList.GetCount()); + for (int i = 0; i < cStringList.GetCount(); i++) + { + CString szScript = cStringList.GetAt(cStringList.FindIndex(i)); + _tcscpy(pTests[i].szName, szScript); + _tcscpy(pTests[i].szDesc, _T("Run the specified script")); + pTests[i].pfn = tstScriptTest; + } + + pTestSet->nTests = cStringList.GetCount(); + pTestSet->aTests = pTests; +} + +/////////////////////////////////////////////////////////////////////////////// + +Test aBasic[] = +{ + { _T("Test Tester"), _T("Ensure that the testing architecture is working"), tstTesters, trNotRun }, + { _T("Control basics"), _T("Ensure that the browser control is active"), tstControlActive, trNotRun }, + { _T("IWebBrowser"), _T("Test if control has an IWebBrowser interface"), tstIWebBrowser, trNotRun }, + { _T("IWebBrowser2"), _T("Test if control has an IWebBrowser2 interface"), tstIWebBrowser2, trNotRun }, + { _T("IWebBrowserApp"), _T("Test if control has an IWebBrowserApp interface"), tstIWebBrowserApp, trNotRun } +}; + + +Test aBrowsing[] = +{ + { _T("IWebBrowser2::Navigate2"), _T("Test if browser can navigate to the test URL"), NULL } +}; + + +Test aDHTML[] = +{ + { _T("IWebBrowser::get_Document"), _T("Test if browser has a top level element"), tstDocument }, + { _T("IHTMLElementCollection::get__newEnum"), _T("Test if element collections return enumerations"), tstCollectionEnum }, + { _T("Parse DOM"), _T("Parse the document DOM"), tstDriller } +}; + + +Test aOther[] = +{ + { _T("Print Page"), _T("Print the test URL page"), NULL } +}; + + +TestSet aTestSets[] = +{ + { _T("Basic"), _T("Basic sanity tests"), 5, aBasic, NULL }, + { _T("Browsing"), _T("Browsing and navigation tests"), 1, aBrowsing , NULL}, + { _T("DHTML"), _T("Test the DOM"), 3, aDHTML, NULL }, + { _T("Other"), _T("Other tests"), 1, aOther, NULL }, + { _T("Scripts"), _T("Script tests"), 0, NULL, ScriptSetPopulator } +}; + + +int nTestSets = sizeof(aTestSets) / sizeof(aTestSets[0]); \ No newline at end of file diff --git a/mozilla/embedding/browser/activex/tests/cbrowse/Tests.h b/mozilla/embedding/browser/activex/tests/cbrowse/Tests.h new file mode 100644 index 00000000000..70f25e8a6a9 --- /dev/null +++ b/mozilla/embedding/browser/activex/tests/cbrowse/Tests.h @@ -0,0 +1,73 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + */ +#ifndef TESTS_H +#define TESTS_H + +#include "CBrowse_i.h" + +class CBrowseDlg; +struct Test; + +class BrowserInfo +{ +public: + Test *pTest; + TestResult nResult; + CBrowserCtlSiteInstance *pControlSite; + IUnknown *pIUnknown; + CLSID clsid; + CBrowseDlg *pBrowseDlg; + CString szTestURL; + CString szTestCGI; + + void OutputString(const TCHAR *szMessage, ...); + HRESULT GetWebBrowser(IWebBrowserApp **pWebBrowser); + HRESULT GetDocument(IHTMLDocument2 **pDocument); +}; + + +typedef TestResult (__cdecl *TestProc)(BrowserInfo &cInfo); + +struct Test +{ + TCHAR szName[256]; + TCHAR szDesc[256]; + TestProc pfn; + TestResult nLastResult; +}; + +struct TestSet; +typedef void (__cdecl *SetPopulatorProc)(TestSet *pTestSet); + +struct TestSet +{ + TCHAR *szName; + TCHAR *szDesc; + int nTests; + Test *aTests; + SetPopulatorProc pfnPopulator; +}; + +extern TestSet aTestSets[]; +extern int nTestSets; + +#endif \ No newline at end of file diff --git a/mozilla/embedding/browser/activex/tests/cbrowse/cbrowse.cpp b/mozilla/embedding/browser/activex/tests/cbrowse/cbrowse.cpp new file mode 100644 index 00000000000..33c506458e4 --- /dev/null +++ b/mozilla/embedding/browser/activex/tests/cbrowse/cbrowse.cpp @@ -0,0 +1,205 @@ +// cbrowse.cpp : Defines the class behaviors for the application. +// + +#include "stdafx.h" +#include "cbrowse.h" +#include "PickerDlg.h" +#include +#include "Cbrowse_i.c" +#include "TestScriptHelper.h" +#include "ControlEventSink.h" +#include "CBrowserCtlSite.h" + + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// CBrowseApp + +BEGIN_MESSAGE_MAP(CBrowseApp, CWinApp) + //{{AFX_MSG_MAP(CBrowseApp) + // NOTE - the ClassWizard will add and remove mapping macros here. + // DO NOT EDIT what you see in these blocks of generated code! + //}}AFX_MSG + ON_COMMAND(ID_HELP, CWinApp::OnHelp) +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// CBrowseApp construction + +CBrowseApp::CBrowseApp() +{ + // TODO: add construction code here, + // Place all significant initialization in InitInstance +} + +///////////////////////////////////////////////////////////////////////////// +// The one and only CBrowseApp object + +CBrowseApp theApp; + +///////////////////////////////////////////////////////////////////////////// +// CBrowseApp initialization + +BOOL CBrowseApp::InitInstance() +{ + // Initialize OLE libraries + if (!AfxOleInit()) + { + return FALSE; + } + if (!InitATL()) + return FALSE; + + AfxEnableControlContainer(); + _Module.RegisterClassObjects(CLSCTX_LOCAL_SERVER, + REGCLS_MULTIPLEUSE); + + + // Standard initialization + // If you are not using these features and wish to reduce the size + // of your final executable, you should remove from the following + // the specific initialization routines you do not need. + +#ifdef _AFXDLL + Enable3dControls(); // Call this when using MFC in a shared DLL +#else + Enable3dControlsStatic(); // Call this when linking to MFC statically +#endif + + int nResponse; + + CPickerDlg pickerDlg; + nResponse = pickerDlg.DoModal(); + if (nResponse != IDOK) + { + return FALSE; + } + + m_pDlg = new CBrowseDlg; + m_pDlg->m_clsid = pickerDlg.m_clsid; + m_pDlg->m_bUseCustomDropTarget = pickerDlg.m_bUseCustom; + m_pDlg->m_bUseCustomPopupMenu = pickerDlg.m_bUseCustom; + m_pDlg->Create(IDD_CBROWSE_DIALOG); + m_pMainWnd = m_pDlg; + + // Since the dialog has been closed, return FALSE so that we exit the + // application, rather than start the application's message pump. + return TRUE; +} + +CBrowseModule _Module; + +BEGIN_OBJECT_MAP(ObjectMap) + OBJECT_ENTRY(CLSID_TestScriptHelper, CTestScriptHelper) +// OBJECT_ENTRY(CLSID_ControlEventSink, CControlEventSink) +// OBJECT_ENTRY(CLSID_CBrowserCtlSite, CCBrowserCtlSite) +END_OBJECT_MAP() + +LONG CBrowseModule::Unlock() +{ + AfxOleUnlockApp(); + return 0; +} + +LONG CBrowseModule::Lock() +{ + AfxOleLockApp(); + return 1; +} + +LPCTSTR CBrowseModule::FindOneOf(LPCTSTR p1, LPCTSTR p2) +{ + while (*p1 != NULL) + { + LPCTSTR p = p2; + while (*p != NULL) + { + if (*p1 == *p) + return CharNext(p1); + p = CharNext(p); + } + p1++; + } + return NULL; +} + + +int CBrowseApp::ExitInstance() +{ + if (m_bATLInited) + { + _Module.RevokeClassObjects(); + _Module.Term(); + CoUninitialize(); + } + return CWinApp::ExitInstance(); +} + + +BOOL CBrowseApp::InitATL() +{ + m_bATLInited = TRUE; + +#if _WIN32_WINNT >= 0x0400 + HRESULT hRes = CoInitializeEx(NULL, COINIT_MULTITHREADED); +#else + HRESULT hRes = CoInitialize(NULL); +#endif + + if (FAILED(hRes)) + { + m_bATLInited = FALSE; + return FALSE; + } + + _Module.Init(ObjectMap, AfxGetInstanceHandle()); + _Module.dwThreadID = GetCurrentThreadId(); + + LPTSTR lpCmdLine = GetCommandLine(); //this line necessary for _ATL_MIN_CRT + TCHAR szTokens[] = _T("-/"); + + BOOL bRun = TRUE; + LPCTSTR lpszToken = _Module.FindOneOf(lpCmdLine, szTokens); + while (lpszToken != NULL) + { + if (lstrcmpi(lpszToken, _T("UnregServer"))==0) + { + _Module.UpdateRegistryFromResource(IDR_CBROWSE, FALSE); + _Module.UnregisterServer(TRUE); //TRUE means typelib is unreg'd + bRun = FALSE; + break; + } + if (lstrcmpi(lpszToken, _T("RegServer"))==0) + { + _Module.UpdateRegistryFromResource(IDR_CBROWSE, TRUE); + _Module.RegisterServer(TRUE); + bRun = FALSE; + break; + } + lpszToken = _Module.FindOneOf(lpszToken, szTokens); + } + + if (!bRun) + { + m_bATLInited = FALSE; + _Module.Term(); + CoUninitialize(); + return FALSE; + } + + hRes = _Module.RegisterClassObjects(CLSCTX_LOCAL_SERVER, + REGCLS_MULTIPLEUSE); + if (FAILED(hRes)) + { + m_bATLInited = FALSE; + CoUninitialize(); + return FALSE; + } + + return TRUE; +} diff --git a/mozilla/embedding/browser/activex/tests/cbrowse/cbrowse.dsp b/mozilla/embedding/browser/activex/tests/cbrowse/cbrowse.dsp new file mode 100644 index 00000000000..6e58636953a --- /dev/null +++ b/mozilla/embedding/browser/activex/tests/cbrowse/cbrowse.dsp @@ -0,0 +1,327 @@ +# Microsoft Developer Studio Project File - Name="cbrowse" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Application" 0x0101 + +CFG=cbrowse - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "cbrowse.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "cbrowse.mak" CFG="cbrowse - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "cbrowse - Win32 Release" (based on "Win32 (x86) Application") +!MESSAGE "cbrowse - Win32 Debug" (based on "Win32 (x86) Application") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "cbrowse - Win32 Release" + +# PROP BASE Use_MFC 6 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 6 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /Yu"stdafx.h" /FD /c +# ADD CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /Yu"stdafx.h" /FD /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 +# ADD MTL /nologo /D "NDEBUG" /o "NUL" /win32 +# ADD BASE RSC /l 0x409 /d "NDEBUG" /d "_AFXDLL" +# ADD RSC /l 0x409 /d "NDEBUG" /d "_AFXDLL" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 /nologo /subsystem:windows /machine:I386 +# ADD LINK32 /nologo /subsystem:windows /machine:I386 + +!ELSEIF "$(CFG)" == "cbrowse - Win32 Debug" + +# PROP BASE Use_MFC 6 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 6 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /Yu"stdafx.h" /FD /c +# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /FR /Yu"stdafx.h" /FD /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 +# ADD MTL /nologo /D "_DEBUG" /o "NUL" /win32 +# ADD BASE RSC /l 0x409 /d "_DEBUG" /d "_AFXDLL" +# ADD RSC /l 0x409 /d "_DEBUG" /d "_AFXDLL" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept +# ADD LINK32 /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept + +!ENDIF + +# Begin Target + +# Name "cbrowse - Win32 Release" +# Name "cbrowse - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=..\..\ActiveScriptSite.cpp +# End Source File +# Begin Source File + +SOURCE=.\cbrowse.cpp +# End Source File +# Begin Source File + +SOURCE=.\Cbrowse.idl +# ADD MTL /h "Cbrowse_i.h" /iid "Cbrowse_i.c" /Oicf +# End Source File +# Begin Source File + +SOURCE=.\cbrowse.rc +# End Source File +# Begin Source File + +SOURCE=.\CBrowseDlg.cpp +# End Source File +# Begin Source File + +SOURCE=.\CBrowserCtlSite.cpp +# End Source File +# Begin Source File + +SOURCE=.\ControlEventSink.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\ControlSite.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\ControlSiteIPFrame.cpp +# End Source File +# Begin Source File + +SOURCE=.\EditToolBar.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\MozActiveX.java +# End Source File +# Begin Source File + +SOURCE=.\PickerDlg.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\PropertyBag.cpp +# End Source File +# Begin Source File + +SOURCE=.\StdAfx.cpp +# ADD CPP /Yc"stdafx.h" +# End Source File +# Begin Source File + +SOURCE=.\TabDOM.cpp +# End Source File +# Begin Source File + +SOURCE=.\TabMessages.cpp +# End Source File +# Begin Source File + +SOURCE=.\TabTests.cpp +# End Source File +# Begin Source File + +SOURCE=.\Tests.cpp +# End Source File +# Begin Source File + +SOURCE=.\TestScriptHelper.cpp +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=..\..\ActiveScriptSite.h +# End Source File +# Begin Source File + +SOURCE=.\cbrowse.h +# End Source File +# Begin Source File + +SOURCE=.\Cbrowse_i.h +# End Source File +# Begin Source File + +SOURCE=.\CBrowseDlg.h +# End Source File +# Begin Source File + +SOURCE=.\CBrowserCtlSite.h +# End Source File +# Begin Source File + +SOURCE=.\ControlEventSink.h +# End Source File +# Begin Source File + +SOURCE=..\..\ControlSite.h +# End Source File +# Begin Source File + +SOURCE=..\..\ControlSiteIPFrame.h +# End Source File +# Begin Source File + +SOURCE=.\EditToolBar.h +# End Source File +# Begin Source File + +SOURCE=.\PickerDlg.h +# End Source File +# Begin Source File + +SOURCE=.\Resource.h +# End Source File +# Begin Source File + +SOURCE=.\StdAfx.h +# End Source File +# Begin Source File + +SOURCE=.\TabDOM.h +# End Source File +# Begin Source File + +SOURCE=.\TabMessages.h +# End Source File +# Begin Source File + +SOURCE=.\TabTests.h +# End Source File +# Begin Source File + +SOURCE=.\Tests.h +# End Source File +# Begin Source File + +SOURCE=.\TestScriptHelper.h +# End Source File +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe" +# Begin Source File + +SOURCE=.\res\cbrowse.ico +# End Source File +# Begin Source File + +SOURCE=.\res\cbrowse.rc2 +# End Source File +# Begin Source File + +SOURCE=.\res\closedfolder.ico +# End Source File +# Begin Source File + +SOURCE=.\res\openfold.ico +# End Source File +# Begin Source File + +SOURCE=.\res\openfolder.ico +# End Source File +# Begin Source File + +SOURCE=.\res\test.ico +# End Source File +# Begin Source File + +SOURCE=.\res\testfailed.ico +# End Source File +# Begin Source File + +SOURCE=.\res\testpartial.ico +# End Source File +# Begin Source File + +SOURCE=.\res\testpassed.ico +# End Source File +# Begin Source File + +SOURCE=.\res\toolbar1.bmp +# End Source File +# End Group +# Begin Group "Scripts" + +# PROP Default_Filter "js;vbs" +# Begin Source File + +SOURCE=.\Scripts\Basic.vbs +# End Source File +# Begin Source File + +SOURCE=.\Scripts\NewWindow.vbs +# End Source File +# Begin Source File + +SOURCE=.\Scripts\Post.vbs +# End Source File +# End Group +# Begin Source File + +SOURCE=.\Cbrowse.rgs +# End Source File +# Begin Source File + +SOURCE=.\CBrowserCtlSite.rgs +# End Source File +# Begin Source File + +SOURCE=.\ControlEventSink.rgs +# End Source File +# Begin Source File + +SOURCE=.\ReadMe.txt +# End Source File +# Begin Source File + +SOURCE=.\TestScriptHelper.rgs +# End Source File +# End Target +# End Project +# Section cbrowse : {10404710-0021-001E-1B00-1B00EAA80000} +# 1:11:IDR_CBROWSE:103 +# End Section diff --git a/mozilla/embedding/browser/activex/tests/cbrowse/cbrowse.h b/mozilla/embedding/browser/activex/tests/cbrowse/cbrowse.h new file mode 100644 index 00000000000..5d35b27c553 --- /dev/null +++ b/mozilla/embedding/browser/activex/tests/cbrowse/cbrowse.h @@ -0,0 +1,59 @@ +// cbrowse.h : main header file for the CBROWSE application +// + +#if !defined(AFX_CBROWSE_H__5121F5E4_5324_11D2_93E1_000000000000__INCLUDED_) +#define AFX_CBROWSE_H__5121F5E4_5324_11D2_93E1_000000000000__INCLUDED_ + +#if _MSC_VER >= 1000 +#pragma once +#endif // _MSC_VER >= 1000 + +#ifndef __AFXWIN_H__ + #error include 'stdafx.h' before including this file for PCH +#endif + +#include "resource.h" // main symbols +#include "Cbrowse_i.h" +#include "CBrowseDlg.h" + +///////////////////////////////////////////////////////////////////////////// +// CBrowseApp: +// See cbrowse.cpp for the implementation of this class +// + +class CBrowseApp : public CWinApp +{ +public: + CBrowseApp(); + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CBrowseApp) + public: + virtual BOOL InitInstance(); + virtual int ExitInstance(); + //}}AFX_VIRTUAL + +// Implementation + + //{{AFX_MSG(CBrowseApp) + // NOTE - the ClassWizard will add and remove member functions here. + // DO NOT EDIT what you see in these blocks of generated code ! + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +private: + + CBrowseDlg *m_pDlg; + BOOL m_bATLInited; +private: + BOOL InitATL(); + +}; + + +///////////////////////////////////////////////////////////////////////////// + +//{{AFX_INSERT_LOCATION}} +// Microsoft Developer Studio will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_CBROWSE_H__5121F5E4_5324_11D2_93E1_000000000000__INCLUDED_) diff --git a/mozilla/embedding/browser/activex/tests/cbrowse/cbrowse.rc b/mozilla/embedding/browser/activex/tests/cbrowse/cbrowse.rc new file mode 100644 index 00000000000..9b7fbadefca --- /dev/null +++ b/mozilla/embedding/browser/activex/tests/cbrowse/cbrowse.rc @@ -0,0 +1,450 @@ +//Microsoft Developer Studio generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "afxres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// Neutral resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEU) +#ifdef _WIN32 +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +#pragma code_page(1252) +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDI_CLOSEDFOLDER ICON DISCARDABLE "res\\closedfolder.ico" +IDI_OPENFOLDER ICON DISCARDABLE "res\\openfolder.ico" +IDI_TESTPASSED ICON DISCARDABLE "res\\testpassed.ico" +IDI_TESTFAILED ICON DISCARDABLE "res\\testfailed.ico" +IDI_TESTPARTIAL ICON DISCARDABLE "res\\testpartial.ico" +#endif // Neutral resources +///////////////////////////////////////////////////////////////////////////// + + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDR_MAINFRAME ICON DISCARDABLE "res\\cbrowse.ico" + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE DISCARDABLE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE DISCARDABLE +BEGIN + "#include ""afxres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE DISCARDABLE +BEGIN + "#define _AFX_NO_SPLITTER_RESOURCES\r\n" + "#define _AFX_NO_OLE_RESOURCES\r\n" + "#define _AFX_NO_TRACKER_RESOURCES\r\n" + "#define _AFX_NO_PROPERTY_RESOURCES\r\n" + "\r\n" + "#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n" + "#ifdef _WIN32\r\n" + "LANGUAGE 9, 1\r\n" + "#pragma code_page(1252)\r\n" + "#endif\r\n" + "#include ""res\\cbrowse.rc2"" // non-Microsoft Visual C++ edited resources\r\n" + "#include ""afxres.rc"" // Standard components\r\n" + "#endif\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_CBROWSE_DIALOG DIALOGEX 0, 0, 293, 320 +STYLE WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME +EXSTYLE WS_EX_APPWINDOW +CAPTION "CBrowse" +FONT 8, "MS Sans Serif", 0, 0, 0x1 +BEGIN + CONTROL "",IDC_TAB_MARKER,"Static",SS_BLACKFRAME,7,223,279,89 + RTEXT "&URL:",IDC_STATIC,7,13,18,8 + DEFPUSHBUTTON "&Go",IDC_GO,135,11,25,13 + CONTROL "",IDC_BROWSER_MARKER,"Static",SS_BLACKFRAME,7,48,279, + 168 + COMBOBOX IDC_URL,27,11,106,52,CBS_DROPDOWN | CBS_AUTOHSCROLL | + WS_VSCROLL | WS_TABSTOP + PUSHBUTTON "<",IDC_BACKWARD,163,11,14,13 + PUSHBUTTON ">",IDC_FORWARD,179,11,14,13 + CONTROL "&New window",IDC_NEWWINDOW,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,200,7,53,10 + CONTROL "&Edit mode",IDC_EDITMODE,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,200,17,47,10 + CONTROL "",IDC_EDITBAR_MARKER,"Static",SS_BLACKFRAME,7,28,279,19 +END + + +#ifndef _MAC +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,0,0,1 + PRODUCTVERSION 1,0,0,1 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x4L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904B0" + BEGIN + VALUE "CompanyName", "\0" + VALUE "FileDescription", "cbrowse MFC Application\0" + VALUE "FileVersion", "1, 0, 0, 1\0" + VALUE "InternalName", "cbrowse\0" + VALUE "LegalCopyright", "Copyright (C) 1998\0" + VALUE "LegalTrademarks", "\0" + VALUE "OriginalFilename", "cbrowse.EXE\0" + VALUE "ProductName", "cbrowse Application\0" + VALUE "ProductVersion", "1, 0, 0, 1\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + +#endif // !_MAC + + +///////////////////////////////////////////////////////////////////////////// +// +// DESIGNINFO +// + +#ifdef APSTUDIO_INVOKED +GUIDELINES DESIGNINFO DISCARDABLE +BEGIN + IDD_CBROWSE_DIALOG, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 286 + TOPMARGIN, 7 + BOTTOMMARGIN, 312 + HORZGUIDE, 216 + END +END +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// REGISTRY +// + +IDR_CBROWSE REGISTRY DISCARDABLE "Cbrowse.rgs" +IDR_TESTSCRIPTHELPER REGISTRY DISCARDABLE "TestScriptHelper.rgs" +IDR_CONTROLEVENTSINK REGISTRY DISCARDABLE "ControlEventSink.rgs" + +///////////////////////////////////////////////////////////////////////////// +// +// Menu +// + +IDR_MAIN MENU DISCARDABLE +BEGIN + POPUP "&File" + BEGIN + MENUITEM "E&xit", ID_FILE_EXIT + END + POPUP "&Edit" + BEGIN + MENUITEM "Cu&t", ID_EDIT_CUT + MENUITEM "&Copy", ID_EDIT_COPY + MENUITEM "&Paste", ID_EDIT_PASTE + MENUITEM SEPARATOR + MENUITEM "Select &All", ID_EDIT_SELECTALL + END + POPUP "&View" + BEGIN + POPUP "&Go To" + BEGIN + MENUITEM "&Back", ID_VIEW_GOTO_BACK + MENUITEM "&Forward", ID_VIEW_GOTO_FORWARD + MENUITEM SEPARATOR + MENUITEM "&Home Page", ID_VIEW_GOTO_HOME + END + MENUITEM "&Stop", ID_VIEW_STOP + MENUITEM "&Refresh", ID_VIEW_REFRESH + MENUITEM SEPARATOR + MENUITEM "Sour&ce", ID_VIEW_VIEWSOURCE + END + POPUP "&Help" + BEGIN + MENUITEM "&About...", ID_HELP_ABOUT + END +END + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + +///////////////////////////////////////////////////////////////////////////// +// English (U.K.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENG) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK +#pragma code_page(1252) +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDI_TEST ICON DISCARDABLE "res\\test.ico" + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_PICKBROWSER DIALOG DISCARDABLE 0, 0, 284, 232 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Welcome to CBrowse!" +FONT 8, "MS Sans Serif" +BEGIN + LTEXT "This is a browser/test application written in MFC that exercises the IE browser interface of the control that you choose from the list below.", + IDC_STATIC,7,7,213,27 + LTEXT "Whatever control you choose, the exact same code is run upon it. Discrepancies in behaviour or test results may indicate a bug!", + IDC_STATIC,7,33,213,20 + LTEXT "Pick the browser to test:",IDC_STATIC,7,56,77,8 + LISTBOX IDC_LISTBROWSER,7,65,213,50,LBS_NOINTEGRALHEIGHT | + WS_VSCROLL | WS_TABSTOP + LTEXT "Some of the tests require a test URL. You may change the default one if you want. Ensure that the URL is valid otherwise the tests might fail!", + IDC_STATIC,7,120,213,18 + EDITTEXT IDC_TESTURL,7,138,213,13,ES_AUTOHSCROLL + LTEXT "Some tests also need a CGI URL, enter that here:", + IDC_STATIC,7,157,157,8 + EDITTEXT IDC_TESTCGI,7,167,213,13,ES_AUTOHSCROLL + CONTROL "Override default drop target and popup menus", + IDC_OVERRIDE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,185, + 207,10 + CONTROL "Turn on Mozilla debugging (creates a mozilla.log file)", + IDC_CHECK1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,197, + 172,10 + EDITTEXT IDC_EDIT1,7,210,213,14,ES_AUTOHSCROLL + DEFPUSHBUTTON "OK",IDOK,227,7,50,14 + PUSHBUTTON "Cancel",IDCANCEL,227,24,50,14 +END + +IDD_TAB_MESSAGES DIALOG DISCARDABLE 0, 0, 275, 75 +STYLE WS_CHILD | WS_VISIBLE +FONT 8, "MS Sans Serif" +BEGIN + LISTBOX IDC_OUTPUT,5,5,265,50,LBS_NOINTEGRALHEIGHT | WS_VSCROLL | + WS_TABSTOP + LTEXT "Static",IDC_STATUS,5,59,197,11,SS_SUNKEN + CONTROL "Progress1",IDC_PROGRESS,"msctls_progress32",WS_BORDER, + 205,59,65,11 +END + +IDD_TAB_TESTS DIALOG DISCARDABLE 0, 0, 275, 75 +STYLE WS_CHILD | WS_VISIBLE +FONT 8, "MS Sans Serif" +BEGIN + PUSHBUTTON "Run",IDC_RUNTEST,212,56,50,14,WS_DISABLED + CONTROL "Tree1",IDC_TESTLIST,"SysTreeView32",TVS_HASBUTTONS | + TVS_HASLINES | TVS_LINESATROOT | TVS_SHOWSELALWAYS | + TVS_TRACKSELECT | WS_BORDER | WS_TABSTOP,5,5,196,65 + GROUPBOX "Test Description",IDC_STATIC,203,5,66,47 + LTEXT "",IDC_TESTDESCRIPTION,208,15,56,32 +END + +IDD_TAB_DOM DIALOG DISCARDABLE 0, 0, 275, 80 +STYLE WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN +FONT 8, "MS Sans Serif" +BEGIN + CONTROL "Tree1",IDC_DOMLIST,"SysTreeView32",TVS_HASBUTTONS | + TVS_HASLINES | TVS_LINESATROOT | TVS_SHOWSELALWAYS | + TVS_TRACKSELECT | WS_BORDER | WS_TABSTOP,5,5,212,70 + PUSHBUTTON "Refresh",IDC_REFRESHDOM,220,5,50,14 +END + + +///////////////////////////////////////////////////////////////////////////// +// +// DESIGNINFO +// + +#ifdef APSTUDIO_INVOKED +GUIDELINES DESIGNINFO DISCARDABLE +BEGIN + IDD_PICKBROWSER, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 277 + TOPMARGIN, 7 + BOTTOMMARGIN, 225 + END + + IDD_TAB_MESSAGES, DIALOG + BEGIN + LEFTMARGIN, 5 + RIGHTMARGIN, 270 + TOPMARGIN, 5 + BOTTOMMARGIN, 70 + END + + IDD_TAB_TESTS, DIALOG + BEGIN + LEFTMARGIN, 5 + RIGHTMARGIN, 270 + TOPMARGIN, 5 + BOTTOMMARGIN, 70 + END + + IDD_TAB_DOM, DIALOG + BEGIN + LEFTMARGIN, 5 + RIGHTMARGIN, 270 + TOPMARGIN, 5 + BOTTOMMARGIN, 75 + END +END +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// REGISTRY +// + +IDR_CBROWSERCTLSITE REGISTRY DISCARDABLE "CBrowserCtlSite.rgs" + +///////////////////////////////////////////////////////////////////////////// +// +// Toolbar +// + +IDR_DHTMLEDIT TOOLBAR DISCARDABLE 16, 15 +BEGIN + BUTTON IDB_BOLD + BUTTON IDB_ITALIC + BUTTON IDB_UNDERLINE + SEPARATOR + BUTTON IDB_H1 + BUTTON IDB_H2 + BUTTON IDB_PARAGRAPH + SEPARATOR + BUTTON ID_ORDEREDLIST + BUTTON IDB_UNORDEREDLIST +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Bitmap +// + +IDR_DHTMLEDIT BITMAP DISCARDABLE "res\\toolbar1.bmp" + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE DISCARDABLE +BEGIN + IDS_CHOOSEBROWSER "You must choose a browser control from the list to proceed." +END + +STRINGTABLE DISCARDABLE +BEGIN + IDD_TAB_MESSAGES "Messages" + IDD_TAB_TESTS "Tests" + IDD_TAB_DOM "DOM" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDB_BOLD "Bold" + IDB_ITALIC "Italic" + IDB_UNDERLINE "Underline" +END + +#endif // English (U.K.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// +#define _AFX_NO_SPLITTER_RESOURCES +#define _AFX_NO_OLE_RESOURCES +#define _AFX_NO_TRACKER_RESOURCES +#define _AFX_NO_PROPERTY_RESOURCES + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE 9, 1 +#pragma code_page(1252) +#endif +#include "res\cbrowse.rc2" // non-Microsoft Visual C++ edited resources +#include "afxres.rc" // Standard components +#endif +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/mozilla/embedding/browser/activex/tests/cbrowse/res/cbrowse.ico b/mozilla/embedding/browser/activex/tests/cbrowse/res/cbrowse.ico new file mode 100644 index 0000000000000000000000000000000000000000..7eef0bcbe6580a6f464d688906172c2d9de44262 GIT binary patch literal 1078 zcmc&zF>b>!3}jLb9s)T}@Kod(893@u8ajANzT`op9^o+)S?=nU(FD@%0s)Sg^oyC8{H z9myetc;MEP)59v(LMa~xK8Yu^jIR*H22uCFiq5%C{s7(PJi>o15i^bmX4(vPxWAio z9ryY#AU_jfnd047-@`)XzL?%iS$gQyFP{44kS9X)fN{{QoL~hO-&=q&20Zr*cxFAt PkaNE{wR~2C$NfnjhSXWT literal 0 HcmV?d00001 diff --git a/mozilla/embedding/browser/activex/tests/cbrowse/res/cbrowse.rc2 b/mozilla/embedding/browser/activex/tests/cbrowse/res/cbrowse.rc2 new file mode 100644 index 00000000000..0cbf00b0037 --- /dev/null +++ b/mozilla/embedding/browser/activex/tests/cbrowse/res/cbrowse.rc2 @@ -0,0 +1,13 @@ +// +// CBROWSE.RC2 - resources Microsoft Visual C++ does not edit directly +// + +#ifdef APSTUDIO_INVOKED + #error this file is not editable by Microsoft Visual C++ +#endif //APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// Add manually edited resources here... + +///////////////////////////////////////////////////////////////////////////// diff --git a/mozilla/embedding/browser/activex/tests/cbrowse/res/closedfolder.ico b/mozilla/embedding/browser/activex/tests/cbrowse/res/closedfolder.ico new file mode 100644 index 0000000000000000000000000000000000000000..387080ef43b64d5dfd834aa2cb1c487d459f5230 GIT binary patch literal 318 zcma)&F%m*C2t;3IEK;Vjw)Bp_kTNqKNK205Ei5eZcaz3KM;BNKOn?N6q_u`|E^xG$ zIdhT~4r0j3pC~{|#BySVWTw0eV=7}fl1ZF0eL?LLQD2)8^?5V?KdZSARhRC)2Uj)m WEH!=~x%OCZbN#33fARv4xj*bZ8&yI8 literal 0 HcmV?d00001 diff --git a/mozilla/embedding/browser/activex/tests/cbrowse/res/openfolder.ico b/mozilla/embedding/browser/activex/tests/cbrowse/res/openfolder.ico new file mode 100644 index 0000000000000000000000000000000000000000..ccd80d5c174d11ba797d6fbab102e1c9bad09219 GIT binary patch literal 318 zcmZ`#F%AMT409!hj-8kpdEV_ekc~pz1kSRZT;Ca&rbNYR-QwnyK=4jE5|#47mL2pn8iJeCdmKs3+Lngz!!$IRdxUX literal 0 HcmV?d00001 diff --git a/mozilla/embedding/browser/activex/tests/cbrowse/res/test.ico b/mozilla/embedding/browser/activex/tests/cbrowse/res/test.ico new file mode 100644 index 0000000000000000000000000000000000000000..abc72557732da419e29a3ddf5da3eba5cc942553 GIT binary patch literal 318 zcma)1F%pCz3|!`%Il7~=w!G(EryX>r^Gp0nyWFlwXJL}vB_Tin0zIV!**5^Alu%_N z0tPZrPrjo9Fi=VpGMA{eQnle{z+EeXu9E1o*fra-+Jfk_3^9A&oq5+Mb+gvL9qpd& b$9&%N3Phuo{;Fo+*!=Tjyx99DKJDxuEkIFl literal 0 HcmV?d00001 diff --git a/mozilla/embedding/browser/activex/tests/cbrowse/res/testfailed.ico b/mozilla/embedding/browser/activex/tests/cbrowse/res/testfailed.ico new file mode 100644 index 0000000000000000000000000000000000000000..9e64c59c106ef590184be9bdffba3f1116e903ed GIT binary patch literal 318 zcma)1F%pCz3|!`%k?yc@q`T5*Vi!w0`3*nAT{$`nlk6@D0RrIYAq2=)2h37Jl^@|S zkb!dZ6D5Fwl$wyaL@9-;jd}-a)rz32B>J208g1EZfzOi+KIV92=3U>^&07C{wtM!# ad^+L=c%!BMs%GHW{PSyk*gF#6cJ=~=XE<&E literal 0 HcmV?d00001 diff --git a/mozilla/embedding/browser/activex/tests/cbrowse/res/testpartial.ico b/mozilla/embedding/browser/activex/tests/cbrowse/res/testpartial.ico new file mode 100644 index 0000000000000000000000000000000000000000..3cf170115af307a157bdb8abe0a2f156c3b75410 GIT binary patch literal 318 zcma)1F%HBa3^Te)Wjm&uJ9a#&OC>&s)Fo1%)1?v%KcjXzwi}wnHVFX&;OHR)$Yuw8 zq=YIH;V_Vaa`Qh*00SvCA#;gR3RN5R4%Dg@L03uiGv77Zy4eb!7a4ra@yN`(KB=3v g{{3wC>|f@~5jVgaE%jG51IOl{ALGT|k$AVW7rj+L!~g&Q literal 0 HcmV?d00001 diff --git a/mozilla/embedding/browser/activex/tests/cbrowse/res/testpassed.ico b/mozilla/embedding/browser/activex/tests/cbrowse/res/testpassed.ico new file mode 100644 index 0000000000000000000000000000000000000000..410d03ffb4b176ad55ba6c6e61bb6128083c2489 GIT binary patch literal 318 zcma)1F%HBa3^VFU$5y7Bt4@elqE1nt(W&AU{EV|p**Y|dZ4v?mz|lhpkVOalq=YI9 z;qV~?_2MVW00TL9A#;gZD^(lq3bdvbL03t1n;)7iZWiIoDuYiY9fkSOH+8e#zn}e{ cePO;HX#>2`@_1DrJ|DhzL!)>?yxVUzwgO|)?EqYGDA3gVEZ_jk|imRNo?9mcVy;3~RV zRZ4+|l`WaYe up9bHk`fu)^gF#$5|9JI)!pe+j5o7+bf4IZuH=#7&6f3S}y}xzNKRs`AMts`< literal 0 HcmV?d00001 diff --git a/mozilla/embedding/browser/activex/tests/cbrowse/resource.h b/mozilla/embedding/browser/activex/tests/cbrowse/resource.h new file mode 100644 index 00000000000..cffde5ba3ff --- /dev/null +++ b/mozilla/embedding/browser/activex/tests/cbrowse/resource.h @@ -0,0 +1,75 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Developer Studio generated include file. +// Used by cbrowse.rc +// +#define IDS_CHOOSEBROWSER 1 +#define IDD_CBROWSE_DIALOG 102 +#define IDR_CBROWSE 103 +#define IDR_TESTSCRIPTHELPER 104 +#define IDR_CONTROLEVENTSINK 105 +#define IDR_CBROWSERCTLSITE 106 +#define IDR_MAINFRAME 128 +#define IDD_PICKBROWSER 129 +#define IDI_CLOSEDFOLDER 130 +#define IDI_OPENFOLDER 131 +#define IDI_TEST 132 +#define IDI_TESTPASSED 133 +#define IDI_TESTFAILED 134 +#define IDD_TAB_MESSAGES 135 +#define IDD_TAB_TESTS 136 +#define IDD_TAB_DOM 137 +#define IDR_DHTMLEDIT 138 +#define IDI_TESTPARTIAL 140 +#define IDR_MAIN 141 +#define IDC_URL 1000 +#define IDC_GO 1001 +#define IDC_BROWSER_MARKER 1002 +#define IDC_LISTBROWSER 1003 +#define IDC_RUNTEST 1004 +#define IDC_LISTMESSAGES 1005 +#define IDC_TESTLIST 1006 +#define IDC_BACKWARD 1008 +#define IDC_FORWARD 1009 +#define IDC_TESTDESCRIPTION 1010 +#define IDC_TESTURL 1011 +#define IDC_DOMLIST 1012 +#define IDC_TESTCGI 1012 +#define IDC_REFRESHDOM 1013 +#define IDC_NEWWINDOW 1014 +#define IDC_OUTPUT 1016 +#define IDC_TAB_MARKER 1017 +#define IDC_STATUS 1019 +#define IDC_PROGRESS 1020 +#define IDC_CHECK1 1021 +#define IDC_EDIT1 1022 +#define IDC_EDITMODE 1023 +#define IDC_EDITBAR_MARKER 1025 +#define IDC_OVERRIDE 1026 +#define IDB_BOLD 32771 +#define IDB_ITALIC 32772 +#define IDB_UNDERLINE 32773 +#define IDB_H1 32774 +#define IDB_H2 32775 +#define IDB_PARAGRAPH 32776 +#define ID_ORDEREDLIST 32777 +#define IDB_UNORDEREDLIST 32778 +#define ID_FILE_EXIT 32779 +#define ID_VIEW_VIEWSOURCE 32783 +#define ID_HELP_ABOUT 32784 +#define ID_VIEW_GOTO_BACK 32786 +#define ID_VIEW_GOTO_FORWARD 32787 +#define ID_VIEW_STOP 32788 +#define ID_VIEW_GOTO_HOME 32789 +#define ID_EDIT_SELECTALL 32790 +#define ID_VIEW_REFRESH 32791 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 142 +#define _APS_NEXT_COMMAND_VALUE 32792 +#define _APS_NEXT_CONTROL_VALUE 1027 +#define _APS_NEXT_SYMED_VALUE 107 +#endif +#endif diff --git a/mozilla/embedding/browser/activex/tests/vbrowse/VBrowse.vbp b/mozilla/embedding/browser/activex/tests/vbrowse/VBrowse.vbp new file mode 100644 index 00000000000..ab1a1b48da6 --- /dev/null +++ b/mozilla/embedding/browser/activex/tests/vbrowse/VBrowse.vbp @@ -0,0 +1,37 @@ +Type=Exe +Form=browser.frm +Reference=*\G{00020430-0000-0000-C000-000000000046}#2.0#0#C:\WINNT40\System32\stdole2.tlb#OLE Automation +Object={1339B53E-3453-11D2-93B9-000000000000}#1.0#0; MozillaControl.dll +Object={F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0; COMDLG32.OCX +Object={FE0065C0-1B7B-11CF-9D53-00AA003C9CB6}#1.0#0; comct232.ocx +Object={6B7E6392-850A-101B-AFC0-4210102A8DA7}#1.2#0; comctl32.ocx +Form=frmToolBar.frm +Object={EAB22AC0-30C1-11CF-A7EB-0000C05BAE0B}#1.1#0; SHDOCVW.DLL +Form=frmExplorer.frm +IconForm="frmMozilla" +Startup="frmToolBar" +HelpFile="" +ExeName32="VBrowse.exe" +Command32="" +Name="Project1" +HelpContextID="0" +CompatibleMode="0" +MajorVer=1 +MinorVer=0 +RevisionVer=0 +AutoIncrementVer=0 +ServerSupportFiles=0 +CompilationType=0 +OptimizationType=0 +FavorPentiumPro(tm)=0 +CodeViewDebugInfo=0 +NoAliasing=0 +BoundsCheck=0 +OverflowCheck=0 +FlPointCheck=0 +FDIVCheck=0 +UnroundedFP=0 +StartMode=0 +Unattended=0 +ThreadPerObject=0 +MaxNumberOfThreads=1 diff --git a/mozilla/embedding/browser/activex/tests/vbrowse/browser.frm b/mozilla/embedding/browser/activex/tests/vbrowse/browser.frm new file mode 100644 index 00000000000..51f521bd885 --- /dev/null +++ b/mozilla/embedding/browser/activex/tests/vbrowse/browser.frm @@ -0,0 +1,54 @@ +VERSION 5.00 +Object = "{1339B53E-3453-11D2-93B9-000000000000}#1.0#0"; "MozillaControl.dll" +Begin VB.Form frmMozilla + Caption = "Mozilla Control" + ClientHeight = 5880 + ClientLeft = 60 + ClientTop = 345 + ClientWidth = 7710 + LinkTopic = "Form1" + ScaleHeight = 392 + ScaleMode = 3 'Pixel + ScaleWidth = 514 + Begin MOZILLACONTROLLibCtl.MozillaBrowser Browser1 + Height = 5535 + Left = 0 + OleObjectBlob = "browser.frx":0000 + TabIndex = 0 + Top = 0 + Width = 7695 + End +End +Attribute VB_Name = "frmMozilla" +Attribute VB_GlobalNameSpace = False +Attribute VB_Creatable = False +Attribute VB_PredeclaredId = True +Attribute VB_Exposed = False +Private Sub Browser1_BeforeNavigate(ByVal URL As String, ByVal Flags As Long, ByVal TargetFrameName As String, PostData As Variant, ByVal Headers As String, Cancel As Boolean) + frmToolBar.Browser_BeforeNavigate URL, Flags, TargetFrameName, PostData, Headers, Cancel +End Sub + +Private Sub Browser1_NavigateComplete(ByVal URL As String) + frmToolBar.Browser_NavigateComplete URL +End Sub + +Private Sub Browser1_BeforeNavigate2(ByVal pDisp As Object, URL As Variant, Flags As Variant, TargetFrameName As Variant, PostData As Variant, Headers As Variant, Cancel As Boolean) + frmToolBar.Browser_BeforeNavigate2 pDisp, URL, Flags, TargetFrameName, PostData, Headers, Cancel +End Sub + +Private Sub Browser1_NavigateComplete2(ByVal pDisp As Object, URL As Variant) + frmToolBar.Browser_NavigateComplete2 pDisp, URL +End Sub + +Private Sub Browser1_ProgressChange(ByVal Progress As Long, ByVal ProgressMax As Long) + frmToolBar.Browser_ProgressChange Progress, ProgressMax +End Sub + +Private Sub Browser1_StatusTextChange(ByVal Text As String) + frmToolBar.Browser_StatusTextChange Text +End Sub + +Private Sub Form_Resize() + Browser1.Width = ScaleWidth + Browser1.Height = ScaleHeight +End Sub diff --git a/mozilla/embedding/browser/activex/tests/vbrowse/browser.frx b/mozilla/embedding/browser/activex/tests/vbrowse/browser.frx new file mode 100644 index 0000000000000000000000000000000000000000..9ae0f67293c6eb228f2d9e0cfdd56b3179118a53 GIT binary patch literal 36 icmeZq;$+}qKmdL@28Q{f3=B+63=FKM3=GO@3=9A# 0 Then +' fProgress = (Progress * 100) / ProgressMax + Else + ' fProgress = 0# + Debug.Print "Progress error - Progress = " & Progress & ", ProgressMax = " & ProgressMax + End If +' StatusBar1.Panels(2).Text = Int(fProgress) & "%" +End Sub + +Private Sub rbExplorer_Click() + Set browser = frmExplorer.Browser1 +End Sub + +Private Sub rbMozilla_Click() + Set browser = frmMozilla.Browser1 +End Sub + +Private Sub Toolbar1_ButtonClick(ByVal Button As ComctlLib.Button) + Select Case Button.Key + Case "goback" + browser.GoBack + Case "goforward" + browser.GoForward + Case "reload" + browser.Refresh + Case "gohome" + browser.GoHome + Case "gosearch" + browser.GoSearch + Case "loadpage" + browser.Navigate cmbUrl.Text + Case "stop" + browser.Stop + Case Else + End Select +End Sub + +Private Sub verbs_Click() + ' Query the browser to see what IOleCommandTarget commands it supports + Dim nCmd As Integer + Dim nStatus As Integer + For nCmd = 1 To 40 + nStatus = browser.QueryStatusWB(nCmd) + If nStatus And 1 Then + Debug.Print "Command " & nCmd & " is supported" + Else + Debug.Print "Command " & nCmd & " is not supported" + End If + If nStatus And 2 Then + Debug.Print "Command " & nCmd & " is disabled" + End If + Next +End Sub diff --git a/mozilla/embedding/browser/activex/tests/vbrowse/frmToolBar.frx b/mozilla/embedding/browser/activex/tests/vbrowse/frmToolBar.frx new file mode 100644 index 0000000000000000000000000000000000000000..119c739205a27664e8ea7c589150a249a4f49ae7 GIT binary patch literal 6516 zcmeHLO=ufO6n=_=c8x(BwIxZRAR{R0C5b_YLVZy0y|@J@R|R7=DY3mxjHR|QJN@3w&hAK1*ObsYv`-rCy!XAI znKyqs%21k8G&%Ck&`CN@7nhdY_s*WJR;y>`7eBvr`SOJ`vy1a5O!>mx($(1u?i>Se zn80TjE-o&z^rR`BzchPg@#s*=A`2BG||zIo{ryK`!VuiR;2# zGctaoF%-YHzV4a$*X!%w8Sw!_A<2);{A$AQizATB{>=Qq!K&e(+(yG}U*eg>Adh8_ zmF!~{x6*RM+#@Oti1Gop3@$!0%7yE~OT8Q&j)jq$7_xCglvjshqRj>ury%-w66r zn9KIVaK&F=r@j|!@n|^x=-7a>8{-(fK3bt^SMqB1VDoVlUz0F+9z*EII7G}V9C7Qy zB}?P|@%!L6!AE$^EBih%J`P;vB(YaKCs5L=;&mH|B#&dJQLWZ+*hDZNI|Lqyma2Bc z+q_=`yc!Kc!~5dCgjIaP7(fRhqKvu?4{%Kn5moslOJIa;H0)~4XpL>cN&AR=vTzKf zaSWvNF;E9yM+-|WtPUTU#EP(RE~HUX2Ps%tDK4xloqBkBGKhsIRu|>PmsAoV)erT` zKq6iW83Q5xS>CW)H=5{?v@SU1G1d8vCFW?2r*fiTGmBGQlVlThhhGnkcS9IrWf-{R z6LW{hCrJ1KucUQAvm}FT@_QHo)Pr zhYdZz;m`sOoe(p74@+o(869x()YHf8_OZ(ZP-Ar;W-Yi`g;RKv9^rXV2Mp1#C_kV? zu(*Z#e_~~fCjIa8*kog4+v7bKD)rJuIRiu=T{YJ>*;1TAi{!^9~#+ z6U7H?Bt1sFHjnh>N-}VabF|QuzGQi)hQ7pr!lm*e1w0jWBb7$nrNdO=j_gPImJk_i z8#p$ilEyPWUpUQN>L@AQuMFyWJ{NeU`~|&oDh9ICv6qB+b{2cS zC4`3=joJV7SZ=L#a?;}B+Y@|(=W)80`02MY&Wj*_i=RVs=xH0aXFt*(`(^(ehvRWv z&?~nxM$$Tb!Nm<1uepYbTWf9%-7v3jG#?rYwTfe-&h;kvn;c>}g^RXbti2QUO}$`+B56Kd+J$*qv$(ny zcQ;LkM3ciTRJ3#XG;EnqPa$B^Ah0Zq1yh?eQ<