Sorry, I had already shutdown my computer for the night before I got your emails. Then this morning, I couldn't get onto the site.
Since you are working with Windows, there is not a main() function per se. Instead, you will have a WinMain() function. Normally, when you create a project in Borland, the compiler creates several files. One of the *.cpp files will be the name of your project. For example, frmMain.cpp. If you open this file up you will see something like this:
Code:
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
//---------------------------------------------------------------------------
USEFORM("Unit1.cpp", frmMain);
//---------------------------------------------------------------------------
WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
{
try
{
Application->Initialize();
Application->Title = "Form Name";
Application->CreateForm(__classid(frmMain), &frmMain);
Application->Run();
}
catch (Exception &exception)
{
Application->ShowException(&exception);
}
catch (...)
{
try
{
throw Exception("");
}
catch (Exception &exception)
{
Application->ShowException(&exception);
}
}
return 0;
}
//---------------------------------------------------------------------------
This is the main c++ file. Rarely do you need to change this. The only time I've ever changed it was to set up mutexes.
The program that you change are normally named Unit1.cpp and Unit1.h (unless you rename them when you save the project). I always rename them but it isn't necessary.
In your Unit1.h are the declarations that the header uses. Essentially, Unit1 is a class declaration. When I create a function in my C++ file, I put its declaration in the unit's *.h file. In this file, there will be a private and public section for the class. I always put my functions' declarations in here, usually in the private section.
Code:
private: // User declarations
void StringGridClear(TStringGrid *StringGrid1);
public: // User declarations
__fastcall TFrmMain(TComponent* Owner);
Also, in the body of the C++ file, I would change
Code:
void StringGridClear(TStringGrid *StringGrid1)
{
...}
to
Code:
void TFrmMain::StringGridClear(TStringGrid *StringGrid1)
{
...
}
See if that helps.
James P. Cottingham
-----------------------------------------
I'm number 1,229!
I'm number 1,229!