mshtml does not work in C# Pleas Help!

Announcements and discussion for PInvoke

Moderators: Luke Jefferson, Robert

mshtml does not work in C# Pleas Help!

Postby mr1900 » Wed May 16, 2007 3:51 pm

Hello! Why the example does not work

Sample Code:
// Get the ActiveX interface of some window of class "Internet Explorer_Server"
IntPtr hWnd = GetThatWindow(); // from wherever
uint nMsg = RegisterWindowMessage("WM_HTML_GETOBJECT");
UIntPtr lRes;
if ( SendMessageTimeout(hWnd, nMsg, UIntPtr.Zero, IntPtr.Zero,
SendMessageTimeoutFlags.SMTO_ABORTIFHUNG, 1000, out lRes) == IntPtr.Zero )
return null;
return (mshtml.IHTMLDocument) ObjectFromLresult(lRes,
typeof(mshtml.IHTMLDocument).GUID, IntPtr.Zero);

The programming language C#
Error: The type or namespace name 'mshtml' could not be found (are you missing a using directive or an assembly reference?)
What using????

Help please! I only study in programming.
I from Ukraine, therefore am sorry for my English
Posts: 2
Joined: Wed May 16, 2007 3:41 pm
Location: Ukraine

Postby Robert » Wed May 16, 2007 4:06 pm


The sample code appears to just be a snippet to demonstrate the ObjectFromLresult function, so isn't complete (it assumes the mshtml object is declared outside of that sample).

For more information on MSHTML, the MSDN MSHTML Reference at might help you.
Robert Chipperfield
Developer, Red Gate Software Ltd
Posts: 410
Joined: Mon Oct 30, 2006 11:15 am
Location: Cambridge, UK

Postby mr1900 » Fri May 18, 2007 7:07 am

Hi Robert.

Many thanks to you, I have understood also all have earned!

Once again thanks!

With the best regards, mr1900.
Posts: 2
Joined: Wed May 16, 2007 3:41 pm
Location: Ukraine

Return to PInvoke.Net

Who is online

Users browsing this forum: No registered users and 1 guest