I am making a bot for an FPS game called Combat Arms, its full screen. The problem here is my code works, but when I open up the full screen combat arms window, it does noting at all...

It is a simple AFK Bot, with simple key presses, and mouse clicks.

Can someone tell me why it doesn't work when I go in game?
Btw don't quote the code please, I wish to remove the code once answered.

#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include "resource.h"
#include <iostream>
#include <cstdio>
#include <winable.h>

using namespace std;



HWND CAHandle()
{
	return FindWindow(NULL, "Combat_Arms");
}






// Key Inputs
void GenerateKey(BYTE vk)
{
    INPUT Input;
    ZeroMemory(&Input, sizeof(Input));
    Input.type = INPUT_KEYBOARD;
    Input.ki.dwFlags = KEYEVENTF_EXTENDEDKEY;
    Input.ki.wVk = vk;
    SendInput(1, &Input, sizeof(INPUT));

    return;
}


// InGame Functions
int InGame()
{
        GenerateKey((UCHAR)VkKeyScan('4'));
        for (int GoInGame=0;GoInGame<5;GoInGame++)
    {
        SetCursorPos(1296, 8);
        INPUT Input[2];
        ZeroMemory(Input, sizeof(INPUT) * 2);
        Input[0].type = INPUT_MOUSE;
        Input[0].mi.dwFlags = MOUSEEVENTF_LEFTDOWN;

        Input[1].type = INPUT_MOUSE;
        Input[1].mi.dwFlags = MOUSEEVENTF_LEFTUP;
        SendInput(2, Input, sizeof(INPUT));
    }


        GenerateKey((UCHAR)VkKeyScan('1'));
        GenerateKey((UCHAR)VkKeyScan('d'));
        GenerateKey((UCHAR)VkKeyScan('i'));
        GenerateKey((UCHAR)VkKeyScan('n'));
        GenerateKey((UCHAR)VkKeyScan('g'));
        GenerateKey((UCHAR)VkKeyScan(' '));
        return 0;
}




//Click the start button to go in-game
int GoInGame()
{

        for (int GoInGame=0;GoInGame<5;GoInGame++)
    {
    SetCursorPos(410, 650);

    INPUT Input[2];
    ZeroMemory(Input, sizeof(INPUT) * 2);
    Input[0].type = INPUT_MOUSE;
    Input[0].mi.dwFlags = MOUSEEVENTF_LEFTDOWN;

    Input[1].type = INPUT_MOUSE;
    Input[1].mi.dwFlags = MOUSEEVENTF_LEFTUP;
    SendInput(2, Input, sizeof(INPUT));
    }
    return 0;
}


// Click QuickJoin
int QuickJoin()
{
    int join = 0;
    while (join<100)
    {
    Sleep(1);
    keybd_event( VK_SPACE, 0x45, KEYEVENTF_EXTENDEDKEY, 0 );
    keybd_event( VK_SPACE, 0x45, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0);
    join++;
    }
    return 0;
}



// Starts the full bot
int StartBot()
{
    return 0;
}




HINSTANCE hInst;

BOOL CALLBACK DialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
    switch(uMsg)
    {
        case WM_INITDIALOG:
            /*
             * TODO: Add code to initialize the dialog.
             */
            return TRUE;

        case WM_CLOSE:
            EndDialog(hwndDlg, 0);
            return TRUE;

        case WM_COMMAND:
            switch(LOWORD(wParam))
            {
                /*
                 * TODO: Add more control ID's, when needed.
                 */
                case IDC_BTN_QUIT:
                    EndDialog(hwndDlg, 0);
                    return TRUE;

                case IDC_BTN_START:
                	if(CAHandle() != 0)
                	{
                        HDC hdc = GetDC(CAHandle());
                        ShowWindow(CAHandle(),SW_SHOWNORMAL);
                        SetForegroundWindow(CAHandle());
                        Sleep(9000);
                        CAHandle();
                        GoInGame();
                	}

                	else
                	{
                        MessageBox(hwndDlg, "Could not find Combat Arms!", "Error", MB_ICONINFORMATION);
                	}

                    return TRUE;

            }
    }

    return FALSE;
}


int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
{
    hInst = hInstance;

    // The user interface is a modal dialog box
    return DialogBox(hInstance, MAKEINTRESOURCE(DLG_MAIN), NULL, DialogProc);
}

i play combat arms idk how your gonna get it past hacksheild pro

lolz add me im panzyz

Btw don't quote the code please, I wish to remove the code once answered.

It doesn't quite work that way here and you're past the thirty minute edit window.

pixel search bot example
; include the misc UDF library
; UDF = user defined Function
#include <Misc.au3>

;----- set the hotkeys ------;
HotKeySet("{f3}", "chosecolor")
; set the escape button to
; the exit function
HotKeySet("{esc}", "_exit")
HotKeySet("{f5}", "start")
HotKeySet("{f6}", "stop")

; declare the variable color to be
; used globaly
Global $color
; declare ON globaly and set it
; to false(off)
Global $ON = False




While 1
	Sleep(30); dont fuck the CPU
	; if the on is set to true
	If $ON = True Then
		; this is the pixel search function
		; the last parameter (40) is the
		; shade variation
		; the other parameters are the
		; pixel search area
		; change them so they fits your needs :)
		$coord = PixelSearch(0, 0, 400, 400, $color, 40)
		; if the return of coord is an array
		; which means a pixel was found
		If IsArray($coord) = 1 Then
			; left click on the pixel
			MouseMove($coord[0],$coord[1])
			MouseClick("left",$coord[0],$coord[1])
		EndIf
	EndIf
WEnd








; chose color function
Func chosecolor()
	; this will display a color chose window
	; the chosen color will be stored in the
	; variable $color
	$color = _ChooseColor(2, 0x0080C0, 2, "")
	MsgBox(0,'',$color)
EndFunc   ;==>chosecolor


; func extit
Func _exit()
; simply exits the script
Exit
EndFunc   ;==>_exit

;start func
Func start()
; set the variable to true
$ON = True
EndFunc   ;==>start

;start func
Func stop()
; set the variable false
$ON = False
EndFunc   ;==>stop

this works but you have to use SciTE Script Editor
and you keys are f3 to choose color
f5 to run
f6 to stop
esc to close

and i have not go this to run in game it will close combat arms
hack shild pro picks it up as hacks the red part is f u c k

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.