Delphi Pages Forums

Delphi Pages Forums (http://www.delphipages.com/forum/index.php)
-   General (http://www.delphipages.com/forum/forumdisplay.php?f=2)
-   -   FTP - Server without Forms (http://www.delphipages.com/forum/showthread.php?t=17964)

N/A 01-02-2001 01:16 AM

FTP - Server without Forms
 
How to program a ftp - server without
forms. The program size must be very
low (not over 70 kb).

N/A 01-02-2001 05:55 AM

RE: FTP - Server without Forms
 
Happy New Year ... :o)

Create a Console application.

Be sure that you define only neccessary functions and types in your program to decrease the size.


Regards

/Filip

N/A 01-02-2001 08:57 AM

RE: RE: FTP - Server without Forms
 
Can you give my an example, please?

PoseFant 01-02-2001 11:45 PM

Console Application
 
I don't have any FTP examples, but when you create a new project, create a console application, it should be an option.

Or

Program Blablabla;

{$APPTYPE CONSOLE}

You may also use CreateProcess with several Console API calls, but this method is some difficult, but great reading.
Check out the SDK help files ...

Off and on topic again ... :o)

Then ... Every time you use a Types or Functions, check where they are defined.

Example :

Uses SysUtils,Windows, WinSvc, SvcMgr;

This gives you a lot of predefined Types and Functions, but you don't need them all ... :o)

So ... let's say that you only need the DWord Type from Windows.dcu

Example

Uses SysUtils;

Type
DWord = LongWord;

We have now cut of the windows.dcu and having only the needed line for our Type

Ok ...

LongWord is predefined in the compiler so we can't do anything with it ... :o)

Also ... there's a lot of Constants in different dcus ... cut them out ...

Example

Uses SysUtils;

Const
SERVICE_WIN32 = ($00000010 Or $00000020);

Prevents you from having the winsvc.dcu, if you only need the SERVICE_WIN32 Constant.

What about Functions ...

Example :

Uses
SysUtils;

Type
lpCTSTr = PAnsiChar;
DWord = LongWord;
PDWord = ^DWord;
SC_HANDLE = LongInt;

Const
ServiceFile = 'advapi32.dll';

Function OpenSCManager(lpMachinename : lpCTStr; lpDataBaseName : lpCTStr; dwDesiredAccess : DWord) : SC_HANDLE; StdCall; External ServiceFile Name
'OpenSCManagerW';

Function CreateService(hSCManager : SC_HANDLE; lpServiceName : lpCTStr; lpDisplayName : lpCTStr; dwDesiredAccess : DWord; dwServiceTye : DWord; dwStartType : DWord; dwErrorControl : DWord; lpBinaryPathName : lpCTStr; lpLoadOrderGroup : lpCTStr; lpdwTagId : PDWord; lpDependencies : lpCTStr; lpServiceStartName : lpCTStr; lpPassWord : lpCTStr) : SC_HANDLE; StdCall; External ServiceFile Name
'CreateServiceW';


As you can see ... There is a bit of work, but afterall ... it's worth it ... :o)


Good Luck ...

Regards


/Filip


All times are GMT. The time now is 07:29 AM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2019, vBulletin Solutions, Inc.