Bring anothe app to the front and an "Inside Application.Run" question

A

Academia

I tried the code at the end of this note although

I didn't think it would work since

without and "Application.Run.."

I'm thinking there is no message loop

as I had found this on the internet:

This is a Win32 message (or wait loop)

while (GetMessage(&msg, NULL, 0, 0))

{

TranslateMessage(&msg);

DispatchMessage(&msg);

}

but in .NET, Application.Run is used instead,

it calls those same functions internally.

Some explanation of what is going on would be appreciated!

========================

What I need to know for my code is:

How to make another process come to the front.

I'd ask in the message box if I should bring the other app to the front.

If I can't bring it to the front can I flash it's title bar?

========================

THANKS



///

Using mutx As New Mutex(True, "App", mutexWasCreated)

If Not mutexWasCreated Then

MessageBox.Show("Can Not Start App", "App is already running",
MessageBoxButtons.OK, MessageBoxIcon.Exclamation)

Return 1

End If

///
 
A

Armin Zingler

Academia said:
I tried the code at the end of this note although

I didn't think it would work since

without and "Application.Run.."

I'm thinking there is no message loop

as I had found this on the internet:

This is a Win32 message (or wait loop)

while (GetMessage(&msg, NULL, 0, 0))

{

TranslateMessage(&msg);

DispatchMessage(&msg);

}

but in .NET, Application.Run is used instead,

it calls those same functions internally.

Some explanation of what is going on would be appreciated!


Internally, the API function MessageBox is called. It is a modal dialog box:

http://msdn2.microsoft.com/en-us/library/ms644994(VS.85).aspx#modal_boxes

Read the 6th paragraph, stating that the system starts its own message loop.


Armin
 
A

Academia

I'd need another way to find the handle of the other process since I change
the MainWindowTitle depending on what the user is doing.



Thanks
 
A

Academia

That was interesting.
Especially the comments about dialog box owners.
I don't think I've been specifying the owner.

thanks
 

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