Can Console applications use VCL?

In the console applications , can I still use VCL such as NMSMTP and NMPOP3?
dingchengAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

florisbCommented:
Yes, f.e.

After including Psock and NMsmtp to your uses list, you can add a var:
NMSMTP1: TNMSMTP;

It will work the same as if you dropped the component on the form.

Floris.


0
MadshiCommented:
Floris is right, but you have to create an instance of the component yourself (normally this is done by dropping the component on your form). Something like this:

  NMSMTP1 := TNMSMTP.Create(...);

Now you can use it.

Regards, Madshi.
0
RadlerCommented:
Hi dingcheng,

How these specifics components aren't visual, you can droped them at a DataModule in Delphi4.

T++, Radler.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
florisbCommented:
Datamodule = unneccesairy overhead I expect.

Madshi is right too. To make it complete: use it like the tstringlist example in the Delphi help; with a free...:-)

procedure TForm1.FormCreate(Sender: TObject);

var
  MyList: TStringList;
  Index: Integer;
begin
  MyList := TStringList.Create;
  try
    MyList.Add('Animals');
    MyList.Add('Flowers');

    MyList.Add('Cars');

    MyList.Sort;   { Find will only work on sorted lists! }
    if MyList.Find('Flowers', Index) then
    begin
      ListBox1.Items.AddStrings(MyList);
      Label1.Caption := 'Flowers has an index value of ' + IntToStr(Index);
    end;
  finally
  MyList.Free;
  end;
end;
0
RadlerCommented:
Hi Flor,

Datamodules, haven a specific function. If you have many components and/or properties to set. If you want modularity over OOP concepts, this is the right way.
I my use, I prefer manualy create the instances and change the properties values. But when doing a WEB app is inevitabily the use of Datamodules.

T++, Radler.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.