🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #2619

Code Guard Help

#2619
From: Dan Mayo
Date: Tue, 06 Feb 2007 15:58
39 lines
2556 bytes
Hopefully I am not blasted for posting this twice.

I am trying to use CodeGuard based on a recommendation here as I haven't 
used it before.  When I enable CodeGuard in my program of interest I get 
odd "Method called on illegally casted object" errors, see "Re: Memory 
Leak - TForm or TStringGrid or DynamicArray" for more info.

Trying to better understand this error and resolve it, I decided to 
start with a basic hello world application.  When I run this basic Hello 
World type application using the 'Application->ExeName' that I think may 
be causing the 'this->' reference error in my main program.  When I run 
the program with CodeGuard off, the program runs fine; when I turn 
CodeGuard on, I get "The application failed to initialize properly" and 
"...Project1.exe raised too many consecutive exceptions...." errors 
immediately on application startup.

What am I doing wrong.

My code for Project1 is as follows, a one form application with label, 
the label caption is setup in the constructor of the form:

//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
const String ThePath = Application->ExeName;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
         : TForm(Owner)
{
   Label1->Caption = ThePath;
}
//---------------------------------------------------------------------------
Technical Details
Message-ID: <45c8a5ea@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!t-online.de!newsfeed.freenet.de!news.albasani.net!feeder06.uucp-net.de!reader.uucp.at!newsfeed.uucp.at!news.uucp.at!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,3a679ddbd3fd8858,start
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
Date: Tue, 06 Feb 2007 09:58:30 -0600
From: Dan Mayo <do_not_spam_dmayo2@netzero.com>
User-Agent: Thunderbird 1.5.0.9 (Windows/20061207)
MIME-Version: 1.0
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Code Guard Help
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 216.174.165.174
Message-ID: <45c8a5ea@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1170777578 216.174.165.174 (6 Feb 2007 07:59:38 -0800)
Lines: 39
Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!t-online.de!newsfeed.freenet.de!news.albasani.net!feeder06.uucp-net.de!reader.uucp.at!newsfeed.uucp.at!news.uucp.at!newsgroups.borland.com!not-for-mail