Jump to content


  • Content Count

  • Joined

  • Last visited

Everything posted by bernhard_LA

  1. I'm almost sure that I already used the code below without any issues in previous application. Now a added this to a new app and dumped the Loadstring variable into a memo with memo.lines.add ( Loadstring ) ; All text is now displayed using chines char's , the file I#m reading for sure is ASCII and only latin chars ..... What went wrong ? var LoadString: AnsiString; FS: TFileStream; begin FS := TFileStream.Create(FileName, fmOpenRead or fmShareDenyNone); try SetLength(LoadString, (FS.Size div SizeOf(Char))); if FS.Size > 0 then FS.Read(Pointer(LoadString)^, FS.Size); finally FS.Free ;
  2. bernhard_LA

    Shellexecute @ UBUNTU platform

    I need a solution to replace the shellexecute command for the windows platform If possible no external / 3rd party lib involved Can someone provide a working code here ?
  3. thanks for helping - found also my mistake : after change from var LoadString: String; to var LoadString: AnsiString; code is working, with a typecast String(Loadstring) ; but now different issue .... this will now work for compiling under LINUX 😞
  4. bernhard_LA

    Shellexecute @ UBUNTU platform

    Basic Wish a) just start a executeable like ./myapplication and pass also command line parameters Advanced Wish b) a notification once the ./myappliaction is finished work around i) any solution using RAD C++ and Linux compile options ?? ii) call a phyton script from Delphi ???? iii) a dll written in Lazarus ?????
  5. the windows GUI code for a simple INDY 10 tcp demo comes from here : https://github.com/tinydew4/indy-project-demos/tree/master/TCPIP Delphi %26 Indy10 Client Server Demo/1_sample Simple String Exchange I used this code to run the server in a cmd line application, but I fail with the function pointer assignment, what is the correct syntax I need here see the current not working code below program IndyConsoleApp; {$APPTYPE CONSOLE} {$R *.res} uses System.SysUtils, IdContext, IdSync, IdBaseComponent, IdComponent, IdCustomTCPServer, IdTCPServer, IdGlobal; type OnTCPServerExecutefct = procedure (AContext: TIdContext) of Object ; var IdTCPServer1: TIdTCPServer; TCPServerExecutefct : OnTCPServerExecutefct; procedure ShowStartServerdMessage; begin writeln('START SERVER @' + TimeToStr(now)); end; procedure StopStartServerdMessage; begin writeln('STOP SERVER @' + TimeToStr(now)); end; procedure TCPServerExecute(AContext: TIdContext); var LLine: String; begin TIdNotify.NotifyMethod( ShowStartServerdMessage ); // wrong LLine := AContext.Connection.IOHandler.ReadLn(); writeln(LLine); AContext.Connection.IOHandler.WriteLn('OK'); TIdNotify.NotifyMethod( StopStartServerdMessage ); end; begin IdTCPServer1:=TIdTCPServer.Create; try { TODO -oUser -cConsole Main : Insert code here } IdTCPServer1.Bindings.Add.IP := ''; IdTCPServer1.Bindings.Add.Port := 6000; IdTCPServer1.OnExecute := TCPServerExecute ; /// wrong ! // TCPServerExecutefct:= assign(TCPServerExecute); readln ; except on E: Exception do Writeln(E.ClassName, ': ', E.Message); end; end.
  6. I want to evaluate the pressed button on a form with this code below, my form (aForm) should have 2 buttons which the property mrOK. If aForm.modalresult = mrOK then begin /// now evaluate which button has been pressed ??? .... .... end; what is the best solution for this issue?
  7. bernhard_LA

    best practise sharing : 2 buttons with mrOK on a form

    yes ... added simple integer values to the modalresult property, seems to work now