Click to See Complete Forum and Search --> : Cout Statement Not Showing Up


tofurocks
January 7th, 2009, 06:44 PM
I know that this is very sloppy coding, but all the lines here

int decision;
cout << "Enter 1 to Shoot CTs in the face" << endl;
cout << "Enter 2 to Find a Colour" << endl;
cin >> decision;
switch (decision){
case 1:
anumber = 2040097;
hover();
break;
case 2:

Don't show up when the project is compiled. The whole idea of the program is to click when you move your mouse over a certain colour (made for use with the game counter-strike in this case)
Here's the whole program, there are lots of errors but it still runs.

#include <cstdlib>
#include <iostream>
#include <windows.h>
#include <winuser.h>
#include <math.h>
void hover();
using namespace std;
int anumber = 0;
int main(int argc, char *argv[])
{
int decision;
cout << "Enter 1 to Shoot CTs in the face" << endl;
cout << "Enter 2 to Find a Colour" << endl;
cin >> decision;
switch (decision){
case 1:
anumber = 2040097;
hover();
break;
case 2:
cout << "What colour do you want to find?" << endl; // CT head: 2040097
cin >> anumber;
hover();
}
}
void hover()
{
cout << "In hover";
HDC screen = GetDC(HWND_DESKTOP);
POINT cursorPos;
GetCursorPos(&cursorPos); // Get the cursor position
float x = 0;
x = cursorPos.x; // Access the variables
float y = 0;
y = cursorPos.y;
int *xint = round(x); // Convert to int
int *yint = round(y);
if (GetPixel(screen, xint, yint) == anumber){ // Compare the coords to the colour
mouse_event(MOUSEEVENTF_LEFTDOWN,x,y,0,0); // Click
mouse_event(MOUSEEVENTF_LEFTUP,x,y,0,0);
cout << "clicked." << endl;
hover(); // Repeat
}
else hover(); // Repeat
system("PAUSE");
}

Marc G
January 8th, 2009, 10:48 AM
Just to make sure, are you compiling this as a console program or as a windows program? What subsystem do you tell the compiler to use as target?

shadowx360
January 10th, 2009, 03:52 PM
Pretty sure this guy's using Console windows. When compiling, try turn off "Do no show console window."

tofurocks
January 11th, 2009, 08:27 PM
I'm compiling using dev-c++, console app. And the display is

What colour do you want to find?
(enter prompt)

So the window does show up..

pobri19
January 12th, 2009, 08:01 AM
Sounds to me like you're trying to create a Counter-Strike aimbot.

tofurocks
January 18th, 2009, 12:13 PM
similar to an aimbot, but a different idea