Click here to Skip to main content
15,917,538 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionMoving desktop shortcuts to desired position Pin
Manfred Staiger16-Jun-08 5:13
Manfred Staiger16-Jun-08 5:13 
QuestionCRuntimeClass linker error unresolved external – how to troubleshoot? Pin
Vaclav_16-Jun-08 5:13
Vaclav_16-Jun-08 5:13 
AnswerRe: CRuntimeClass linker error unresolved external – how to troubleshoot? Pin
Chris Losinger16-Jun-08 6:54
professionalChris Losinger16-Jun-08 6:54 
GeneralRe: CRuntimeClass linker error unresolved external – how to troubleshoot? Pin
Vaclav_16-Jun-08 7:13
Vaclav_16-Jun-08 7:13 
GeneralRe: CRuntimeClass linker error unresolved external – how to troubleshoot? Pin
Vaclav_16-Jun-08 7:16
Vaclav_16-Jun-08 7:16 
AnswerRe: CRuntimeClass linker error unresolved external – how to troubleshoot? Pin
Stephen Hewitt16-Jun-08 15:44
Stephen Hewitt16-Jun-08 15:44 
GeneralRe: CRuntimeClass linker error unresolved external – how to troubleshoot? Pin
Vaclav_16-Jun-08 17:28
Vaclav_16-Jun-08 17:28 
QuestionCreating an embeded window in Internet Explorer Pin
chatko16-Jun-08 2:30
chatko16-Jun-08 2:30 
Hi,

I'm using VS2005 to create an ATL project which creates a simple blank window's application window embedded inside IE. I've followed the MSDN Browser helper object tutorial and code project examples to create a basic BHO and I've confirmed its registered with the browser.

Now I'd like to create a window inside the browser when its started. In my code below I think I have access to the window handle of the IE parent window. I've started looking at either Ccontainedwindow or CWindowimpl. Which class should I be using and how to create the embedded window? Or does anyone know of an example I could follow?

My class is as follows:

// myBHO.cpp : Implementation of CmyBHO
#include "stdafx.h"
#include "myBHO.h"

STDMETHODIMP CmyBHO::SetSite(IUnknown* pUnkSite)
{
    if (pUnkSite != NULL)
    {
        // Cache the pointer to IWebBrowser2.
        pUnkSite->QueryInterface(IID_IWebBrowser2, (void**)&m_spWebBrowser);
    }
    else
    {
        // Release cached pointers and other resources here.
        m_spWebBrowser.Release();
    }

    //CComQIPtr< IWebBrowser2 >   pWebBrowser = pUnkSite;
    if( m_spWebBrowser )
    {
		HWND    hWnd;
		m_spWebBrowser->get_HWND( (long*)&hWnd );

    }
    // Return the base class implementation
    return IObjectWithSiteImpl<cmybho>::SetSite(pUnkSite);
}
</cmybho>



The Header file looks like:

// myBHO.h : Declaration of the CmyBHO

#pragma once
#include "resource.h"       // main symbols
#include "overallBHO.h"
#include <shlguid.h>     // IID_IWebBrowser2, DIID_DWebBrowserEvents2, etc.
#include <atlwin.h> 
#include <windef.h> 


#if defined(_WIN32_WCE) && !defined(_CE_DCOM) && !defined(_CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA)
#error "Single-threaded COM objects are not properly supported on Windows CE platform, such as the Windows Mobile platforms that do not include full DCOM support. Define _CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA to force ATL to support creating single-thread COM object's and allow use of it's single-threaded COM object implementations. The threading model in your rgs file was set to 'Free' as that is the only threading model supported in non DCOM Windows CE platforms."
#endif

// CmyBHO

class ATL_NO_VTABLE CmyBHO :
	public CComObjectRootEx<ccomsinglethreadmodel>,
	public CComCoClass<cmybho,>,
	public IObjectWithSiteImpl<cmybho>,
	public IDispatchImpl
{
public:
	CmyBHO()
	{
	}

DECLARE_REGISTRY_RESOURCEID(IDR_myBHO)

DECLARE_NOT_AGGREGATABLE(CmyBHO)

BEGIN_COM_MAP(CmyBHO)
	COM_INTERFACE_ENTRY(ImyBHO)
	COM_INTERFACE_ENTRY(IDispatch)
	COM_INTERFACE_ENTRY(IObjectWithSite)
END_COM_MAP()

	DECLARE_PROTECT_FINAL_CONSTRUCT()

	HRESULT FinalConstruct()
	{
		return S_OK;
	}

	void FinalRelease()
	{
	}

public:
	STDMETHOD(SetSite)(IUnknown *pUnkSite);
private:
    CComPtr<iwebbrowser2>  m_spWebBrowser;
};

OBJECT_ENTRY_AUTO(__uuidof(myBHO), CmyBHO)

</iwebbrowser2></cmybho></ccomsinglethreadmodel></windef.h></atlwin.h></shlguid.h>


Thanks,

Chris
AnswerRe: Creating an embeded window in Internet Explorer Pin
ThatsAlok16-Jun-08 3:22
ThatsAlok16-Jun-08 3:22 
QuestionProblem with a program that does Copy-Paste functionality. Pin
ritz123416-Jun-08 2:26
ritz123416-Jun-08 2:26 
AnswerRe: Problem with a program that does Copy-Paste functionality. Pin
CPallini16-Jun-08 2:40
mveCPallini16-Jun-08 2:40 
GeneralRe: Problem with a program that does Copy-Paste functionality. Pin
ritz123416-Jun-08 2:57
ritz123416-Jun-08 2:57 
AnswerRe: Problem with a program that does Copy-Paste functionality. Pin
David Crow16-Jun-08 3:30
David Crow16-Jun-08 3:30 
GeneralRe: Problem with a program that does Copy-Paste functionality. Pin
ritz123416-Jun-08 3:43
ritz123416-Jun-08 3:43 
GeneralRe: Problem with a program that does Copy-Paste functionality. Pin
David Crow16-Jun-08 3:50
David Crow16-Jun-08 3:50 
GeneralRe: Problem with a program that does Copy-Paste functionality. Pin
ritz123416-Jun-08 4:00
ritz123416-Jun-08 4:00 
GeneralRe: Problem with a program that does Copy-Paste functionality. Pin
David Crow16-Jun-08 6:07
David Crow16-Jun-08 6:07 
AnswerRe: Problem with a program that does Copy-Paste functionality. Pin
Saurabh.Garg16-Jun-08 6:41
Saurabh.Garg16-Jun-08 6:41 
GeneralRe: Problem with a program that does Copy-Paste functionality. Pin
ritz123416-Jun-08 20:07
ritz123416-Jun-08 20:07 
GeneralRe: Problem with a program that does Copy-Paste functionality. Pin
Saurabh.Garg16-Jun-08 20:10
Saurabh.Garg16-Jun-08 20:10 
QuestionNamedPipe issue Pin
Sunil P V16-Jun-08 2:19
Sunil P V16-Jun-08 2:19 
QuestionRe: NamedPipe issue Pin
Mark Salsbery16-Jun-08 5:36
Mark Salsbery16-Jun-08 5:36 
AnswerRe: NamedPipe issue Pin
Sunil P V16-Jun-08 19:10
Sunil P V16-Jun-08 19:10 
GeneralRe: NamedPipe issue Pin
Mark Salsbery17-Jun-08 5:18
Mark Salsbery17-Jun-08 5:18 
QuestionDisabling PPP modem connections programmatically Pin
dharani16-Jun-08 2:11
dharani16-Jun-08 2:11 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.