How do I disable the 'Close Window' option in the taskbar?

How to write a C Code in order to disable the 'Close Window' option in the taskbar?

Compiler: GCC-mingw32

Which API Function should I use?

Thanks.

Answers


Make the window's message dispatcher process the message WM_SYSCOMMAND and filter it out if the message's wParam is SC_CLOSE.

Let WndProc be the windows message handler then the code to do might look like this:

LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
  ...

  switch (message)
  {
    case WM_SYSCOMMAND:
     if (wParam == SC_CLOSE);
       break;

     return DefWindowProc(hWnd, message, wParam, lParam);  

    case ...

  }

  return 0;
}

This does not remove the "close"-menu item from the application's jump-list (its taskbar's local menu), but disables its functionality.


Need Your Help

How to run a stored procedure report and then send the result into email?

sql-server-2005

I am using SQL Server 2005. I have a report that is using stored procedure with just few lines of records and would like to send the whole recordset through an email and sets this into a schedule.

Update bootstrap color picker manually

javascript jquery css twitter-bootstrap

I'm using the following color picker on bootstrap:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.