可行的方法在控制台窗口的右上角变为灰色,关闭按钮? [英] Feasible way to grey out the close button at the upper right corner of Console Window?

查看:501
本文介绍了可行的方法在控制台窗口的右上角变为灰色,关闭按钮?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用GCC - 的mingw32编译在Windows上的程序。
是否有一些可行的方法在控制台窗口的右上角变为灰色,关闭按钮? (如添加一些codeS?)

我不想结束我的程序一不小心XDD

我想这样的事情,但从来没有工作,帮助我,谢谢。

  HWND St​​dHandle = GetStdHandle(STD_OUTPUT_HANDLE);
HMENU SystemMenu = GetSystemMenu(StdHandle,FALSE);
EnableMenuItem(SystemMenu,0,MF_GRAYED);


解决方案

  W:= GetConsoleWindow; // http://msdn.microsoft.com/en-us/library/windows/desktop/ms683175%28v=vs.85%29.aspx
L:= GetSystemMenu(W,FALSE);
// EnableMenuItem(男,SC_CLOSE,MF_BYCOMMAND或MF_DISABLED或MF_GRAYED);
DeleteMenu(男,SC_CLOSE,MF_BYCOMMAND);

I use GCC--mingw32 to compile a program on Windows. Are there some feasible ways to grey out the close button at the upper right corner of "Console Window"? (like adding some codes?)

I don't want to close my program incautiously XDD

I tried something like this, but never works, help me, thanks.

HWND StdHandle = GetStdHandle (STD_OUTPUT_HANDLE);
HMENU SystemMenu = GetSystemMenu(StdHandle, FALSE);
EnableMenuItem(SystemMenu, 0, MF_GRAYED);

解决方案

W := GetConsoleWindow; // http://msdn.microsoft.com/en-us/library/windows/desktop/ms683175%28v=vs.85%29.aspx
M := GetSystemMenu(W, False);
//EnableMenuItem(M, SC_CLOSE, MF_BYCOMMAND or MF_DISABLED or MF_GRAYED);
DeleteMenu(M, SC_CLOSE, MF_BYCOMMAND);

这篇关于可行的方法在控制台窗口的右上角变为灰色,关闭按钮?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆