Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Console application (creating dynamically components)

Posted on 2003-03-06
9
Medium Priority
?
419 Views
Last Modified: 2010-04-04
How can I create dynamically component, for example tidtcpserver(indy) when working with console application.
I tried with code below but it doesn't work....

thank you in advance


program Project2;

{$APPTYPE CONSOLE}

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, Spin, XPMan, IdBaseComponent, IdComponent, IdTCPServer,
  IdThreadMgr, IdThreadMgrDefault, ComCtrls,toolwin,extctrls,registry;

var
siet:tidtcpserver;
begin
siet:=tidtcpserver.Create(self);
siet.DefaultPort:=5611;
siet.Active:=true;
end.
 

0
Comment
Question by:Murdoc
  • 4
  • 2
  • 2
  • +1
9 Comments
 
LVL 27

Expert Comment

by:kretzschmar
ID: 8080960
guessing your app will finish shortly

is this all the code?

0
 

Author Comment

by:Murdoc
ID: 8081159
It doesen't matter, i put short code to find out only how to create component dynamically.....
0
 
LVL 17

Accepted Solution

by:
geobul earned 225 total points
ID: 8081808
try

siet:=tidtcpserver.Create(nil);

Regards, Geo
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 3

Expert Comment

by:smurff
ID: 8082263
AS geobul explained, I normally put these into a try..Except section :

siet := TidTcpServer.Create(nil);
 Try
  Try
   siet.Host := MyHost ..... {blah}
   { and other commands }
   Except
   Do something with error message
   end;
 Finally
  Siet.Free;
End;

This is not compilable code but I think you get the picture :)

Regards
Smurff
 
0
 

Author Comment

by:Murdoc
ID: 8088039
thanks for fast and good answer. I'd like to divide this points between geobul and smurf but i can not...:+{{
So i have to give this points to first good answer so don't be mad smurf.All i can do is increase points.

regards
0
 

Author Comment

by:Murdoc
ID: 8088053
P.S. this siet(tidtcpserver) suppose to be shiet...:+}}}
0
 
LVL 3

Expert Comment

by:smurff
ID: 8089260
>so don't be mad smurf

haha dont worry about it. I dont really care about the points :)
Ive learnt so much from this forum over the years and I just like to give something back. geobul has helped me a quite a few times over the years and he deserves every point he gets.

Have a good weekend everyone,
Smurff
0
 
LVL 17

Expert Comment

by:geobul
ID: 8089287
Thank you, Murdoc :-)
0
 

Author Comment

by:Murdoc
ID: 8109474
no problem
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Loops Section Overview
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses

564 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