473,498 Members | 98 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Launch windows app with no GUI ?

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
Nov 17 '05 #1
7 2609
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>
----------------------------------------------

"Paul" <ma********@hotmail.com.nospam> wrote in message
news:eg**************@TK2MSFTNGP09.phx.gbl...
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

Nov 17 '05 #2
The application we are spawning is not ours, so we cannot do any recompile.

"John Timney (Microsoft MVP)" <ti*****@despammed.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
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>
----------------------------------------------

"Paul" <ma********@hotmail.com.nospam> wrote in message
news:eg**************@TK2MSFTNGP09.phx.gbl...
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


Nov 17 '05 #3
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)

"Paul" <ma********@hotmail.com.nospam> wrote in message
news:#i**************@tk2msftngp13.phx.gbl...
The application we are spawning is not ours, so we cannot do any recompile.
"John Timney (Microsoft MVP)" <ti*****@despammed.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
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>
----------------------------------------------

"Paul" <ma********@hotmail.com.nospam> wrote in message
news:eg**************@TK2MSFTNGP09.phx.gbl...
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



Nov 17 '05 #4
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

"bruce barker" <no***********@safeco.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
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)

"Paul" <ma********@hotmail.com.nospam> wrote in message
news:#i**************@tk2msftngp13.phx.gbl...
The application we are spawning is not ours, so we cannot do any

recompile.

"John Timney (Microsoft MVP)" <ti*****@despammed.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
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>
----------------------------------------------

"Paul" <ma********@hotmail.com.nospam> wrote in message
news:eg**************@TK2MSFTNGP09.phx.gbl...
> 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
>
>



Nov 17 '05 #5
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 ?

"AlexS" <sa***********@SPAMsympaticoPLEASE.ca> wrote in message
news:uq*************@TK2MSFTNGP11.phx.gbl...
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

"bruce barker" <no***********@safeco.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
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)

"Paul" <ma********@hotmail.com.nospam> wrote in message
news:#i**************@tk2msftngp13.phx.gbl...
The application we are spawning is not ours, so we cannot do any

recompile.

"John Timney (Microsoft MVP)" <ti*****@despammed.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
> 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>
> ----------------------------------------------
>
> "Paul" <ma********@hotmail.com.nospam> wrote in message
> news:eg**************@TK2MSFTNGP09.phx.gbl...
> > 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
> >
> >
>
>



Nov 17 '05 #6
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

"bruce barker" <no***********@safeco.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
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)

"Paul" <ma********@hotmail.com.nospam> wrote in message
news:#i**************@tk2msftngp13.phx.gbl...
The application we are spawning is not ours, so we cannot do any

recompile.

"John Timney (Microsoft MVP)" <ti*****@despammed.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
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>
----------------------------------------------

"Paul" <ma********@hotmail.com.nospam> wrote in message
news:eg**************@TK2MSFTNGP09.phx.gbl...
> 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
>
>



Nov 17 '05 #7
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]
----
"Paul" <ma********@hotmail.com.nospam> wrote in message
news:uG**************@TK2MSFTNGP09.phx.gbl...
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

"bruce barker" <no***********@safeco.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
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)

"Paul" <ma********@hotmail.com.nospam> wrote in message
news:#i**************@tk2msftngp13.phx.gbl...
The application we are spawning is not ours, so we cannot do any

recompile.

"John Timney (Microsoft MVP)" <ti*****@despammed.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
> 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>
> ----------------------------------------------
>
> "Paul" <ma********@hotmail.com.nospam> wrote in message
> news:eg**************@TK2MSFTNGP09.phx.gbl...
> > 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
> >
> >
>
>



Nov 17 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
5189
by: Caroline | last post by:
I'd like to launch an executable file from a web page. Basically, the user enters seven parameters and then clicks a button to generate a graph. The input is written to a file and then read by...
3
2886
by: Michel H | last post by:
Hello everyone, While it seems simple to me, I just want to have a URL in my windows application that people can click and then launch the URL in the default browser. Same thing with a mailto:...
1
5896
by: Michael Howes | last post by:
I have a c# windows form that talks to a web service on a server that then can talk to multiple "agents" on different machines using web service calls. I want to be able to launch an application...
8
3647
by: Paul | last post by:
I have looked and looked for this info. All the I/O examples I've found either explicity use a file name or use the OpenFileDialog. When you drag a MS Word document over MS Word, it launches and...
4
20820
by: Joe | last post by:
I created a CustomAction for this but I don't think I have it in the right place. I tried both Install and Commit but neither allow it to get to the final screen. Are there any examples of this...
6
9629
by: Francois Bonzon | last post by:
Any idea how I can launch a background task from a PHP script? For example, when a user posts on my message board, it may fire many e-mail notifications to other users, and other tasks. I want...
5
1987
by: stef mientki | last post by:
hello, I'm trying to launch a windows application, but as many others on this list, I've some trouble. I read some other threads about this topic, but sorry, I still don't understand all this...
2
1382
by: =?Utf-8?B?YmVubnlnaQ==?= | last post by:
I can't launch iTunes 7.6 using Windows Vista Ultimate. I was using it and it was working fine until it froze up. I ended the task and now it won't launch at all. Things I have tried: 1. ...
6
2610
by: tempnode | last post by:
I have a problem that I can't seem to solve: I need to write a C++ app that will run off of a floppy. Basically, I will boot into DOS (from a floppy), and run my executable from the floppy. ...
0
7163
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7200
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7375
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
4904
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3090
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3078
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1416
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
651
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
287
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.