Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Windows API
  4. Handling exit (X) button at the top right corner

Handling exit (X) button at the top right corner

Scheduled Pinned Locked Moved Windows API
question
3 Posts 3 Posters 7 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    Taruni
    wrote on last edited by
    #1

    Hi, As per my requirement is concerned ,When I press the close(X) button at the top right corner , I need a dialog box to be displayed.Where should I handle (add the code for) this ? Hope I am clear. Thanks in advance.

    Taruni

    V J 2 Replies Last reply
    0
    • T Taruni

      Hi, As per my requirement is concerned ,When I press the close(X) button at the top right corner , I need a dialog box to be displayed.Where should I handle (add the code for) this ? Hope I am clear. Thanks in advance.

      Taruni

      V Offline
      V Offline
      Vega02
      wrote on last edited by
      #2

      This is not a Vista-specific question. I suspect you'd have better luck selecting the forum dedicated to the language that you're using and asking your question there. Hope this gets you started in the right direction. :)

      1 Reply Last reply
      0
      • T Taruni

        Hi, As per my requirement is concerned ,When I press the close(X) button at the top right corner , I need a dialog box to be displayed.Where should I handle (add the code for) this ? Hope I am clear. Thanks in advance.

        Taruni

        J Offline
        J Offline
        japel
        wrote on last edited by
        #3

        You need to catch the (On_Close) event for the close button. Private Sub OnClosingForm() Dim Result As DialogResult Result = MessageBox.Show("Are you sure you with to exit Time-Keeper?" & vbCrLf & _ "Press OK to Exit & Close, Press No to mimimise to the system tray.", "Confirmation on action!", _ MessageBoxButtons.YesNo, MessageBoxIcon.Question) If Result = Windows.Forms.DialogResult.Yes Then Me.Close() Else Me.WindowState = FormWindowState.Minimized Me.Hide() End If End Sub Private Sub frmMain_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing Me.Dispose() End Sub This is a code and not a Vista question, if you have further question please post on a form dedicated to your chosen language (C# or VB.Net). Hope this helps.

        When people make you see red, be thankful your not colour blind.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups