Re: Looking for sample for CDHtmlDialog

by Rodrigo Corral [MVP] » Wed, 22 Feb 2006 04:39:56 GMT



http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcsample/html/_sample_mfc_DHtmlExplore.asp

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcsample/html/vcsamSchedulerSample.asp

http://www.codeproject.com/dotnet/dhtmldialog.asp


--
Un saludo
Rodrigo Corral Gonzez [MVP]

FAQ de microsoft.public.es.vc++
http://rcorral.mvps.org





Re: Looking for sample for CDHtmlDialog

by AliR » Wed, 22 Feb 2006 04:40:15 GMT


Re: Looking for sample for CDHtmlDialog

by QVRT » Wed, 22 Feb 2006 05:04:31 GMT



Thanks for the sample links. I'm trying to make one as a modeless dialog. The
rules for modeless dialogs is to call Create in the constructor, but when I
do this, it throws an exception. Any ideas?








Re: Looking for sample for CDHtmlDialog

by AliR » Wed, 22 Feb 2006 06:17:57 GMT



Take the Create call out of the constructor, and place it where you really
what to create the modeless dialog.

Beside the fact that I hate constructors creating dialogs, it will not
always work (hence your case).
For example if you were to put a variable inside your CWinApp class
definition of type CDHtmlDialog (most likely a derived class), and when the
constructor of that class is gets called the app is not setup yet, before
the call to InitInstance.
So the create that is in the constructor of the CDHtmlDialog derived class
will fail when
hInst = AfxGetResourceHandle();

is called.

Another way to fix this it to declare a pointer to you CDHtmlDialog derived
class in CWinApp's header file, and new it in InitInstance.

Don't forget to call ShowWindow(SW_SHOW) on the modeless dialog.

AliR.



The
I

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcsample/html/vcsamSchedulerSample.asp







Re: Looking for sample for CDHtmlDialog

by QVRT » Wed, 22 Feb 2006 22:51:30 GMT



Thanks for the reply, but the Create is failing even though I put it outside
the constructor, and called it when I needed it. Example:

voif MyFuncThatCallsTheDlg()
{
CMyHtmlDerrivedDialog *pCMyHtmlDerrivedDialog;
pCMyHtmlDerrivedDialog = new CMyHtmlDerrivedDialog;

pCMyHtmlDerrivedDialog->Create(CMyHtmlDerrivedDialog::IDD); // This blows
up...
}

===== My Constructor is as such:

CMyHtmlDerrivedDialog::CMyHtmlDerrivedDialog(CWnd *pCWnd_Parent)
: CDHtmlDialog(CMyHtmlDerrivedDialog::IDD, CMyHtmlDerrivedDialog::IDH,
pCWnd_Parent)
{
}

Also, the CMyHtmlDerrivedDialog class is "plain jane", I simply added a
dialog derrived from CHtmlDialog and added nothing else to it. Is there a
sample showing CHtmlDialog being run in modeless?

Any ideas?




Re: Looking for sample for CDHtmlDialog

by QVRT » Wed, 22 Feb 2006 23:09:39 GMT



I have new information. I traced into the "Create" to see where it blows up,
and it blows up inside dlgcore.cpp (VS 2003) on line 309 at a call to
"::CreateDialogIndirect". The parameters to the call look "OK", as in none
are NULL, or pointing to any weird "thing". Any ideas?



Re: Looking for sample for CDHtmlDialog

by QVRT » Wed, 22 Feb 2006 23:49:32 GMT



I have new information. I have further traced and I found that in my
situation, the CreateDialogIndirect calls the DlgProc, which fails inside
dlgdhtml.cpp at line 930, where it calls:

lpUnk = m_wndBrowser.GetControlUnknown();

The lpUnk returned comes back as NULL, which then causes the access
violation on line 931 which tries to use it as such:

if (FAILED(lpUnk->QueryInterface(IID_IWebBrowser2, (void**)
&m_pBrowserApp)))

This implies that somehow the LoadLibrary/DLL did not get the CoInit or
something to work. Any ideas?




Re: Looking for sample for CDHtmlDialog

by QVRT » Wed, 22 Feb 2006 23:51:28 GMT



I think I have solved this.

I needed to add CoInitialize(NULL). This is not documented anywhere with the
CHtmlDialog class. Without it, the CHtmlDialog fails inside its OnInitDialog
member function.






Similar Threads

1. microsoft.public.vc.mfc >> INF: Looking for sample for CDHtmlDialog
INF: Looking for sample for CDHtmlDialog Please help, Can anyone post a sample that uses the CDHtmlDialog class?

2. microsoft.public.vc.mfc >> XP Look in CDHtmlDialog
I have created an application, and I have enabled Common controls V6 by creating a manifest file and Initiating Common Controls. It works properly whenever I use a standard Dialog but when I use a CDHtmlDialog and create a html button or a html radio button, it has the old Pre-Windows XP look, Is there a way to enable XP Look in the buttons created with HTML ?

3. microsoft.public.win32.programmer.directx.video >> Looking for a sample C++ project
I am developing a computer vision application. AmCap is a good starting point. My only problem is that AmCap uses very outdated code for user interface. Can somebody please point me at a sample project similar to AmCap that is using Visual Studio for user interface. It has to be C++ (I will need high processing speed), and it can be Windows Forms or MFC (preferably Windows Forms). All examples I saw were C# and it might be too slow - I will need to process every frame before rendering. Thanks. Gregory

4. microsoft.public.dotnet.framework.compactframework >> looking for a CF C# socket client sample
I'm looking for a simple CF C# tcp/ip client that I can use as a start point (I'm new to C# and .NET). I found a couple async socket samples, but none of them worked with the CF. One used Send() (which is not allowed in CF with non-blocking sockets ). Other used classes not present in CF. Any help will be appreciated. Omar

5. microsoft.public.dotnet.framework >> looking for sample:multiple view single document in C# or VB
Hi, I am looking for sample of an application similar to outlook regarding UI when user select a tree node in the left pane a view is changed in the right pane (it does not necessarily support MFC doc view architecture ) thanks in advance

6. Looking for samples of parsing xml with linq dump to database table

7. Looking for some sample codes in C#

8. Looking for sample thats loads an XML file and updates some records

9. Looking for good windows forms sample in C# showing how to work with ListBox

10. looking for code sample for non-blocking TCP sockets


Post a new topic