Activate a running process?

G

Guest

Current situation:
I have a Menu application that will kick off other applications on a button
press routine (using OpenNETCF.Diagnostics.Process.Start).

This works fine.

Problem:
I want to check memory if any of the applications are running, and if so
then inform the user and then bring that application to the front of the
screen.
How do I bring the application to the front of the screen??????

I'm using CreateToolHelp32Snapshot() to correctly find all of the running
processes in memory, but I'm a bit stumped on how to then make that process
the prime application.

Environment:
Visual Studio .Net 2003, PocketPC V4.20, C#

Any ideas? I'm getting desperate now.
 
G

Guest

You need to find the process' main Window handle, then send it a WM_ACTIVATE
message.

-Chris
 
G

Guest

Ah. Having never used windows messaging before, I don't suppose you know of
any good tutorials on websites that you could point me to?

I'd be eternally grateful.

I'm trying the following and getting nowhere so would need a tutorial to
figure out the mess I'm creating)...
-------CODE---------
ToolHelp.Process[] BobHope = TollHelp.Process.GetProcesses();
foreach( ToolHelp.Process ProcessNames in BobHope)
{
switch ( ProcessNames.ProcessName.ToString().ToLower() )
{
case "window1" :
{
Microsoft.WindowsCE.Forms.Message msg =
Microsoft.WindowsCE.Forms.Message.Create(ProcessNames.Handle, 0x0006, ????,
????);
Microsoft.WindowsCE.Forms.MessageWindow.SendMessage(ref msg);
break;
}
}
}
-----END CODE-----

Hmmm, what goes where the "????"'s are? I ave no idea! Hence need a
tutorial on understanding how these things fit together.

-M.
----===( Sic hoc adfixum in obice legere potes, et liberaliter educatus et
nimis propinquus ades )===----
 
G

Guest

What if I were to simply launch the application again using the
"CreateProcess()" function? I've tried this and as the compact environment
only seems to allow once instance of an application, it seems to bring the
application to the front again.

Are there any dangers to doing things this way?

The application that I'm re-opening appears to be in the same state it was
in when I hid it (i.e. the application opens with the correct tab page
displayed, and the same data in the same form boxes). Am I missing something
or is it really that simple?

-M.
 
G

Guest

Thanks. Looks like I might finally have a solution.

Wonder what annoying problem awaits me next. :blush:)

-M.

----===( Sic hoc adfixum in obice legere potes, et liberaliter educatus et
nimis propinquus ades )===----
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top