mfc >> 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



mfc >> Looking for sample for CDHtmlDialog

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


mfc >> 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?

mfc >> 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

mfc >> 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?

mfc >> 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?

mfc >> 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?

mfc >> 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. INF: Looking for sample for CDHtmlDialog

2. 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. Looking for a sample C++ project

4. 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. looking for sample:multiple view single document in C# or VB - .Net Framework

6. Looking for good c# sample NetworkStream BeginRead/EndRead...

Need the correct usage pattern for something like a chat program.

Don't want any threading issues or stack problems.

Kyle!


7. Looking for samples of parsing xml with linq dump to database table - CSharp/C#

8. Looking for some sample codes in C#

Hi all,

I am looking for some sample codes in C#, in which, it can read a schema xsd 
file and use it to validate an xml stream or file. Ideally the sample will 
use XmlValidatingReader.

TIA,

JoeZ