CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Nov 2008
    Posts
    12

    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");
    }

  2. #2
    Join Date
    Nov 2003
    Location
    Belgium
    Posts
    8,150

    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?
    Marc Gregoire - NuonSoft (http://www.nuonsoft.com)
    My Blog
    Wallpaper Cycler 3.5.0.97

    Author of Professional C++, 4th Edition by Wiley/Wrox (includes C++17 features)
    ISBN: 978-1-119-42130-6
    [ http://www.facebook.com/professionalcpp ]

  3. #3
    Join Date
    Oct 2008
    Posts
    68

    Re: Cout Statement Not Showing Up

    Pretty sure this guy's using Console windows. When compiling, try turn off "Do no show console window."

  4. #4
    Join Date
    Nov 2008
    Posts
    12

    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..

  5. #5
    Join Date
    May 2008
    Posts
    15

    Re: Cout Statement Not Showing Up

    Sounds to me like you're trying to create a Counter-Strike aimbot.

  6. #6
    Join Date
    Nov 2008
    Posts
    12

    Re: Cout Statement Not Showing Up

    similar to an aimbot, but a different idea

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured