?
Solved

Can Console applications use VCL?

Posted on 1999-12-20
5
Medium Priority
?
241 Views
Last Modified: 2010-04-06
In the console applications , can I still use VCL such as NMSMTP and NMPOP3?
0
Comment
Question by:dingcheng
  • 2
  • 2
5 Comments
 
LVL 2

Expert Comment

by:florisb
ID: 2294907
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
 
LVL 20

Expert Comment

by:Madshi
ID: 2294953
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
 
LVL 4

Accepted Solution

by:
Radler earned 150 total points
ID: 2295097
Hi dingcheng,

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

T++, Radler.
0
 
LVL 2

Expert Comment

by:florisb
ID: 2295181
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
 
LVL 4

Expert Comment

by:Radler
ID: 2295599
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

Featured Post

Learn to develop an Android App

Want to increase your earning potential in 2018? Pad your resume with app building experience. Learn how with this hands-on course.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
SQL Database Recovery Software repairs the MDF & NDF Files, corrupted due to hardware related issues or software related errors. Provides preview of recovered database objects and allows saving in either MSSQL, CSV, HTML or XLS format. Ensures recov…
Get the source code for a fully functional Access application shell with several popular security features that Access VBA application developers desire, but find difficult or impossible to figure out how to code. You get the source code for managi…
Suggested Courses
Course of the Month5 days, 20 hours left to enroll

588 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question