I want to write a program that will create a GUI on the fly based on commands it receives from another program. I created a new application in Borland C++Builder 6. It creates the standard form. I tried to add an edit control to the form without using the designer. I tried the following:
#include <vcl.h>
#pragma hdrstop
TEdit *Edit2;
TComponent *AOwner;
//---------------------------------------------------------------------------
USEFORM("Unit1.cpp", Form1);
//---------------------------------------------------------------------------
WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
{
try
{
Application->Initialize();
Application->CreateForm(__classid(TForm1), &Form1);
Edit2 = new TEdit(AOwner);
Edit2->Enabled = true;
Edit2->Name = "Edit2";
Edit2->Height = 21;
Edit2->Left = 360;
Edit2->Text = "Edit2";
Edit2->Top = 152;
Edit2->Visible = true;
Edit2->Width = 177;
Application->Run();
}
catch (Exception &exception)
{
Application->ShowException(&exception);
}
catch (...)
{
try
{
throw Exception("");
}
catch (Exception &exception)
{
Application->ShowException(&exception);
}
}
return 0;
}
The program runs but no edit control appears on the screen. Can anyone help me with this?
Thank you very much.
#include <vcl.h>
#pragma hdrstop
TEdit *Edit2;
TComponent *AOwner;
//---------------------------------------------------------------------------
USEFORM("Unit1.cpp", Form1);
//---------------------------------------------------------------------------
WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
{
try
{
Application->Initialize();
Application->CreateForm(__classid(TForm1), &Form1);
Edit2 = new TEdit(AOwner);
Edit2->Enabled = true;
Edit2->Name = "Edit2";
Edit2->Height = 21;
Edit2->Left = 360;
Edit2->Text = "Edit2";
Edit2->Top = 152;
Edit2->Visible = true;
Edit2->Width = 177;
Application->Run();
}
catch (Exception &exception)
{
Application->ShowException(&exception);
}
catch (...)
{
try
{
throw Exception("");
}
catch (Exception &exception)
{
Application->ShowException(&exception);
}
}
return 0;
}
The program runs but no edit control appears on the screen. Can anyone help me with this?
Thank you very much.