Microsoft Developer Network > 포럼 홈 > Visual C# General > Application in System Tray
질문하기질문하기
 

답변됨Application in System Tray

  • 2009년 11월 4일 수요일 오후 6:01vjsakec99 사용자 메달사용자 메달사용자 메달사용자 메달사용자 메달
     
    I have a windows application when I press the X button to close the application I want it still running in system tray. How can I go about it? I am using the Notify but I cannot work it out.
    Varun

답변

  • 2009년 11월 4일 수요일 오후 6:51BigTuna99 사용자 메달사용자 메달사용자 메달사용자 메달사용자 메달
     답변됨
    Hook the Form Closing event and cancel it and set the visibility of the Form to false and set ShowInTaskbar to false as well.  Then in the click event of your notifyicon, simply show the form.  Your app will still show up when the users presses Alt-Tab however.



    If this answers your question, please mark the question as answered.
    • 답변으로 표시됨vjsakec99 2009년 11월 4일 수요일 오후 7:10
    • 편집됨BigTuna99 2009년 11월 4일 수요일 오후 6:51spelling
    •  

모든 응답

  • 2009년 11월 4일 수요일 오후 6:51BigTuna99 사용자 메달사용자 메달사용자 메달사용자 메달사용자 메달
     답변됨
    Hook the Form Closing event and cancel it and set the visibility of the Form to false and set ShowInTaskbar to false as well.  Then in the click event of your notifyicon, simply show the form.  Your app will still show up when the users presses Alt-Tab however.



    If this answers your question, please mark the question as answered.
    • 답변으로 표시됨vjsakec99 2009년 11월 4일 수요일 오후 7:10
    • 편집됨BigTuna99 2009년 11월 4일 수요일 오후 6:51spelling
    •  
  • 2009년 11월 4일 수요일 오후 7:10An Anon Coward 사용자 메달사용자 메달사용자 메달사용자 메달사용자 메달
     
    Hook the Form Closing event and cancel it and set the visibility of the Form to false and set ShowInTaskbar to false as well.  Then in the click event of your notifyicon, simply show the form.  Your app will still show up when the users presses Alt-Tab however.

    If a form isn't visible it won't show up in the Taskbar or in the Alt-Tab list.
  • 2009년 11월 9일 월요일 오후 6:35Aadhi123 사용자 메달사용자 메달사용자 메달사용자 메달사용자 메달
     
    Adding Additional Info: If the Icon file is not specified the system tray will not work. Creating new icon in the project and mapping it in the icon properties of "notify icon" should help.