+1 800 256 3608 (toll-free in North America) or +49 7531 90 60 10| service@combit.com

Attempted to read or write protected memory. This is often an indication that other memory is corru


(Guest) #1

Dear Sir/Madam,

I use List and Label 15. I use it to print list and label from Asp.net web application. Following is my code segment. This is working fine for most of the cases. But in very rare case, I am getting an error “Attempted to read or write protected memory. This is often an indication that other memory is corrupt”. I googled about this error and found out that this error may occur while calling unmanaged dll or COM from managed code.

I am just wondering if anybody have come across this error. Any suggestion or source code would be highly appreciated. Following is my source code and I get error at ll1.print().

            ListLabel LL1 = new ListLabel();
            string path = Server.MapPath("~");
            Filename = path;
            Directory.SetCurrentDirectory(path + "\\layouts");
            LL1.LicensingInfo = "My licence key!!!!";
            LL1.Core.LlSetOption(137, 1);
            LL1.DefineVariables += new DefineVariablesHandler(LlDefineVariables);
           
                LL1.ExportOptions.Add("Export.File", Filename);
                LL1.ExportOptions.Add("Export.Path", path);
                LL1.ExportOptions.Add("Export.Quiet", "1");
               
                
                LL1.Print(LlProject.Label, "Visitor.lbl");

private void LlDefineVariables(object sender, DefineElementsEventArgs e)
{

            LL1.Variables.Add("ARRIVALDATE", dsVisitorInfo.Tables[0].Rows[0][3].ToString());
            LL1.Variables.Add("HOSTNAME", dsVisitorInfo.Tables[0].Rows[0][2].ToString());
            LL1.Variables.Add("VISITORNAME", dsVisitorInfo.Tables[0].Rows[0][0].ToString());
            LL1.Variables.Add("VISITORCOMPANY", dsVisitorInfo.Tables[0].Rows[0][1].ToString());
            LL1.Variables.Add("LONGTERMDATE", dsVisitorInfo.Tables[0].Rows[0][4].ToString());
            LlBarcode bc = new LlBarcode(dsVisitorInfo.Tables[0].Rows[0][5].ToString(), codeType.CODE128);
            LL1.Variables.Add("BARCODE", bc);
            string imageFullPath = path + "\\Images\\WebcamPhoto.jpg";
            //LL1.Variables.Add("Visitor Photo", new Bitmap("c:\\faceImageVBA.jpg"));
            if (File.Exists(imageFullPath))
            {
                LL1.Variables.Add("Visitor Photo", new Bitmap(imageFullPath));
            }
            else
            {
                LL1.Variables.Add("Visitor Photo", "");
            }
            
           

            e.IsLastRecord = true;
        }

(Guest) #2

Attach a debugger, and then the GPF appears, look at the debugger
information, possibly contacting combit support and sending the dump
file if they want it (most likely on a GPF in my experience).

Paulchen

“Hiteshkumar Patel” <hpatel@allstari…> wrote in message
news:1021054201023268@combit.net

Dear Sir/Madam,

I use List and Label 15. I use it to print list and label from
Asp.net web application. Following is my code segment. This is
working fine for most of the cases. But in very rare case, I am
getting an error “Attempted to read or write protected memory. This
is often an indication that other memory is corrupt”. I googled
about this error and found out that this error may occur while
calling unmanaged dll or COM from managed code.

I am just wondering if anybody have come across this error. Any
suggestion or source code would be highly appreciated. Following is
my source code and I get error at ll1.print().

           ListLabel LL1 = new ListLabel();
           string path = Server.MapPath("~");
           Filename = path;
           Directory.SetCurrentDirectory(path + "\\layouts");
           LL1.LicensingInfo = "My licence key!!!!";
           LL1.Core.LlSetOption(137, 1);
           LL1.DefineVariables += new 

DefineVariablesHandler(LlDefineVariables);

               LL1.ExportOptions.Add("Export.File", Filename);
               LL1.ExportOptions.Add("Export.Path", path);
               LL1.ExportOptions.Add("Export.Quiet", "1");


               LL1.Print(LlProject.Label, "Visitor.lbl");

private void LlDefineVariables(object sender,
DefineElementsEventArgs e)
{

           LL1.Variables.Add("ARRIVALDATE", 

dsVisitorInfo.Tables[0].Rows[0][3].ToString());
LL1.Variables.Add(“HOSTNAME”,
dsVisitorInfo.Tables[0].Rows[0][2].ToString());
LL1.Variables.Add(“VISITORNAME”,
dsVisitorInfo.Tables[0].Rows[0][0].ToString());
LL1.Variables.Add(“VISITORCOMPANY”,
dsVisitorInfo.Tables[0].Rows[0][1].ToString());
LL1.Variables.Add(“LONGTERMDATE”,
dsVisitorInfo.Tables[0].Rows[0][4].ToString());
LlBarcode bc = new
LlBarcode(dsVisitorInfo.Tables[0].Rows[0][5].ToString(),
codeType.CODE128);
LL1.Variables.Add(“BARCODE”, bc);
string imageFullPath = path +
“\Images\WebcamPhoto.jpg”;
//LL1.Variables.Add(“Visitor Photo”, new
Bitmap(“c:\faceImageVBA.jpg”));
if (File.Exists(imageFullPath))
{
LL1.Variables.Add(“Visitor Photo”, new
Bitmap(imageFullPath));
}
else
{
LL1.Variables.Add(“Visitor Photo”, “”);
}

           e.IsLastRecord = true;
       }