shell does not work on Widnwos Vista

classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

shell does not work on Widnwos Vista

satimis
Hi folks,

mono
Windows Vista
Mono for Windows, Gtk#, and XSP

I have a shell.exe file created on mono gui running on Debian 5.0.  It works nicely on Debian 5.0 as well as on another Linux box running Ubuntu 9.10.

$ mono /path/to/shell.exe

starts a small window.  On its top box type "firefox www.mono-project.com" (without quotes") -> Run
starts the official website of mono-project.com


However it can't work on Vista.

Start -> Mono 2.6.3 for Windows -> Mono-2.6.3 Command Prompt

C>mono \path\to\shell.exe

Starts the small window -> on top box, type "firefox www.mono-project.com" (without quote) ->
The said small window closes.  Following are the output on mono-2.6.3 command prompt

Marshaling clicked signal
Exception in Gtk# callback delegate
  Note: Applications can use GLib.ExceptionManager.UnhandledException to handle
the exception.
System.Reflection.TargetInvocationException: Exception has been thrown by the ta
rget of an invocation. ---> System.ComponentModel.Win32Exception: ApplicationNam
e='firefox', CommandLine='www.mono-project.com', CurrentDirectory=''
  at System.Diagnostics.Process.Start_noshell (System.Diagnostics.ProcessStartIn
fo startInfo, System.Diagnostics.Process process) [0x00000] in <filename unknown
>:0
  at System.Diagnostics.Process.Start_common (System.Diagnostics.ProcessStartInf
o startInfo, System.Diagnostics.Process process) [0x00000] in <filename unknown>
:0
  at System.Diagnostics.Process.Start () [0x00000] in <filename unknown>:0
  at (wrapper remoting-invoke-with-check) System.Diagnostics.Process:Start ()
  at MainWindow.onButtonRunClicked (System.Object sender, System.EventArgs e) [0
x00000] in <filename unknown>:0
  at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (ob
ject,object[],System.Exception&)
  at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invoke
Attr, System.Reflection.Binder binder, System.Object[] parameters, System.Global
ization.CultureInfo culture) [0x00000] in <filename unknown>:0
  --- End of inner exception stack trace ---
  at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invoke
Attr, System.Reflection.Binder binder, System.Object[] parameters, System.Global
ization.CultureInfo culture) [0x00000] in <filename unknown>:0
  at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] par
ameters) [0x00000] in <filename unknown>:0
  at System.Delegate.DynamicInvokeImpl (System.Object[] args) [0x00000] in <file
name unknown>:0
  at System.MulticastDelegate.DynamicInvokeImpl (System.Object[] args) [0x00000]
 in <filename unknown>:0
  at System.Delegate.DynamicInvoke (System.Object[] args) [0x00000] in <filename
 unknown>:0
  at GLib.Signal.ClosureInvokedCB (System.Object o, GLib.ClosureInvokedArgs args
) [0x00000] in <filename unknown>:0
  at GLib.SignalClosure.Invoke (GLib.ClosureInvokedArgs args) [0x00000] in <file
name unknown>:0
  at GLib.SignalClosure.MarshalCallback (IntPtr raw_closure, IntPtr return_val,
UInt32 n_param_vals, IntPtr param_values, IntPtr invocation_hint, IntPtr marshal
_data) [0x00000] in <filename unknown>:0
   at GLib.ExceptionManager.RaiseUnhandledException(System.Exception e, Boolean
is_terminal)
   at GLib.SignalClosure.MarshalCallback(IntPtr raw_closure, IntPtr return_val,
UInt32 n_param_vals, IntPtr param_values, IntPtr invocation_hint, IntPtr marshal
_data)
   at Gtk.Application.gtk_main()
   at Gtk.Application.Run()
   at shell.MainClass.Main(System.String[] args)

Please advise how to fix the problem.  TIA


B.R.
Stephen Liu


_______________________________________________
Mono-list maillist  -  [hidden email]
http://lists.ximian.com/mailman/listinfo/mono-list
Reply | Threaded
Open this post in threaded view
|

Re: shell does not work on Widnwos Vista

Jonathan Pobst
On 4/26/2010 11:39 AM, Stephen Liu wrote:
> However it can't work on Vista.
>
> Start ->  Mono 2.6.3 for Windows ->  Mono-2.6.3 Command Prompt
>
> C>mono \path\to\shell.exe
>
> Starts the small window ->  on top box, type "firefox www.mono-project.com" (without quote) ->
> The said small window closes.  Following are the output on mono-2.6.3 command prompt

'firefox' is not a program on Windows.  You will have to find where
firefox.exe is on the target machine, and then use the full path to it.

- Or -

If you just want to open a web page in the user's default browser, use:

Process.Start ("http://www.mono-project.com");

This will work on every system.

Jonathan
_______________________________________________
Mono-list maillist  -  [hidden email]
http://lists.ximian.com/mailman/listinfo/mono-list
Reply | Threaded
Open this post in threaded view
|

Re: shell does not work on Widnwos Vista

satimis
Hi Jonathan,


Thanks for your advice and URL.

I'm now learning mono/GTK# on mono making a cross platform .exe.  The shell.exe which I'm testing is only a test sample created/compiled by me on mono


On Window Vista "Command Prompt"

C:>@start "" /b "C:\Program Files\Internet Explorer\iexplore.exe" %*
IE started without problem


On Mono-2.6.3 Command Prompt run
C:>mono \path\to\shell.exe

It starts the small window. 

On the said window run;
@start "" /b "C:\Program Files\Internet Explorer\iexplore.exe" %*

OR
@start "" /b "C:\Program Files\Internet Explorer\iexplore.exe" www.mono-project.com


The small window crashes with following warnings printed on Mono Command Prompt:-
Marshaling clicked signal
Exception in Gtk# callback delegate
Note: Applications can use GLib.ExceptionManager.UnhandledException to handle
the exception.
System.Reflection.TargetInvocationException: Exception has been thrown by the ta
rget of an invocation. ---> System.ComponentModel.Win32Exception: ApplicationNam
e='@start', CommandLine='""', CurrentDirectory=''
at System.Diagnostics.Process.Start_noshell (System.Diagnostics.ProcessStartIn
fo startInfo, System.Diagnostics.Process process) [0x00000] in <filename unknown
>:0
at System.Diagnostics.Process.Start_common (System.Diagnostics.ProcessStartInf
o startInfo, System.Diagnostics.Process process) [0x00000] in <filename unknown>
:0
at System.Diagnostics.Process.Start () [0x00000] in <filename unknown>:0
at (wrapper remoting-invoke-with-check) System.Diagnostics.Process:Start ()
at MainWindow.onButtonRunClicked (System.Object sender, System.EventArgs e) [0
x00000] in <filename unknown>:0
at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (ob
ject,object[],System.Exception&)
at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invoke
Attr, System.Reflection.Binder binder, System.Object[] parameters, System.Global
ization.CultureInfo culture) [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invoke
Attr, System.Reflection.Binder binder, System.Object[] parameters, System.Global
ization.CultureInfo culture) [0x00000] in <filename unknown>:0
at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] par
ameters) [0x00000] in <filename unknown>:0
at System.Delegate.DynamicInvokeImpl (System.Object[] args) [0x00000] in <file
name unknown>:0
at System.MulticastDelegate.DynamicInvokeImpl (System.Object[] args) [0x00000]
in <filename unknown>:0
at System.Delegate.DynamicInvoke (System.Object[] args) [0x00000] in <filename
unknown>:0
at GLib.Signal.ClosureInvokedCB (System.Object o, GLib.ClosureInvokedArgs args
) [0x00000] in <filename unknown>:0
at GLib.SignalClosure.Invoke (GLib.ClosureInvokedArgs args) [0x00000] in <file
name unknown>:0
at GLib.SignalClosure.MarshalCallback (IntPtr raw_closure, IntPtr return_val,
UInt32 n_param_vals, IntPtr param_values, IntPtr invocation_hint, IntPtr marshal
_data) [0x00000] in <filename unknown>:0
at GLib.ExceptionManager.RaiseUnhandledException(System.Exception e, Boolean
is_terminal)
at GLib.SignalClosure.MarshalCallback(IntPtr raw_closure, IntPtr return_val,
UInt32 n_param_vals, IntPtr param_values, IntPtr invocation_hint, IntPtr marshal
_data)
at Gtk.Application.gtk_main()
at Gtk.Application.Run()
at shell.MainClass.Main(System.String[] args)
- end -
 
 
> If you just want to open a web page in the user's default browser, use:
> Process.Start ("http://www.mono-project.com");

Could you please explain in more detail.  Whether to edit the codes and recompile the same?  Then can the program work on Linux?

TIA

B.R.
satimis


 


----- Original Message ----
From: Jonathan Pobst <[hidden email]>
To: Stephen Liu <[hidden email]>
Cc: [hidden email]
Sent: Tue, April 27, 2010 12:53:08 AM
Subject: Re: [Mono-list] shell does not work on Widnwos Vista

On 4/26/2010 11:39 AM, Stephen Liu wrote:
> However it can't work on Vista.
>
> Start ->  Mono 2.6.3 for Windows ->  Mono-2.6.3 Command Prompt
>
> C>mono \path\to\shell.exe
>
> Starts the small window ->  on top box, type "firefox www.mono-project.com" (without quote) ->
> The said small window closes.  Following are the output on mono-2.6.3 command prompt

'firefox' is not a program on Windows.  You will have to find where
firefox.exe is on the target machine, and then use the full path to it.

- Or -

If you just want to open a web page in the user's default browser, use:

Process.Start ("http://www.mono-project.com");

This will work on every system.

Jonathan



_______________________________________________
Mono-list maillist  -  [hidden email]
http://lists.ximian.com/mailman/listinfo/mono-list
Reply | Threaded
Open this post in threaded view
|

Re: shell does not work on Widnwos Vista

satimis
From: Jonathan Pobst <[hidden email]>
To: Stephen Liu <[hidden email]>
Cc: [hidden email]
Sent: Tue, April 27, 2010 12:53:08 AM
Subject: Re: [Mono-list] shell does not work on Widnwos Vista

On 4/26/2010 11:39 AM, Stephen Liu wrote:

>> However it can't work on Vista.
>>
>> Start ->  Mono 2.6.3 for Windows ->  Mono-2.6.3 Command Prompt
>>
>> C>mono \path\to\shell.exe
>>
>> Starts the small window ->  on top box, type "firefox www.mono-project.com"
>> (without quote) ->
>> The said small window closes.  Following are the output on mono-2.6.3 command
>> prompt

> 'firefox' is not a program on Windows.  You will have to find where
> firefox.exe is on the target machine, and then use the full path to it.

> - Or -

> If you just want to open a web page in the user's default browser, use:

> Process.Start ("http://www.mono-project.com";);

> This will work on every system.


Hi Jonathan,

Sorry your advice can't work here.


Tried follows on my small program;

Process.Start ("http://www.mono-project.com";); -> Run
ProcessStart ("http://www.mono-project.com";); -> Run
Process.Start ("http://www.mono-project.com"); -> Run


On mono Command Prompt, also didn't work.


On Windows Vista, create a shortcut of IE and rename it as;

\Users\satimis\iexplore.lnk


iexplore.lnk works on "Command Prompt" window but didn't work on "mono Command Prompt" nor on my small program.


Stephen L


_______________________________________________
Mono-list maillist  -  [hidden email]
http://lists.ximian.com/mailman/listinfo/mono-list
Reply | Threaded
Open this post in threaded view
|

Re: shell does not work on Widnwos Vista

Christopher David Howie
On 04/27/2010 07:10 AM, Stephen Liu wrote:
> On Windows Vista, create a shortcut of IE and rename it as;
>
> \Users\satimis\iexplore.lnk
>
>
> iexplore.lnk works on "Command Prompt" window but didn't work on "mono Command Prompt" nor on my small program.

The command prompt does a bit of trickery so that you can "run"
shortcuts.  The Windows APIs Mono uses to start programs don't do such
magic.

In short, unless the program is in your PATH, you can't run it without
specifying the full path to it.  This is not any different than on Linux.

(To introduce another side-case, note that Start>Run also looks in the
HKEY_CLASSES_ROOT\Applications registry key.  I'm still not sure exactly
how MS sells this kind of overconfigurability a benefit, but meh.)

In short, Process.Start() is not exactly the best place to experiment
with if your goal is to create a truly cross-platform application, since
it has platform-specific semantics.

--
Chris Howie
http://www.chrishowie.com
http://en.wikipedia.org/wiki/User:Crazycomputers

PGP key:

pub   2048R/CF8338F5 2010-04-14
      Fingerprint: 2B7A B280 8B12 21CC 260A  DF65 6FCE 505A CF83 38F5
_______________________________________________
Mono-list maillist  -  [hidden email]
http://lists.ximian.com/mailman/listinfo/mono-list
Reply | Threaded
Open this post in threaded view
|

Re: shell does not work on Widnwos Vista

satimis
Hi Chris,


> The command prompt does a bit of trickery so that
> you can "run" shortcuts.  The Windows APIs Mono uses
> to start programs don't do such magic.


On Window Vista I have created a shortcuts of IE on;
C:\Program Files\Internet Explorer\iexplore.exe

rename it as iexplorelnk and put it on;
C:\Users\satimis\


Afterwards on "Command Prompt" executing iexplorelnk starts IE.  But on the window of my small program, "shell.exe", it still fails.  However following commands;

cmd
explorer (Windows explorer)
calc (calcultor0
ipconfig
etc.

which work on "Command Prompt" also work on my program.  But on the top box of the small window I must type;

explorer explorer
calc calc
ipconfig ipconfig
etc.

to make them work.  The command must be repeated otherwise the small window will crash.

I can't understand.


Hereinbelow is the code of MainWindow.cs
// MainWindow.cs created with MonoDevelop
// User: satimis at 10:33 AM 4/26/2010
//
// To change standard headers go to Edit->Preferences->Coding->Standard Headers
//
using System;
using Gtk;

public partial class MainWindow: Gtk.Window
{    
    public MainWindow (): base (Gtk.WindowType.Toplevel)
    {
        Build ();
    }
   
    protected void OnDeleteEvent (object sender, DeleteEventArgs a)
    {
        Application.Quit ();
        a.RetVal = true;
    }

    protected virtual void onButtonRunClicked (object sender, System.EventArgs e)
    {
        string[] strCmmd = entry1.Text.Split(' ');
       
        System.Diagnostics.Process process = new System.Diagnostics.Process();
        process.StartInfo.UseShellExecute = false;
        process.StartInfo.RedirectStandardOutput = true;
        process.StartInfo.RedirectStandardInput = true;
        process.StartInfo.RedirectStandardError = true;
       
        process.StartInfo.FileName = strCmmd[0];
        process.StartInfo.Arguments = strCmmd[1];
       
        process.Start();

        textview1.Buffer.Text = process.StandardOutput.ReadToEnd();
       
        process.WaitForExit();
       
       
    }
}
- end -


This is only test created on learning C#

Any advice?  TIA


B.R.
Stephen





----- Original Message ----
From: Christopher David Howie <[hidden email]>
To: Stephen Liu <[hidden email]>
Cc: [hidden email]
Sent: Tue, April 27, 2010 8:26:28 AM
Subject: Re: [Mono-list] shell does not work on Widnwos Vista

On 04/27/2010 07:10 AM, Stephen Liu wrote:
> On Windows Vista, create a shortcut of IE and rename it as;
>
> \Users\satimis\iexplore.lnk
>
>
> iexplore.lnk works on "Command Prompt" window but didn't work on "mono Command Prompt" nor on my small program.

The command prompt does a bit of trickery so that you can "run"
shortcuts.  The Windows APIs Mono uses to start programs don't do such
magic.

In short, unless the program is in your PATH, you can't run it without
specifying the full path to it.  This is not any different than on Linux.

(To introduce another side-case, note that Start>Run also looks in the
HKEY_CLASSES_ROOT\Applications registry key.  I'm still not sure exactly
how MS sells this kind of overconfigurability a benefit, but meh.)

In short, Process.Start() is not exactly the best place to experiment
with if your goal is to create a truly cross-platform application, since
it has platform-specific semantics.

--
Chris Howie
http://www.chrishowie.com
http://en.wikipedia.org/wiki/User:Crazycomputers

PGP key:

pub   2048R/CF8338F5 2010-04-14
      Fingerprint: 2B7A B280 8B12 21CC 260A  DF65 6FCE 505A CF83 38F5



_______________________________________________
Mono-list maillist  -  [hidden email]
http://lists.ximian.com/mailman/listinfo/mono-list
Reply | Threaded
Open this post in threaded view
|

Re: shell does not work on Widnwos Vista

Christopher David Howie
On 04/27/2010 01:17 PM, Stephen Liu wrote:

>> The command prompt does a bit of trickery so that
>> you can "run" shortcuts.  The Windows APIs Mono uses
>> to start programs don't do such magic.
>
>
> On Window Vista I have created a shortcuts of IE on;
> C:\Program Files\Internet Explorer\iexplore.exe
>
> rename it as iexplorelnk and put it on;
> C:\Users\satimis\
>
>
> Afterwards on "Command Prompt" executing iexplorelnk starts IE.  But on the window of my small program, "shell.exe", it still fails.

Based on what I just told you, this is the behavior I would expect.  The
APIs Mono uses do not know what shell links are.  You cannot run shell
links with Process.Start().

> However following commands;
>
> cmd
> explorer (Windows explorer)
> calc (calcultor0
> ipconfig
> etc.
>
> which work on "Command Prompt" also work on my program.  But on the top box of the small window I must type;
>
> explorer explorer
> calc calc
> ipconfig ipconfig
> etc.
>
> to make them work.  The command must be repeated otherwise the small window will crash.

Crash how?  (Hint: If something is crashing, it is almost always helpful
to give us a stack trace, otherwise all we can usually do is guess at
what's wrong.)

--
Chris Howie
http://www.chrishowie.com
http://en.wikipedia.org/wiki/User:Crazycomputers

PGP key:

pub   2048R/CF8338F5 2010-04-14
      Fingerprint: 2B7A B280 8B12 21CC 260A  DF65 6FCE 505A CF83 38F5
_______________________________________________
Mono-list maillist  -  [hidden email]
http://lists.ximian.com/mailman/listinfo/mono-list
Reply | Threaded
Open this post in threaded view
|

Re: shell does not work on Widnwos Vista

Robert Jordan
On 27.04.2010 20:51, Christopher David Howie wrote:
> On 04/27/2010 01:17 PM, Stephen Liu wrote:
>>> The command prompt does a bit of trickery so that
>>> you can "run" shortcuts.  The Windows APIs Mono uses
>>> to start programs don't do such magic.

...

>
> Based on what I just told you, this is the behavior I would expect.  The
> APIs Mono uses do not know what shell links are.  You cannot run shell
> links with Process.Start().

Of course you can.

Robert

_______________________________________________
Mono-list maillist  -  [hidden email]
http://lists.ximian.com/mailman/listinfo/mono-list
Reply | Threaded
Open this post in threaded view
|

Re: shell does not work on Widnwos Vista

Christopher David Howie
On 04/27/2010 03:19 PM, Robert Jordan wrote:
> On 27.04.2010 20:51, Christopher David Howie wrote:
>> Based on what I just told you, this is the behavior I would expect.  The
>> APIs Mono uses do not know what shell links are.  You cannot run shell
>> links with Process.Start().
>
> Of course you can.

Hmm, this has never worked for me.  Perhaps I wasn't doing something
right...

--
Chris Howie
http://www.chrishowie.com
http://en.wikipedia.org/wiki/User:Crazycomputers

PGP key:

pub   2048R/CF8338F5 2010-04-14
      Fingerprint: 2B7A B280 8B12 21CC 260A  DF65 6FCE 505A CF83 38F5
_______________________________________________
Mono-list maillist  -  [hidden email]
http://lists.ximian.com/mailman/listinfo/mono-list
Reply | Threaded
Open this post in threaded view
|

Re: shell does not work on Widnwos Vista

satimis
In reply to this post by Christopher David Howie
Hi Chris,

> Crash how?  

The small window disappears

> (Hint: If something is crashing, it is almost always helpful
> to give us a stack trace, otherwise all we can usually do is guess at
> what's wrong.)

After crashing there printout on the mono "Command Prompt".  Whether you meant that printout.

B.R.
Stephen





----- Original Message ----
From: Christopher David Howie <[hidden email]>
To: Stephen Liu <[hidden email]>
Cc: [hidden email]
Sent: Wed, April 28, 2010 2:51:18 AM
Subject: Re: [Mono-list] shell does not work on Widnwos Vista

On 04/27/2010 01:17 PM, Stephen Liu wrote:

>> The command prompt does a bit of trickery so that
>> you can "run" shortcuts.  The Windows APIs Mono uses
>> to start programs don't do such magic.
>
>
> On Window Vista I have created a shortcuts of IE on;
> C:\Program Files\Internet Explorer\iexplore.exe
>
> rename it as iexplorelnk and put it on;
> C:\Users\satimis\
>
>
> Afterwards on "Command Prompt" executing iexplorelnk starts IE.  But on the window of my small program, "shell.exe", it still fails.

Based on what I just told you, this is the behavior I would expect.  The
APIs Mono uses do not know what shell links are.  You cannot run shell
links with Process.Start().

> However following commands;
>
> cmd
> explorer (Windows explorer)
> calc (calcultor0
> ipconfig
> etc.
>
> which work on "Command Prompt" also work on my program.  But on the top box of the small window I must type;
>
> explorer explorer
> calc calc
> ipconfig ipconfig
> etc.
>
> to make them work.  The command must be repeated otherwise the small window will crash.

Crash how?  (Hint: If something is crashing, it is almost always helpful
to give us a stack trace, otherwise all we can usually do is guess at
what's wrong.)

--
Chris Howie
http://www.chrishowie.com
http://en.wikipedia.org/wiki/User:Crazycomputers

PGP key:

pub   2048R/CF8338F5 2010-04-14
      Fingerprint: 2B7A B280 8B12 21CC 260A  DF65 6FCE 505A CF83 38F5



_______________________________________________
Mono-list maillist  -  [hidden email]
http://lists.ximian.com/mailman/listinfo/mono-list
Reply | Threaded
Open this post in threaded view
|

Re: shell does not work on Widnwos Vista

satimis
In reply to this post by Robert Jordan


----- Original Message ----
From: Robert Jordan <[hidden email]>
To: [hidden email]
Sent: Wed, April 28, 2010 3:19:28 AM
Subject: Re: [Mono-list] shell does not work on Widnwos Vista

On 27.04.2010 20:51, Christopher David Howie wrote:
> On 04/27/2010 01:17 PM, Stephen Liu wrote:
>>> The command prompt does a bit of trickery so that
>>> you can "run" shortcuts.  The Windows APIs Mono uses
>>> to start programs don't do such magic.

...

>>
>> Based on what I just told you, this is the behavior I would expect.  The
>> APIs Mono uses do not know what shell links are.  You cannot run shell
>> links with Process.Start().

> Of course you can.

Hi Robert,

Could you please explain in more detail?  Thanks


B.R.
Stephen

_______________________________________________
Mono-list maillist  -  [hidden email]
http://lists.ximian.com/mailman/listinfo/mono-list



_______________________________________________
Mono-list maillist  -  [hidden email]
http://lists.ximian.com/mailman/listinfo/mono-list