Passing URL arguments to an exe

B

Bob Willis

I'd be grateful for a little help on this!

I'm invoking an application on the PPC from the browser
using

<a href="file:///Program Files\App1\App1.exe?name=bob"
Activate App...</a>

I want to the application to be able to pick up the url
arguments, but am having a little difficulty!

I've tried the usual approach to command line arguments -
no success.
I thought I'd found the answer with an article by Chris
Sells which included:

AppDomain domain = AppDomain.getCurrentDomain;
object obj = domain.GetData("APP_LAUNCH_URL");
string name=(obj != null ? obj.ToString() :"");

Sadly, this isn't supported in the Compact Framework.

Can anyone point me in the right direction?

Thanks,

Bob
 
L

Lloyd Dupont

I launch IE with the URL as argument ....
here is some copy paste ...

public class PInfo

{

public IntPtr hProcess;

public IntPtr hThread;

public uint dwProcessId;

public uint dwThreadId;

}

[DllImport(KERNEL32, SetLastError=true)]

public static extern int TerminateProcess(

IntPtr hProcess,

uint uExitCode

);

[DllImport(KERNEL32, SetLastError=true)]

public extern static int CreateProcess(

string imageName,

string cmdLine,

IntPtr lpProcessAttributes,

IntPtr lpThreadAttributes,

int boolInheritHandles,

int dwCreationFlags,

IntPtr lpEnvironment,

IntPtr lpszCurrentDir,

byte [] si,

PInfo pi );

public static bool CreateProcess( string ExeName, string CmdLine, out IntPtr
hProcess)

{

PInfo pi = new PInfo();

int ret = CreateProcess(

ExeName,

CmdLine,

IntPtr.Zero,

IntPtr.Zero,

0,

0,

IntPtr.Zero,

IntPtr.Zero,

null,

pi);

hProcess = pi.hProcess;

return ret != 0;

}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top