473,386 Members | 1,883 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Interop(?) Problem returning bool from C# to WebBrowser Script Error handler

Using the MS C++ Example
http://support.microsoft.com/default...b;en-us;261003 I've
successfully managed to trap and log Script Errors that are generated by the
WebBrowser (IE 6) which is hosted by a C# application, see below. However
I've completely failed to force the browser to continue processing script
which *should* be controlled by returning a true VT_BOOL via pvaOut. I've
tried returning bool, System.Boolean even constructing a Variant object with
various Marshalling options but without any success. Any help or suggestions
on what to try next would be much appreciated.

Thanks in advance for any help
John

void IOleCommandTarget.Exec(int pguidCmdGroup,
MsHtmlCustomization.OLECMDID nCmdID,

MsHtmlCustomization.OLECMDEXECOPT nCmdexecopt,

ref object pvaIn,

ref object pvaOut) {

if(pguidCmdGroup == 0) return;

switch((int) nCmdID) {

case 0x28: // OLECMDID_SHOWSCRIPTERROR

bool DisplayError = true; // Display Standard IE Script Error Dialog

bool ContinueRunningScripts = true; // Continue to run Scripts

HTMLDocumentClass Doc = (HTMLDocumentClass) pvaIn;

IHTMLEventObj2 ev = (IHTMLEventObj2) Doc.parentWindow.@event;

int errorLine = (int) ev.getAttribute("errorLine", 0);

string errorCharacter = ev.getAttribute("errorCharacter",
0).ToString();

int errorCode = (int) ev.getAttribute("errorCode", 0);

string errorMessage = (string) ev.getAttribute("errorMessage", 0);

string errorUrl = (string) ev.getAttribute("errorUrl", 0);

if(eScriptError != null) {

DisplayError = eScriptError(this, errorUrl, errorLine,
errorMessage, out ContinueRunningScripts);

// If were not displaying an error message then pause a moment

if(!DisplayError) Sleep(2000);

}

pvaOut = (System.Boolean) ContinueRunningScripts;

throw new COMException("", (DisplayError ? S_ERROR : S_OK));

}

return;

}
Nov 15 '05 #1
0 3561

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Boris | last post by:
The .NET documentation talks about blittable and non-blittable types. While objects of type System::Object* are non-blittable it doesn't say anything about objects of user-defined classes. All the...
3
by: SteveS | last post by:
After working fine for months, today, when I ran my project I received the message: "COM Interop registration failed. Could not find a type library for assembly 'Microsoft.VisualBasic'." I...
5
by: mcnewsxp | last post by:
i get 'System.Runtime.InteropServices.COMException' occurred in axinterop.mshierarchicalflexgridlib.dll error on this line while trying to reset column sizes on a MSHFlexGrid: ..col = j when...
0
by: holysmokes99 | last post by:
I have a VB.Net (1.1) that uses SQL-DMO via COM Interop to create a linked server. The code throws an exception, as it should, when the linked server I am trying to create already exists on the...
3
by: DG is a god.... | last post by:
Dear All , This is my first post - please go easy...! I have a DLL written in C++ that has the following function exported from it -: char** ListHandles(int *processID); The processID...
6
by: ANeelima | last post by:
I have a VB6 executable that references a .NET 2.0 dll. The .NET 2.0 dll project has 'Register for COM Interop' checked. Thus, compiling the dll will generate the .tlb file. This will allow early...
0
by: Amy L | last post by:
While stress testing an application we have I ran into a Com-Interop error that was unhandled. The actual error said that the pagefile was too small and gave me an HResult error. The odd part was...
0
by: Udi | last post by:
Hi all, I'm having difficulties returning a buffer allocated on a callback called from a native dll to .NET assembly. (See pseudo code below in "Foo" func): The managed assembly (the called back...
0
by: akshar108 via DotNetMonster.com | last post by:
TextFrame (unknown member) : Invalid request. This type of shape cannot have a TextRange i got this error while i m fetching text from textframe which is in the slide my code is following can...
4
by: Rinaldo | last post by:
Hi, when I trying to open the form designer in 2008 I get the following error: The service Microsoft.VisualStudio.Shell.Interop.ISelectionContainer already exists in the service containter....
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.