Using the InternetExplorer object in a Managed C++ application
-
Hi all, I am trying to use the InternetExplorer object to automate Internet Explorer from my Managed C++ application; The following is a snippit of C# code that compiles and runs.
using SHDocVw; ............ ............ private SHDocVw.InternetExplorer m_IExplorer = null; .............. ............ .......... m_IExplorer = new SHDocVw.InternetExplorer();
However, when I convert it to Managed C++, thus;using namespace SHDocVw; ............ ............ private: SHDocVw::InternetExplorer m_IExplorer; .............. ............ .......... m_IExplorer = new SHDocVw::InternetExplorer();
I get the compile error C3153: 'SHDocVw::InternetExplorer' : you cannot create an instance of an interface Does anyone know what I am doing wrong? Regards, Chris -
Hi all, I am trying to use the InternetExplorer object to automate Internet Explorer from my Managed C++ application; The following is a snippit of C# code that compiles and runs.
using SHDocVw; ............ ............ private SHDocVw.InternetExplorer m_IExplorer = null; .............. ............ .......... m_IExplorer = new SHDocVw.InternetExplorer();
However, when I convert it to Managed C++, thus;using namespace SHDocVw; ............ ............ private: SHDocVw::InternetExplorer m_IExplorer; .............. ............ .......... m_IExplorer = new SHDocVw::InternetExplorer();
I get the compile error C3153: 'SHDocVw::InternetExplorer' : you cannot create an instance of an interface Does anyone know what I am doing wrong? Regards, ChrisChange Chris Morrison wrote: private: SHDocVw::InternetExplorer m_IExplorer; m_IExplorer = new SHDocVw::InternetExplorer(); To
SHDocVw::InternetExplorerClass* ieForAutomation;
ieForAutomation = new SHDocVw::InternetExplorerClass();Take a look at the VC.NET - Interop - Automate IE example found in the MSDN Visual C++ .NET 2003 Code Samples[^]. I bet this sample is doing some of the exact stuff you are trying to do! Roger Stewart "I Owe, I Owe, it's off to work I go..."
-
Change Chris Morrison wrote: private: SHDocVw::InternetExplorer m_IExplorer; m_IExplorer = new SHDocVw::InternetExplorer(); To
SHDocVw::InternetExplorerClass* ieForAutomation;
ieForAutomation = new SHDocVw::InternetExplorerClass();Take a look at the VC.NET - Interop - Automate IE example found in the MSDN Visual C++ .NET 2003 Code Samples[^]. I bet this sample is doing some of the exact stuff you are trying to do! Roger Stewart "I Owe, I Owe, it's off to work I go..."
Roger Stewart wrote: Change Chris Morrison wrote: private: SHDocVw::InternetExplorer m_IExplorer; m_IExplorer = new SHDocVw::InternetExplorer(); To SHDocVw::InternetExplorerClass* ieForAutomation; ieForAutomation = new SHDocVw::InternetExplorerClass(); Thanks Roger, I just cracked it by looking though the MSDN Library. Thank you for that link as well, that sample should come in very handy. Kind Regards, Chris