C Board  

Go Back   C Board > General Programming Boards > C++ Programming

Reply
 
LinkBack Thread Tools Display Modes
Old 11-07-2008, 12:57 PM   #1
Kevin
 
kevinawad's Avatar
 
Join Date: Nov 2006
Posts: 193
Win32 Console Application Problem.

Hello, i'm working on a game. i disabled right clicking to actually not be able to modify the buffer size of the console and more options.

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   Reply With Quote
Old 11-07-2008, 01:08 PM   #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   Reply With Quote
Old 11-07-2008, 01:13 PM   #3
Kevin
 
kevinawad's Avatar
 
Join Date: Nov 2006
Posts: 193
Because i'm making an "Mmorpg".

Roleplaying online game.
__________________
~kevinawad~
kevinawad is offline   Reply With Quote
Old 11-07-2008, 01:15 PM   #4
and the hat of sweating
 
Join Date: Aug 2007
Location: Toronto, ON
Posts: 3,283
Quote:
Originally Posted by kevinawad View Post
Because i'm making an "Mmorpg".

Roleplaying online game.
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   Reply With Quote
Old 11-07-2008, 01:26 PM   #5
Kevin
 
kevinawad's Avatar
 
Join Date: Nov 2006
Posts: 193
But there is a way to do it... i just need to know how.
__________________
~kevinawad~
kevinawad is offline   Reply With Quote
Old 11-07-2008, 01:29 PM   #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   Reply With Quote
Old 11-07-2008, 01:32 PM   #7
Kevin
 
kevinawad's Avatar
 
Join Date: Nov 2006
Posts: 193
Works, thank you so much.
__________________
~kevinawad~
kevinawad is offline   Reply With Quote
Old 11-07-2008, 01:39 PM   #8
Mysterious C++ User
 
Elysia's Avatar
 
Join Date: Oct 2007
Posts: 14,785
Quote:
Originally Posted by nucleon View Post
Code:
  // Get the system menu
  GetConsoleTitle( title, 500);
  hwnd = FindWindow( NULL, title);
Can be simplified to
Code:
hwnd = GetConsoleWindow();
Quote:
Code:
  printf( "Hello world\n");
Avoid using C stuff on the C++ board.

Quote:
Code:
  system( "pause");
Bad bad. Unportable.
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:
Originally Posted by cpjust
If C++ is 2 steps forward from C, then I'd say Java is 1 step forward and 2 steps back.
Elysia is offline   Reply With Quote
Old 11-07-2008, 02:10 PM   #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   Reply With Quote
Old 11-07-2008, 02:28 PM   #10
Mysterious C++ User
 
Elysia's Avatar
 
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:
Originally Posted by cpjust
If C++ is 2 steps forward from C, then I'd say Java is 1 step forward and 2 steps back.
Elysia is offline   Reply With Quote
Old 11-07-2008, 03:35 PM   #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   Reply With Quote
Reply

Thread Tools
Display Modes

Forum Jump

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


All times are GMT -6. The time now is 06:36 PM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22