![]() |
| | #1 |
| Kevin Join Date: Nov 2006
Posts: 193
| Win32 Console Application Problem. Now, i got a big problem, people can still click the top left icon to modify some of the cmd options. How is it possible to disable the edit option for cmd?
__________________ ~kevinawad~ |
| kevinawad is offline | |
| | #2 |
| and the hat of sweating Join Date: Aug 2007 Location: Toronto, ON
Posts: 3,283
| Why do you need to?
__________________ "I am probably the laziest programmer on the planet, a fact with which anyone who has ever seen my code will agree." - esbo, 11/15/2008 "the internet is a scary place to be thats why i dont use it much." - billet, 03/17/2010 |
| cpjust is offline | |
| | #3 |
| Kevin Join Date: Nov 2006
Posts: 193
| Because i'm making an "Mmorpg". Roleplaying online game.
__________________ ~kevinawad~ |
| kevinawad is offline | |
| | #4 |
| and the hat of sweating Join Date: Aug 2007 Location: Toronto, ON
Posts: 3,283
| I don't use those, so I still don't understand why it's that important, but just tell the users not to do it. If they do it anyways, that's their own fault.
__________________ "I am probably the laziest programmer on the planet, a fact with which anyone who has ever seen my code will agree." - esbo, 11/15/2008 "the internet is a scary place to be thats why i dont use it much." - billet, 03/17/2010 |
| cpjust is offline | |
| | #5 |
| Kevin Join Date: Nov 2006
Posts: 193
| But there is a way to do it... i just need to know how.
__________________ ~kevinawad~ |
| kevinawad is offline | |
| | #6 |
| Registered User Join Date: Oct 2008
Posts: 60
| Try this on for size: Code: #include <windows.h>
#include <stdio.h>
#include <stdlib.h>
int main()
{
char title[500];
HWND hwnd;
HMENU hmenu;
// Get the system menu
GetConsoleTitle( title, 500);
hwnd = FindWindow( NULL, title);
hmenu = GetSystemMenu( hwnd, FALSE);
// Remove all its items
while (DeleteMenu( hmenu, 0, MF_BYPOSITION))
;
// Add "Close" back
AppendMenu( hmenu, MF_STRING, SC_CLOSE, "Close");
printf( "Hello world\n");
system( "pause");
}
|
| nucleon is offline | |
| | #7 |
| Kevin Join Date: Nov 2006
Posts: 193
| Works, thank you so much.
__________________ ~kevinawad~ |
| kevinawad is offline | |
| | #8 | ||||
| Mysterious C++ User Join Date: Oct 2007
Posts: 14,785
| Quote:
Code: hwnd = GetConsoleWindow(); Quote:
Quote:
Best option is to let the IDE do the pausing. Otherwise, use cin.get().
__________________ Using: Microsoft Windows™ 7 Professional (x64), Microsoft Visual Studio™ 2008 Team System I dedicated my life to helping others. This is only a small sample of what they said: "Thanks Elysia. You're a programming master! How the hell do you know every thing?" Quoted... at least once. Quote:
| ||||
| Elysia is offline | |
| | #9 |
| Registered User Join Date: Oct 2008
Posts: 60
| I thought there was a better way to get the hwnd, but couldn't remember what it was! As for the C, I forgot which board we were on. As for system("pause"), I usually remove that before posting. It works well for me in testing. |
| nucleon is offline | |
| | #10 | |
| Mysterious C++ User Join Date: Oct 2007
Posts: 14,785
| I can imagine the system pause works for you, but since this is a board about portability and such, it is best if you avoid posting non-portable solutions when there is a portable one. One day you might even become a great member of this board who teaches newbies good style and portable solutions!
__________________ Using: Microsoft Windows™ 7 Professional (x64), Microsoft Visual Studio™ 2008 Team System I dedicated my life to helping others. This is only a small sample of what they said: "Thanks Elysia. You're a programming master! How the hell do you know every thing?" Quoted... at least once. Quote:
| |
| Elysia is offline | |
| | #11 |
| Registered User Join Date: Oct 2008
Posts: 60
| I'll try to keep portability and style in mind. I doubt I have the patience to be a "great" member. I'll just help out! |
| nucleon is offline | |
![]() |
| Thread Tools | |
| Display Modes | |
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| making a stealthy win32 console application? | killdragon | C++ Programming | 3 | 09-08-2004 02:50 PM |
| Painting with Tex on a Win32 Application | webzest | C++ Programming | 5 | 08-16-2004 03:04 PM |
| icon in win32 console application | osal | Windows Programming | 3 | 06-30-2004 02:13 PM |
| splitting the screen in a Win32 console application | watcher_b | C Programming | 1 | 10-19-2002 05:22 PM |
| Win32 Console Application...Full Screen? | MrWizard | C++ Programming | 4 | 04-01-2002 02:56 PM |