-----------------------------------------------------------

New Message on BDOTNET

-----------------------------------------------------------
From: commander4u
Message 1 in Discussion

  
Hi all, 
I am trying to enable or disable a particular IE window using EnableWindow win32 API 
using P/Invoke in my C# code.. This API requires to pass the handle of the window to 
be disabled or enabled. How can I get the Handle to a particular window? 
I am trying to get all the processes running in my desktop using the 
Process.GetProcesses method and then by knowing the title of the window I am getting 
the handle of the process. but this handle to the process is changing every moment(I 
don't know why) and I think this handle to the process and hanle to the window is 
different thing. the code which I am using is as bellow : 
private void button3_Click(object sender, System.EventArgs e) 
{ 
Process [] allProcs = Process.GetProcessesByName("iexplore");  
 
listBox1.Items.Clear() ; 
foreach(Process ps in allProcs) 
{ 
int index = listBox1.Items.Add( ps.ProcessName + " : " + ps.MainWindowTitle + " : " + 
ps.Handle) ; 
  
}  
} 
private void button4_Click(object sender, System.EventArgs e) 
{ 
if(listBox1.SelectedIndex <= 0) 
{ 
return ; 
} 
int selIndex = listBox1.SelectedIndex ; 
//get the handle of the selected item 
string selItem = (string)listBox1.Items[selIndex] ; 
MessageBox.Show(selItem) ; 
string[] selProcessData = selItem.Split(new char[]{':'}) ; 
int iHnadle = int.Parse( selProcessData[2].ToString().Trim()) ; 
isProcessEnabled = EnableWindow((IntPtr)iHnadle, !(isProcessEnabled)) ; 
} 
} 
  
I think I am much clear about the problem. Can anybody please help me... 
thanks in advance... 
  
regards, 
Ashish

-----------------------------------------------------------

To stop getting this e-mail, or change how often it arrives, go to your E-mail 
Settings.
http://groups.msn.com/bdotnet/_emailsettings.msnw

Need help? If you've forgotten your password, please go to Passport Member Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help

For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact

If you do not want to receive future e-mail from this MSN group, or if you received 
this message by mistake, please click the "Remove" link below. On the pre-addressed 
e-mail message that opens, simply click "Send". Your e-mail address will be deleted 
from this group's mailing list.
mailto:[EMAIL PROTECTED]

Reply via email to