Get spawned process

  • Thread starter Thread starter Kevin
  • Start date Start date
K

Kevin

I have an application that handles datascraping with a TN3270 session.
The TN3270 session is opened with a .ws profile and pcomstrt.exe. The
process string in the application is this:

psSession = New Process
psSession.StartInfo.FileName = path\to\pcomstrt.exe
psSession.StartInfo.Arguments = "/P="path\to\ws file & " /S=X /Q"

The /P specifies the .ws file to load, the /S=X specifies that the
session letter should be X, and i forgot what Q is, but if its needed i
can look it up quick.

This command starts a Windows command prompt to execute pcomstrt.exe,
which is a console-based application, and pcomstrt.exe then starts
pcsws.exe with the specified params. Because the initial process is
already closed, I can't use psSession.Close to close the newly created
window, and my attempts to close by Window Title have thus far failed.
Is there a way to get the newly spawned process ID? Please note that
there are several windows opened at any given time with different
session letters, but all the same application - pcsws.exe, making it a
little difficult to use GetProcessByName.
 
Kevin said:
This command starts a Windows command prompt to execute pcomstrt.exe,
which is a console-based application, and pcomstrt.exe then starts
pcsws.exe with the specified params. Because the initial process is
already closed, I can't use psSession.Close to close the newly created
window, and my attempts to close by Window Title have thus far failed.
Is there a way to get the newly spawned process ID? Please note that
there are several windows opened at any given time with different
session letters, but all the same application - pcsws.exe, making it a
little difficult to use GetProcessByName.

Two quick thoughts that might work.

1. Can you bypass the middle man and start pcsws.exe directly, passing
in the appropriate parameters?

2. If you use GetProcessByName on pcsws.exe, you might be able to
check the StartInfo property of the Process object and see what
Arguments it was started with.

Hope this helps

Chris
 
Chris said:
Two quick thoughts that might work.

2. If you use GetProcessByName on pcsws.exe, you might be able to
check the StartInfo property of the Process object and see what
Arguments it was started with.

Scratch Item 2. I just tried it and it does not work.
 
Yeah there isnt a way to specify the host session session by loading up
pcsws.exe, and this particular application looks for the letter X
specifically. Although, I'm hearing rumours that Personal
Communications may be going away altogether with my employer moving to
a new system, so this may be a moot point anyway.
 
Back
Top