C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !




Bring the window to Front and set It Active window using c#


Posted Date: 30 Jan 2008    Resource Type: Code Snippets    Category: Application windows, menus & toolbars

Posted By: Mohan Kumar       Member Level: Diamond
Rating:     Points: 5



using this Fucntion we can Bring the window to Front and set It Active window. i'm using win API .


[DllImport("User32.dll")]
public static extern Int32 SetForegroundWindow(int hWnd);

[DllImport("user32.dll")]
public static extern int FindWindow(string lpClassName, string lpWindowName);

private void BringToFront(string className,string CaptionName)
{
SetForegroundWindow(FindWindow(className,CaptionName));
}



private void Form1_Load(object sender, EventArgs e)
{

BringToFront("Notepad", "Untitled - Notepad");

}





Responses

Author: Victor Birin    24 Feb 2008Member Level: Bronze   Points : 0
You don't need to use FindWindow call. Just replace in with Handle.ToInt32();

result

SetForegroundWindow(Handle.ToInt32());


Feedbacks      
Popular Tags   What are tags ?   Search Tags  
(No tags found.)

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: hide the TaskBar using FindWindow API
Previous Resource: Display CurrentLine in RichText Box
Return to Discussion Resource Index
Post New Resource
Category: Application windows, menus & toolbars


Post resources and earn money!
 
Related Resources



dotNet Slackers   BizTalk Adaptors    Web Design

audio conferencing services

Contact Us    Privacy Policy    Terms Of Use