Determine command line parameters from invoked Desktop session

I am actually hoping to get feedback from the original contributors to question Q_26726314.  I am attempting to use a C# variation of the ServiceShell class posted by egl1044 -- unfortunately I cannot get this to work with a Delphi application. Please see Q_26917602 for details.

Many thanks.
brenlexAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

BdLmCommented:

the code goes like that :



 for i:= 0 to paramcount do
    begin
    ///  KEYWORD : debug
    if LowerCase(ParamStr(i)) = 'debug' then

    end;


if it does not work for you :


      *  where do you execute that code ?    form.create ?

      *   can you post a bit of your code to help you on ?
0
brenlexAuthor Commented:
Please see Q_26917602 for further info.

Essentially my Delphi app is a long standing application which processes command line parameters OK when firing up normally (from command line, from batch file, from various shell execute methods in other executables etc), however when trying to launch the same Delphi app using the ServiceShell class my paramcount is always 0.  I know I am passing arguments OK from ServiceShell as it works with other apps, such as notepad.
0
BdLmCommented:
made a small demo with shell execute -> working on my computer
------------------------- send parmeters -------------------------------

unit Unit1_xxpas;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ShellApi;

type
  TForm1 = class(TForm)
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin

        ShellExecute(Handle, nil, 'e:\delphiapp.exe', '/n,/e,    param#1  c:\test\dummy.txt    param#2  c:\\test\\test.txt   parmam#3   anystring??? ', 'c:\temp\', SW_NORMAL);
end;

end.


--------------------------------------------   show cmd parmeters ----------------------

unit Unit_cmdline;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TForm1 = class(TForm)
    Memo1: TMemo;
    procedure FormShow(Sender: TObject);
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.FormShow(Sender: TObject);
var  i    : Integer;
begin
   for i:= 0 to paramcount do
      begin

       memo1.lines.add ( LowerCase(ParamStr(i))) ;

      end;
end;

end.

Open in new window

0
BdLmCommented:
see screnn dump for results
ee-cmd-.PNG
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
brenlexAuthor Commented:
Awarding points based on BdLm comments in Q_26917602.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.