Results 1 to 4 of 4

Thread: I can't find the Interaction.Appactivate [Resolved]

  1. #1

    Thread Starter
    Frenzied Member mar_zim's Avatar
    Join Date
    Feb 2004
    Location
    Toledo Cebu City.
    Posts
    1,416

    Resolved 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.

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    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.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Frenzied Member mar_zim's Avatar
    Join Date
    Feb 2004
    Location
    Toledo Cebu City.
    Posts
    1,416

    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.

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    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.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width