By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,065 Members | 1,560 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,065 IT Pros & Developers. It's quick & easy.

Logout Feature..

P: n/a
VJ
I am trying to provide a logout feature for my application...This should
close all open windows within my application and display the login screen.
How would Determine what windows are open and close them.

VJ
Nov 20 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
You could use the FindWindow win32 function via pinvoke assuming you know the captions of your windows. You would run into problems if it is possible to have multiple instances of your application running with this solution. You could also keep track of which windows are created by creating a class that keeps track of this information, and have the constuctors for your forms classes add themselves to this class. (make the dispose method remove the form as well). A static method on the "forms tracking" class is probably the easiest way to add / remove the references to your forms.

There might be better ways to do this, but these are a few possible ideas.

Jackson Davis [msft]
--

This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm

Nov 20 '05 #2

P: n/a
You could use the FindWindow win32 function via pinvoke assuming you know the captions of your windows. You would run into problems if it is possible to have multiple instances of your application running with this solution. You could also keep track of which windows are created by creating a class that keeps track of this information, and have the constuctors for your forms classes add themselves to this class. (make the dispose method remove the form as well). A static method on the "forms tracking" class is probably the easiest way to add / remove the references to your forms.

There might be better ways to do this, but these are a few possible ideas.

Jackson Davis [msft]
--

This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm

Nov 20 '05 #3

P: n/a
You could use the FindWindow win32 function via pinvoke assuming you know the captions of your windows. You would run into problems if it is possible to have multiple instances of your application running with this solution. You could also keep track of which windows are created by creating a class that keeps track of this information, and have the constuctors for your forms classes add themselves to this class. (make the dispose method remove the form as well). A static method on the "forms tracking" class is probably the easiest way to add / remove the references to your forms.

There might be better ways to do this, but these are a few possible ideas.

Jackson Davis [msft]
--

This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm

Nov 20 '05 #4

P: n/a
You could use the FindWindow win32 function via pinvoke assuming you know the captions of your windows. You would run into problems if it is possible to have multiple instances of your application running with this solution. You could also keep track of which windows are created by creating a class that keeps track of this information, and have the constuctors for your forms classes add themselves to this class. (make the dispose method remove the form as well). A static method on the "forms tracking" class is probably the easiest way to add / remove the references to your forms.

There might be better ways to do this, but these are a few possible ideas.

Jackson Davis [msft]
--

This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm

Nov 20 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.