Change selected window's title in C# -
this question has answer here:
like said in title want change text of selected window using c#. (not forms/windows have in application) possible?
especially doesent understand, example: open notepad, , notepad selected. click on other window , selected.
selected window? if selected mean active form try this:-
 foreach(form frm in application.openforms)  {             if (frm.topmost)             {                 frm.text = "your title";             }  }   edit: try code. rename title of windows process. have used notepad , wordpad example
private void button1_click(object sender, eventargs e)         {             process[] processes = process.getprocessesbyname("notepad");             if (processes.length > 0)             {                 setwindowtext(processes[0].mainwindowhandle, "this notepad");                 // renaming title of 1st notepad instance                 //processes[0]             }             else             {                 messagebox.show("please start atleast 1 notepad instance..");             }         }          private void button2_click(object sender, eventargs e)         {             process[] processes = process.getprocessesbyname("wordpad");             if (processes.length > 0)             {                 setwindowtext(processes[0].mainwindowhandle, "this wordpad");                 // renaming title of 1st notepad instance                 //processes[0]             }             else             {                 messagebox.show("please start atleast 1 wordpad instance..");             }         }      
Comments
Post a Comment