how handle WM_CLOSE for my application using C# - Advanced Installer Community

We’re moving our forums to a new platform.

You can still browse and search existing topics, but you can no longer create new topics or post replies.

For questions, technical issues, or feature requests, please don’t hesitate to contact our support team at support@advancedinstaller.com.

Thank you for your understanding!

pisica77b
Posts: 2
Joined: Fri Feb 01, 2013 7:18 pm

how handle WM_CLOSE for my application using C#

Hello,
your product is really good but I have a big problem with close application when Im installing update. I readed that my application has to handle WM_CLOSE. Is it possible a example how set WM_CLOSE? Im using visual studio 2010, windows form and c#. Sorry my incompetence, I searched in many forums online without success.

I founded this code, but I dont know how I have to use it.

Code: Select all

private const int WM_CLOSE = 0x0010;

protected override void WndProc(ref Message m) {
  if (m.Msg == WM_CLOSE) {
    // Close everything
  }
  base.WndProc(ref m);
}
thanks in advance.
pisica77b
Posts: 2
Joined: Fri Feb 01, 2013 7:18 pm

Re: how handle WM_CLOSE for my application using C#

Resolved!

I added in close_forming event this:

Code: Select all

        private void Form1_FormClosing(object sender, FormClosingEventArgs e)
        {
            Application.Exit();
        }

Return to “Common Problems”