473,545 Members | 289 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ExecutionEngine Exception using AxSHDocVw.AxWeb Browser

Hi,

In my c# windows application, i am using AxSHDocVw.AxWeb Browser.
I am displaying a generated receipt html in this browser. Also,
for printing the same html, i am using the following command :

axWebBrowser2.E xecWB(SHDocVw.O LECMDID.OLECMDI D_PRINT,
SHDocVw.OLECMDE XECOPT.OLECMDEX ECOPT_DONTPROMP TUSER,ref empty,ref
empty);

This works fine and Html is printed properly on some machines.
But on some machines, it is giving ExecutionEngine Exception or
sometimes
it is giving StackOverflowEx ceptions. Since as per the microsoft site,

we cannot catch these both types of exceptions at all.
Also, i cannot debug the occured exception, because it is occuring
only on client machines.

Can anyone pls help me to solve this problem?

Thanks & Regards,
Sagaraj

Here is the entire code :
-----------------------------------

using System;
using System.Drawing;
using System.Data;
using System.Collecti ons;
using System.Componen tModel;
using System.Windows. Forms;
using System.Xml;
using System.Xml.XPat h;
using System.Xml.Xsl;
using System.IO;
using System.Diagnost ics;

public class FrmPaymentRecei pt : System.Windows. Forms.Form
{
public const string YES = "Y";
public const string NO = "N";
public const int PERCENTAGE=100;
private PaymentReceiptD S paymentReceiptD S;
ulong subTotal = 0;
float tax=0;
decimal saleAmount=0;
decimal returnAmount=0;
decimal saleAmt_Minus_R eturnAmt=0;
private AxSHDocVw.AxWeb Browser axWebBrowser2;
private XmlDocument xmlDoc;
bool printFlag=true;

public FrmPaymentRecei pt()
{
//
// Required for Windows Form Designer support
//
InitializeCompo nent();

this.Visible = false;

}

public FrmPaymentRecei pt(PaymentRecei ptDS paymentReceiptD S,
bool printFlag)
{
//
// Required for Windows Form Designer support
//
this.Visible = false;
InitializeCompo nent();
this.paymentRec eiptDS = paymentReceiptD S;
this.printFlag = printFlag;
this.Visible = false;
}

/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Disp ose();
}
}
base.Dispose( disposing );
}

#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeCompo nent()
{
System.Resource s.ResourceManag er resources =
new System.Resource s.ResourceManag er(typeof(FrmPa ymentReceipt));
this.axWebBrows er2 = new AxSHDocVw.AxWeb Browser();
((System.Compon entModel.ISuppo rtInitialize)(t his.axWebBrowse r2)).BeginInit( );
this.SuspendLay out();
//
// axWebBrowser2
//
this.axWebBrows er2.Enabled = true;
this.axWebBrows er2.Location = new System.Drawing. Point(88, 148);
this.axWebBrows er2.OcxState =
((System.Window s.Forms.AxHost. State)(resource s.GetObject("ax WebBrowser2.Ocx State")));
this.axWebBrows er2.Size = new System.Drawing. Size(300, 150);
this.axWebBrows er2.TabIndex = 1;
this.axWebBrows er2.Visible = false;
//
// FrmPaymentRecei pt
//
this.AutoScaleB aseSize = new System.Drawing. Size(5, 12);
this.ClientSize = new System.Drawing. Size(720, 448);
this.ControlBox = false;
this.Controls.A dd(this.axWebBr owser2);
this.Name = "FrmPaymentRece ipt";
this.Load += new System.EventHan dler(this.FrmPa ymentReceipt_Lo ad);
this.Activated += new
System.EventHan dler(this.FrmPa ymentReceipt_Ac tivated);
((System.Compon entModel.ISuppo rtInitialize)(t his.axWebBrowse r2)).EndInit();
this.ResumeLayo ut(false);

}
#endregion

private void FrmPaymentRecei pt_Load(object sender, System.EventArg s e)
{
this.Visible = false;
this.CalculateB alance();
this.ArticleSal eReturnAmount() ;
string xmlSchema = this.paymentRec eiptDS.GetXml() ;
this.Visible = false;
xmlSchema =
xmlSchema.Repla ce("xmlns=\"htt p://tempuri.org/ReceiptDS.xsd\" ","");
this.Visible = false;
xmlDoc = new XmlDocument();
xmlDoc.LoadXml( xmlSchema);
this.Visible = false;
XmlTextWriter writer =
new XmlTextWriter(" receipt.xml",Sy stem.Text.Encod ing.UTF8);
writer.WriteSta rtDocument(true );
this.Visible = false;
writer.WritePro cessingInstruct ion("xml-stylesheet",
"type=\"tex t/xsl\" href=\"receipt. xsl\"");
writer.WriteRaw (xmlSchema);
writer.Close();
xmlDoc.CreatePr ocessingInstruc tion("xml-stylesheet",
"type=\"tex t/xsl\" href=\"receipt. xsl\"");
this.Visible = false;
this.Initialize Report();
this.Visible = false;
}

private void InitializeRepor t()
{
this.Visible = false;
string strxslName = "receipt.xs l";

if (this.paymentRe ceiptDS.RETURN_ PARTICULARS.Row s.Count<=0)
{
}
else
{
strxslName = "receiptreturn. xsl";
}

StringWriter sw;
sw = MergeXSL_XML("r eceipt.xml",str xslName);
System.IO.Strea mWriter file =
new System.IO.Strea mWriter("receip t.html");
file.WriteLine( sw.ToString());
file.Close();

object empty = System.Reflecti on.Missing.Valu e;
axWebBrowser2.N avigate("about: blank",ref empty,ref empty,
ref empty,ref empty);
mshtml.IHTMLDoc ument2 htmlDoc =
(mshtml.IHTMLDo cument2) axWebBrowser2.D ocument;
htmlDoc.writeln (sw.ToString()) ;

this.Visible = false;
Object a = new object(),b = new object();

if(System.Confi guration.Config urationSettings .AppSettings["ExecutionM ode"]!="Testing")
{
if (printFlag)
{
axWebBrowser2.E xecWB(SHDocVw.O LECMDID.OLECMDI D_PRINT,
SHDocVw.OLECMDE XECOPT.OLECMDEX ECOPT_DONTPROMP TUSER,
ref empty,ref empty );
axWebBrowser2.E xecWB(SHDocVw.O LECMDID.OLECMDI D_PRINT,
SHDocVw.OLECMDE XECOPT.OLECMDEX ECOPT_DONTPROMP TUSER,
ref empty,ref empty );
}
}
this.Visible = false;
}

public StringWriter MergeXSL_XML(st ring xml, string xsl)
{
try
{
//XPathDocument xPath = new XPathDocument(x ml);

XslTransform xTrans = new XslTransform();
xTrans.Load(App lication.Startu pPath+ "\\"+ xsl);
StringWriter strW = new StringWriter();
xTrans.Transfor m(xmlDoc,null,s trW);
strW.Close();
return strW;
}
catch(Exception e)
{
MessageBox.Show (e.ToString());
return null;
}
}

Apr 13 '06 #1
0 2034

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

Similar topics

0
1957
by: David Elliott | last post by:
I have created an application that loads assemblies (plugins). These plugins are windows forms that have an embedded browser. private AxSHDocVw.AxWebBrowser browser; If I comment out this.browser = new AxSHDocVw.AxWebBrowser(); and associated code to avoid exceptions like this.browser.Dock = System.Windows.Forms.DockStyle.Fill;...
3
3357
by: Simon CJC | last post by:
Hello I use AxSHDocVw.AxWebBrowser in a windows application. But sometimes the url I browsed in AxSHDocVw.AxWebBrowser contains error caused by javascript. Can I prevent javascript from running in AxSHDocVw.AxWebBrowser Thanks Simon CJC
1
2409
by: Pengyu | last post by:
I host AxSHDocVw.AxWebBrowser in my C# application. It generally works ok. However, the AxSHDocVw.AxWebBrowser control sometime stucks and can not nevigate to other URLs. What is the problem? BTW, the network connection is ok. Thanks a lot, Pengyu
0
1166
by: Mystery Man | last post by:
Currently, we use host AxSHDocVw.AxWebBrowser as an HTML editor. There are two questions I have with this control: (1) When the user presses the ENTER key it creates a new paragraph and as a result, there is an extra line of whitespace created. I can detect the user has pressed the newline and change it to \r\n. However, the problem with...
0
1041
by: Manuel Costa | last post by:
Hi i want to restrict the AxSHDocVw.AxWebBrowser to html pages. For example, when clicked, links to files by http or ftp should be canceled. manuel
1
1985
by: jokolee | last post by:
i was using component AxSHDocVw.AxWebBrowser,,but i rather confuces because when i write AxWebBrowser1.Document. the next option is Gettype function,,,nothing else...... But when i write AxWebBrowser1.Document.all.tags("DIV").length() the code is running well....WHY..?? i realy confuces because AxWebBrowser1.Document.all it's not in the...
2
4361
by: Fredo | last post by:
I'm going to try to post this without having to paste in hundreds of lines of code. I'm trying to override IInternetSecurityManager. I'm taking sort of a minimalist approach and adding code as I take each step because I'm not 100% sure about what I'm doing here. First of all, I've created a WebBrowser class. It is defined as: public...
4
1425
by: =?Utf-8?B?RGF2ZSBF?= | last post by:
I have written an application that reads third party web pages. If I am using HTTP everything works fine. I create an AxSHDocVw.AxWebBrowser object and then Navigate2 to the page. I then populate some form fields, browse to the appropriate button on the page and then call it's click method. This works just fine using HTTP. However,...
1
1347
by: tim2006 | last post by:
When i try to run the program, it just hangs. If i remove the axwebbrowser control it works fine. Any ideas? Here is my code: class1.vb Imports System.Windows.Forms Imports System.Threading
0
7465
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7805
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7416
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7752
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5969
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
3449
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3441
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1013
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
701
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.