Cout Statement Not Showing Up
I know that this is very sloppy coding, but all the lines here
Code:
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.
Code:
#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");
}
Re: Cout Statement Not Showing Up
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?
Re: Cout Statement Not Showing Up
Pretty sure this guy's using Console windows. When compiling, try turn off "Do no show console window."
Re: Cout Statement Not Showing Up
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..
Re: Cout Statement Not Showing Up
Sounds to me like you're trying to create a Counter-Strike aimbot.
Re: Cout Statement Not Showing Up
similar to an aimbot, but a different idea