Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Startup with command line options or run program from c++

214 views
Skip to first unread message

jking

unread,
May 27, 2009, 7:26:57 PM5/27/09
to
I'm wanting to run a program (cerdisp.exe) at startup of CE 6.0 R2, and I
want to pass it a "-c" on the command line, so it will start and minimize
itself to the tray.

I've tried using the HKLM\Init key in the registry:
[HKEY_LOCAL_MACHINE\Init]
"Launch76"="cerdisp.exe -c"
but the " -c" at the end seems to keep it from running.

I tried making a batch file which executed "\Windows\cerdisp.exe -c", and
having the project.dat file copy the batch into the \Windows\StartUp
directory. This kinda worked, except it left a command prompt window
maximixed wihle cerdisp was running. If I closed the cmd window, cerdisp was
also closed, and I don't want an extra cmd windows hanging around cluttering
up my task bar.

I also thought I might be able to just write a quick C program to go run
"cerdisisp.exe -c", but I can't find any documentation on how to get C or
C++ to go execute another program.

So, does anyone have an idea of how I can get a program to run at startup,
with command line parameters passed to it?

---
Jeremy

Tom Gensel (eMVP)

unread,
May 27, 2009, 8:25:28 PM5/27/09
to
The only command line argument ever passed to a process started using
a "LaunchXX" value in the Init registry key is the index given to the
Launch value name (i.e. 76 in your case).

Your idea of writing a C program to run cerdisp.exe and supplying the
-c command line argment is good. You can use the CreateProcess API
for this purpose. The documentation for it can be found here -

http://msdn.microsoft.com/en-us/library/aa908775.aspx

Tom Gensel (eMVP)

On Wed, 27 May 2009 17:26:57 -0600, "jking" <jkin...@comcast.net>
wrote:

Michel Verhagen [eMVP]

unread,
May 27, 2009, 8:57:51 PM5/27/09
to
Create a small exe that calls CreateProcess on cerdisp.exe with the
correct parameters and put your exe in the HKLM\Init Launch key. The
Launch key in the registry doesn't allow parameters (because the
programs are called by the system with the parameter set to the number
or the Launch, so in your case: "cerdisp.exe 76"). Make sure you call
SignalStarted _wtol(szCommandLine) as soon as you're ready. This is not
really needed if nothing else is dependent on you, but it's good to do
it anyway (in case another person wants to depend on you later).

Good luck,

Michel Verhagen, eMVP
Check out my blog: http://GuruCE.com/blog

GuruCE
Microsoft Embedded Partner
http://GuruCE.com
Consultancy, training and development services.

Bruce Eitman [eMVP]

unread,
May 28, 2009, 2:19:44 PM5/28/09
to
See
http://geekswithblogs.net/BruceEitman/archive/2008/12/12/windows-ce-automatically-start-application-with-command-line-parameters.aspx

--
Bruce Eitman (eMVP)
Senior Engineer
Bruce.Eitman AT EuroTech DOT com
My BLOG http://geekswithblogs.net/bruceeitman

EuroTech Inc.
www.EuroTech.com

"jking" <jkin...@comcast.net> wrote in message
news:eZVYjKy...@TK2MSFTNGP06.phx.gbl...

0 new messages