hey

Discussion in 'Software' started by qx_nerdtronic, Apr 5, 2003.

  1. qx_nerdtronic

    qx_nerdtronic Private E-2

    if I = ("smart") then u=("stupid")
     
  2. iamien

    iamien Cptn "Eh!"

    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;
     
  3. goldfish

    goldfish Lt. Sushi.DC

    Why the random file server/remote control code?
    Ya make it yourself, not concentrating on your other project! tch!
    :D
     
  4. goldfish

    goldfish Lt. Sushi.DC


    u is undeclared identifier
     
  5. Magi Matt

    Magi Matt Private E-2

    well, now. If this program is in BASIC, then it should look like this:

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

MajorGeeks.Com Menu

Downloads All In One Tweaks \ Android \ Anti-Malware \ Anti-Virus \ Appearance \ Backup \ Browsers \ CD\DVD\Blu-Ray \ Covert Ops \ Drive Utilities \ Drivers \ Graphics \ Internet Tools \ Multimedia \ Networking \ Office Tools \ PC Games \ System Tools \ Mac/Apple/Ipad Downloads

Other News: Top Downloads \ News (Tech) \ Off Base (Other Websites News) \ Way Off Base (Offbeat Stories and Pics)

Social: Facebook \ YouTube \ Twitter \ Tumblr \ Pintrest \ RSS Feeds