Launch windows app with no GUI ?

  • Thread starter Thread starter Paul
  • Start date Start date
P

Paul

Hi.

I need to launch a windows application and then send keyboard event to this
process to run certain commands. I've created a COM+ appplication to spawn
and talk to the application which works well however the launched
application always shows the UI where-as I need this to be hidden, even
calling the windowhidden on the process strart info does not work. Does this
somehow need to spawned under a different account process ?

_ProcessInfo = New ProcessStartInfo
_ProcessInfo.WorkingDirectory = node.Item("ProgramDirectory").InnerText
_ProcessInfo.FileName = node.Item("ProgramName").InnerText
_ProcessInfo.Arguments = node.Item("ProgramArguments").InnerText
_ProcessInfo.CreateNoWindow = True
_ProcessInfo.UseShellExecute = False
_ProcessInfo.RedirectStandardOutput = True



Thanks

Paul
 
have you tried to compile it as an exe rather than a winexe

--
Regards

John Timney (Microsoft ASP.NET MVP)
----------------------------------------------
<shameless_author_plug>
Professional .NET for Java Developers with C#
ISBN:1-861007-91-4
Professional Windows Forms
ISBN: 1861005547
Professional JSP 2nd Edition
ISBN: 1861004958
Professional JSP
ISBN: 1861003625
Beginning JSP Web Development
ISBN: 1861002092
</shameless_author_plug>
 
as you are spawing a windows app, it needs to create its window for it to
work (also to implement its window loop logic). you are stuck with this
behavior. you can remove the create window permission (default with asp.net
and sevices) but then the app probably won't run. you will probably need to
a logon on the server so there is a valid desktop. all in all not a good
solution - you should replaces this app with a server based version as soon
as possible.

note: in ProcessStartInfo, the CreateNoWindow is used for console apps and
shell execute, to determine if a new command window should be created.

-- bruce (sqlwork.com)
 
You might want to try also HWND_MESSAGE parameter in SetParent Win32 API.
I never tried it with separate applications though, but it might work. If
you would test this, please notify about results

HTH
Alex
 
The company who write the software already has a package with uses the same
technology so they somehow have managed to hide the window with the same
executable we are using. Is there any way we can hook into the process
launch and find out what the command parameter was when the app was
launched, for example the users, arguments and window details ?
 
After a day of trying to find some code, I've managed to find the code for
using the CreateProcessWithLogonW to launch the process as a different user,
this works launching the program as a given user but the UI output is still
sent back to the windows application, surely this should effectly run in the
new users desktop process. Once it is spawned I need to be able to use the
SendMessage functions to the app to control the keyboard input, so any ideas
would be great
 
It's not clear to me that this will work. The process will run under that other
account in its own window station with a hidden UI, but your program has to be
in the same window station to have a SendMessage work (let alone get a handle to
a window in another window station). Use the Task Scheduler to fire off
notepad.exe under another user account; it will run invisibly, see if you can
get a window handle to do a SendMessage with.

Phil Wilson [MVP Windows Installer]
----
 
Back
Top