Logout Feature..

  • Thread starter Thread starter VJ
  • Start date Start date
V

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
 
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]
 
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]
 
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]
 
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]
 
Back
Top