Start In & Processes

M

Miro

In VB-2003,

I was wondering if someone can point me in the right direction:

Lets say the user has a shortcut on his desktop to your app.

1. Is there any way to capture what the "Start In" parameter is when the
app loads?
1.1 Is there any way to be able to see this in the Process when you
grab it?

I have ran debugger on the variable 'myProcesses' to see what is all stored
in there,
myProcesses = Process.GetProcessesByName(Trim("SomeApp"))

and I cannot find anywhere where ( and if ) this is stored.

2. Also, I have read in a previous newsgroup posting I can grab extra
Arguments passed into "my application"
using My.Application.CommandLineArgs but is there a way to see
what arguements were used to run
the app through the process ? ( even if it is not an application designed
in VB.net ? )
I cannot find an "Arg" setting in the myProcesses settings it grabs.


The reasoning for all of this:
The user has an app that uses the "Start In" parameter in the shortcut to
point to the data directory. The actual shortcut
points to the exe which is in a different directory.

At certain times of the day my app runs and I want to only kill certain
processes that are running. - This would depend
on the Args passed in, and the data directory they are running off of.

Thanks,

Miro
 
M

Miro

For Question # 2 I am using
txtArgs.Text = System.Environment.CommandLine()
txtPath.Text = System.Environment.CurrentDirectory()
the My.Application.CommandLineArgs will not work as I think I have just
understood it as ( "My" ) is a 2005 vb and im
using 2003.

I use the top txt Example get the start Path and Data directory. But I
still cant figure out a way to get that Information by just the Processes
from a different application.

Miro
 
M

Miro

Someone has posted this as an answer in another forum

Process.StartInfo.WorkingDirectory

so i tested it with this ( below ) and it didnt work:
I let vb compile it, and then made a shortcut to the exe with a
"Start In" of C:\Temp and the txtOther is empty.
Is my code correct ? I did this in the Form.Load

myProcesses = Process.GetProcessesByName(Process.GetCurrentProce
ss.ProcessName)
txtOther.Text = myProcesses(0).StartInfo.WorkingDirectory()


Miro
 

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

Similar Threads


Top