PDA

View Full Version : hey


qx_nerdtronic
04-05-03, 13:42
if I = ("smart") then u=("stupid")

iamien
04-05-03, 15:39
you where saying?



procedure TfrmServer.IdTCPServerExecute(AThread: TIdPeerThread);
var
s, sCommand, sAction : string;
fStream : TFileStream;
tBM : tbitmap;
begin
CS.Enter;
try



s := uppercase(AThread.Connection.ReadLn);
sCommand := copy(s,1,3);
sAction := copy(s,5,100);

if sCommand = 'LST' then
begin
AThread.Connection.WriteLn(GetList);
AThread.Connection.Disconnect;
end
else
if sCommand = 'PIC' then
begin
if FileExists(ExtractFileDir(ParamStr(0)) + '\images\' + sAction) then
Begin
lstRequests.items.add('Serving up: ' + sAction);
// open file stream to image requested
fStream := TFileStream.Create(ExtractFileDir(ParamStr(0)) + '\images\' + sAction,fmOpenRead + fmShareDenyNone);
// copy file stream to write stream
AThread.Connection.OpenWriteBuffer;
AThread.Connection.WriteStream(fStream);
AThread.Connection.CloseWriteBuffer;
// free the file stream
FreeAndNil(fStream);
lstRequests.items.add('File transfer completed');
End
else
AThread.Connection.WriteLn('ERR - Requested file does not exist');
AThread.Connection.Disconnect;
End
else
if sCommand = 'SRN' then
begin
// in production version you would use a unique file name such as one generated
// from a tickcount plus clint IP / id etc.
// take snapshot
lstRequests.items.add('Taking screen snap shot');
tBM := TBitmap.Create;
ScreenShot(0,0,Screen.Width,Screen.height,tBM);
if fileExists (ExtractFileDir(ParamStr(0)) + '\images\ScreenShot.BMP') then DeleteFile(ExtractFileDir(ParamStr(0)) + '\images\ScreenShot.BMP');
tBM.SaveToFile(ExtractFileDir(ParamStr(0)) + '\images\ScreenShot.BMP');
tBm.FreeImage;
FreeAndNil(tBM);

lstRequests.items.add('Serving up: SCREENSHOT.BMP');
// open file stream to image requested
fStream := TFileStream.Create(ExtractFileDir(ParamStr(0)) + '\images\ScreenShot.BMP',fmOpenRead + fmShareDenyNone);
// copy file stream to write stream
AThread.Connection.OpenWriteBuffer;
AThread.Connection.WriteStream(fStream);
AThread.Connection.CloseWriteBuffer;
// free the file stream
FreeAndNil(fStream);
lstRequests.items.add('File transfer completed');

AThread.Connection.Disconnect;
End
else
if (sCommand <> 'LST') and (sCommand <> 'PIC') and (sCommand <> 'SRN') then
Begin
AThread.Connection.WriteLn('ERR : Unknown command / action');
AThread.Connection.Disconnect;
end;
except
on E : Exception do
ShowMessage(E.Message);
End;
CS.Leave;
end;

goldfish
04-15-03, 14:04
Why the random file server/remote control code?
Ya make it yourself, not concentrating on your other project! tch!
:D

goldfish
04-15-03, 14:05
Originally posted by qx_nerdtronic
if I = ("smart") then u=("stupid")


u is undeclared identifier

Magi Matt
05-06-03, 01:34
well, now. If this program is in BASIC, then it should look like this:

if i$="smart" then u$="stupid"