473,382 Members | 1,665 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

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 2603
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
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
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
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
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
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
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
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
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
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. ...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.