By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,024 Members | 2,027 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,024 IT Pros & Developers. It's quick & easy.

C# Interaction.AppActivate Procedure

P: n/a
I want to activate an application (Excel) in code. If I reference
microsoft.visualbasic, I could use:

Interaction.AppActivate("Microsoft Excel");

But I wold rather use a native C# approach. I know that Interaction.MsgBox
has a native analog: MessageBox.Show.

Is there one for AppActivate?
Aug 21 '07 #1
Share this Question
Share on Google+
2 Replies


P: n/a
There is no managed equivalent other than the VB implementation. It
ends up calling SetForegroundWindow, but it does a great deal of other setup
as well (getting the window handle, checking to see if it is enabled, etc,
etc), so you might want to use the class in VB.

Note, the Interaction class in the Microsoft.VisualBasic namespace IS
managed code, and is no less native to .NET than any classes you might use
in the System namespace, or anything else. C# is the language, the glue
that you use for calling existing managed code constructs.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"mr peanut" <mr******@discussions.microsoft.comwrote in message
news:F9**********************************@microsof t.com...
>I want to activate an application (Excel) in code. If I reference
microsoft.visualbasic, I could use:

Interaction.AppActivate("Microsoft Excel");

But I wold rather use a native C# approach. I know that
Interaction.MsgBox
has a native analog: MessageBox.Show.

Is there one for AppActivate?

Aug 22 '07 #2

P: n/a
I see using this approach fails when Excel is minimized.

"Nicholas Paldino [.NET/C# MVP]" wrote:
There is no managed equivalent other than the VB implementation. It
ends up calling SetForegroundWindow, but it does a great deal of other setup
as well (getting the window handle, checking to see if it is enabled, etc,
etc), so you might want to use the class in VB.

Note, the Interaction class in the Microsoft.VisualBasic namespace IS
managed code, and is no less native to .NET than any classes you might use
in the System namespace, or anything else. C# is the language, the glue
that you use for calling existing managed code constructs.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"mr peanut" <mr******@discussions.microsoft.comwrote in message
news:F9**********************************@microsof t.com...
I want to activate an application (Excel) in code. If I reference
microsoft.visualbasic, I could use:

Interaction.AppActivate("Microsoft Excel");

But I wold rather use a native C# approach. I know that
Interaction.MsgBox
has a native analog: MessageBox.Show.

Is there one for AppActivate?


Aug 23 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.