From here:
#define _WIN32_WINNT 0x0500
#include <stdio.h>
#include <windows.h>
int main(int argc, _TCHAR* argv[]){
HWND h;
HMENU sm;
int i, j, c;
LPTSTR buf;
h = GetConsoleWindow();
sm = GetSystemMenu(h, 0);
c = GetMenuItemCount(sm);
j = -1;
buf = (TCHAR*) malloc (256 *sizeof(TCHAR));
for (i=0; i<c; i++) {
GetMenuString(sm, i, buf, 255, MF_BYPOSITION);
if (!strcmp(buf, "&Close")) {
j = i;
break;
}
}
if (j >= 0)
RemoveMenu(sm, j, MF_BYPOSITION);
return 0;
}
source
share