Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.

Pipo DeClown


This topic is 5831 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

hi! I wanted to discuss M$VC+=. The reason is, that im getting lots of not-wanted code. When I use Console Functions like this:
int x=15,y=15;
HANDLE outh;
COORD pos={ x,y};
Am I doing something wrong in my code, or are my settings wrong? Also when I''m using system("cls"); ,I get "cls" on the wrong moments! Can someone help me with this problem? _________________________________________________________________________ Can someone be nice and help me on my way to be the next Hideo Kojima? Thought So...

Share this post

Link to post
Share on other sites
Firstly it''s called MSVC++. Unless there''s a huge typo on your box. It''s been known to happen, we have a GeForce 4 "gpaphics" card in work!

Anyway, you probably have to initialise your outh handle to something before using it. Lastly getting your cls at the wrong time probably has something to do with whenever your console output gets flushed. I think that using and << endl in your output may flush it before the cls (which is what you want) but there may be a nicer way.

Helpful links:
How To Ask Questions The Smart Way | Google can help with your question | Search MSDN for help with standard C or Windows functions

Share this post

Link to post
Share on other sites
Code Here:

#include <windows.h>

int x=15,y=15;
HANDLE outputh,inputh;
COORD coord={x,y};

int main()

outputh = GetStdHandle(STD_OUTPUT_HANDLE);
inputh = GetStdHandle(STD_INPUT_HANDLE);
long unsigned char_char;
WriteConsole(outputh,"Send Email",10,&char_char,NULL);
long unsigned event;
bool a=true;
while (a){
if((IR.Event.MouseEvent.dwMousePosition.X>14 &&
IR.Event.MouseEvent.dwMousePosition.X<25) &&
IR.Event.MouseEvent.dwMousePosition.Y==15 &&
IR.Event.MouseEvent.dwEventFlags ==0){
ShellExecute( NULL, "open","mailto:rick_rackplayer@hotmail.com", NULL, NULL, SW_SHOWNORMAL);



return 0;

however system("CLS") doesnt work......

[edit] nothing

[edited by - Pipo declown on June 9, 2002 12:21:52 PM]

Share this post

Link to post
Share on other sites
WIn32SDK help entry Q99261 Provides :

/* Standard error macro for reporting API errors */

#define PERR(bSuccess, api){if(!(bSuccess)) printf("%s:Error %d from %s on line %d\n", __FILE__, GetLastError(), api, __LINE__);}

void cls( HANDLE hConsole )
COORD coordScreen = { 0, 0 }; /* here's where we'll home the cursor */
BOOL bSuccess;
DWORD cCharsWritten;
CONSOLE_SCREEN_BUFFER_INFO csbi; /* to get buffer info */
DWORD dwConSize; /* number of character cells in the current buffer */

/* get the number of character cells in the current buffer */
bSuccess = GetConsoleScreenBufferInfo( hConsole, &csbi );
PERR( bSuccess, "GetConsoleScreenBufferInfo" );
dwConSize = csbi.dwSize.X * csbi.dwSize.Y;

/* fill the entire screen with blanks */
bSuccess = FillConsoleOutputCharacter( hConsole, (TCHAR) ' ', dwConSize, coordScreen, &cCharsWritten );
PERR( bSuccess, "FillConsoleOutputCharacter" );

/* get the current text attribute */
bSuccess = GetConsoleScreenBufferInfo( hConsole, &csbi );
PERR( bSuccess, "ConsoleScreenBufferInfo" );

/* now set the buffer's attributes accordingly */
bSuccess = FillConsoleOutputAttribute( hConsole, csbi.wAttributes, dwConSize, coordScreen, &cCharsWritten );
PERR( bSuccess, "FillConsoleOutputAttribute" );

/* put the cursor at (0, 0) */

bSuccess = SetConsoleCursorPosition( hConsole, coordScreen );
PERR( bSuccess, "SetConsoleCursorPosition" );

Documents [ GDNet | MSDN | STL | OpenGL | Formats | RTFM | Asking Smart Questions ]
C++ Stuff [ MinGW | Loki | SDL | Boost. | STLport | FLTK | ACCU Recommended Books ]

[edited by - Fruny on June 9, 2002 12:40:49 PM]

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!