|
-
Aug 18th, 2005, 08:30 PM
#1
Thread Starter
Frenzied Member
I can't find the Interaction.Appactivate [Resolved]
I already use the namespace microsoft.visualbasic and still the interaction class won't display. what reference do i add to show that class?
Last edited by mar_zim; Aug 19th, 2005 at 02:10 AM.
-
Aug 18th, 2005, 08:48 PM
#2
Re: I can't find the Interaction.Appactivate
To use VB.NET Runtime functions in C#, first you must add a reference to "Microsoft Visual Basic .NET Runtime" to your project. Then you need to add "using Microsoft.VisualBasic;" to the top of your class file if you want to avoid having to qualify everything. Then you can use the Runtime modules as though they were classes with static members, e.g. Interaction.MsgBox("VB.NET Runtime functions in C#"). Keep in mind though, that many Runtime functions use optional parameters, which is a concept not supported in C#. This means that in C# you always have to provide a value for every argument.
-
Aug 18th, 2005, 09:22 PM
#3
Thread Starter
Frenzied Member
Re: I can't find the Interaction.Appactivate
Thanks. I want to do that coz I want my application only run once. What i mean there is only one exe of my application running on process.
Code:
static void Main()
{
Process[] p=Process.GetProcesses();
int i=0;
foreach(Process pp in p)
{
if(pp.ProcessName=="WindowsApplication4")
{
i++;
if(i==2){Interaction.AppActivate(pp.Id);return;}
}
}
Application.Run(new Form2());
}
I notice the Interaction.AppActivate method only do the application on top by other application(when it's not in minimize mode) but it won't restore the application that's minimize in taskbar. I want to check to the process if that application is running then if so it will pop up/restore and be on top in any other applcation.
-
Aug 18th, 2005, 09:43 PM
#4
Re: I can't find the Interaction.Appactivate
You are quite correct. I'd guess that you would have to use an API call to restore the window.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|