How to close the window using its Window Handle.
-
Hi I am developing a windows application which is having login and other pages as winforms. In the login page I having an option for the user to change his password. If i click that change password button Im openning the change password URL in a webbrowser control. In that user will be asked to first login, and after login user will directed to change Password screen. But when the user logged in and closed that window and if the user clicks again the changepassword button then webbrowser control directing hime to change password screen instead of Login page. (is like kinda cached page). but i tried of clearing cache, used Activex control nothing works out. Finally i saw the everytime i open the URL usign webbrowser control it is creating a Hidden IE window. (usign spy++). so that webbrowser is directing to the alredy opened page. How to close that hidden window? can i use its handle to close that one or any other solution here? Thanks in Advacne Srini
-
Hi I am developing a windows application which is having login and other pages as winforms. In the login page I having an option for the user to change his password. If i click that change password button Im openning the change password URL in a webbrowser control. In that user will be asked to first login, and after login user will directed to change Password screen. But when the user logged in and closed that window and if the user clicks again the changepassword button then webbrowser control directing hime to change password screen instead of Login page. (is like kinda cached page). but i tried of clearing cache, used Activex control nothing works out. Finally i saw the everytime i open the URL usign webbrowser control it is creating a Hidden IE window. (usign spy++). so that webbrowser is directing to the alredy opened page. How to close that hidden window? can i use its handle to close that one or any other solution here? Thanks in Advacne Srini
[DllImport("user32.dll")]
static extern bool CloseWindow(IntPtr hWnd);[DllImport("user32.dll")]
static extern System.IntPtr FindWindow(string lpClassName, string lpWindowName);private void button1_Click(object sender, EventArgs e)
{
string lpClassName = "WindowClass1";
string lpWindowName = "MyWindow1";IntPtr hWnd = FindWindow(lpClassName, lpWindowName);
CloseWindow(hWnd);
} -
[DllImport("user32.dll")]
static extern bool CloseWindow(IntPtr hWnd);[DllImport("user32.dll")]
static extern System.IntPtr FindWindow(string lpClassName, string lpWindowName);private void button1_Click(object sender, EventArgs e)
{
string lpClassName = "WindowClass1";
string lpWindowName = "MyWindow1";IntPtr hWnd = FindWindow(lpClassName, lpWindowName);
CloseWindow(hWnd);
}