wbtest.pas 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. program wbtest;
  2. {
  3. Try to start the program from both cli and wb.
  4. If from wb then click also on the icons, arg1.info,
  5. arg2.info and arg3.info.
  6. 11 Nov 2000.
  7. Changed to use MessagBox, to show the workbench
  8. args create an icon for wbtest.
  9. 28 Nov 2002.
  10. [email protected]
  11. }
  12. uses wbargs, amsgbox;
  13. var
  14. i : integer;
  15. dummy : string;
  16. Function IntToStr (I : Longint) : String;
  17. Var
  18. S : String;
  19. begin
  20. Str (I,S);
  21. IntToStr:=S;
  22. end;
  23. begin
  24. if not isconsole then begin
  25. dummy := 'started from wb' +#10;
  26. dummy := dummy + 'The Programs name is: ' + ProgramName +#10;
  27. dummy := dummy + 'Number of args are: ' + inttostr(WBArgCount) +#10;
  28. if WBArgCount > 0 then begin
  29. dummy := dummy + 'And the args are:' +#10;
  30. for i := 1 to WBArgCount do dummy := dummy + 'Arg number ' + inttostr(i) +
  31. ' is: ' + GetWBArg(i) +#10;
  32. end;
  33. dummy := dummy + 'The programs name with GetWBArg(0) is: ' + GetWBArg(0);
  34. MessageBox('FPC WorkBench', dummy, 'Nice');
  35. end else begin
  36. writeln('started fromcli');
  37. writeln('The program name is: ',ProgramName);
  38. writeln('Number of args are: ',ParamCount);
  39. if ParamCount > 0 then begin
  40. writeln('And the args are:');
  41. for i := 1 to ParamCount do writeln('Arg number ',i,' is: ',ParamStr(i));
  42. end;
  43. writeln('The programs name with ParamStr(0) is: ',ParamStr(0));
  44. end;
  45. end.