473,408 Members | 1,852 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

Too many arguments in function call

Hi please help!

where you find : SetupBitmapInfo(bmi, bm.bmWidth, bm.bmHeight, bitsPerPixel);
return true;

Then its says too many arguments in function call in the bitsPerPixel bit please help!


#include "ScanContents.h"

bool TakeScreenshot(std::string WindowToFind, BITMAP &bm, HBITMAP &hbmap, BITMAPINFO &bmi, HDC &hdcShot,
HBITMAP &hbitmapOld, HWND &hwnd);

void SetupBitmapInfo(BITMAPINFO &bmi, int bHeight, int bitsPerPixel);
bool CompareColour(RGBQUAD * pPixels, int height, int Width, int x, int y);
void ScanBMP(ScanContents * scan);
bool Aim_Bot(HWND appWnd, std::string GameWindow);
MouseCoord CurrentMouseXY(0, 0);


int main()
{
std::string GameWindow = "Counter-Strike Source";
HWND appWnd = FindWindow(0, GameWindow.c_str());


while (!appWnd)
{
system("CLS");
std::cout << "Unable to find " << GameWindow.c_str() << std::endl;
Sleep(500);
}


POINT currentPos;
GetCursorPos(&currentPos);
CurrentMouseXY.X = currentPos.x;
CurrentMouseXY.Y = currentPos.y;

Aim_Bot(appWnd, GameWindow);
system("pause");
return 0;
}


bool TakeScreenshot(std::string WindowToFind, BITMAP &bm, HBITMAP &hbmap, BITMAPINFO &bmi, HDC &hdcShot,
HBITMAP &hbitmapOld, HWND &hwnd)

{

RECT rc;
GetWindowRect(hwnd, &rc);

hdcShot = CreateCompatibleDC(0);
hbmap = CreateCompatibleBitmap(GetDC(0), rc.right - rc.left, rc.bottom - rc.top);

SelectObject(hdcShot, hbmap);

BitBlt(hdcShot, 0, 0, rc.right - rc.left, rc.bottom - rc.top, hdcShot, rc.left, rc.top, SRCCOPY);

int bitsPerPixel = bm.bmBitsPixel;

if (!GetObject(hbmap, sizeof(BITMAP), (LPSTR)&bm))
return false;



if(bitsPerPixel != 32 || bm.bmPlanes != 1)
return false;


SetupBitmapInfo(bmi, bm.bmWidth, bm.bmHeight, bitsPerPixel);
return true;


}

bool Aim_Bot(HWND appWnd, std::string GameWindow)


{

RECT rcWindow;
GetWindowRect(appWnd, &rcWindow);
BITMAP bm;
HBITMAP hbmap;
HBITMAP hbmapOld;
BITMAPINFO bmi;
HDC hdcShot;
HDC hdcScreen;

RGBQUAD * pPixels;

int TimeTakenScreenAndScan;
while (true)
{

if (!GetAsyncKeyState('X'))
{
TimeTakenScreenAndScan = clock();


if (!TakeScreenshot(GameWindow, bm, hbmap, bmi, hdcShot, hbmapOld, appWnd))
break;

HBITMAP hbmapNEW = CreateCompatibleBitmap(hdcShot, rcWindow.right - rcWindow.left, rcWindow.bottom - rcWindow.top);

HDC hdcShotNew = CreateCompatibleDC(hdcShot);

HBITMAP OldBmp = (HBITMAP)SelectObject(hdcShotNew, hbmapNEW);

BitBlt(hdcShotNew, 0, 0, rcWindow.right - rcWindow.left, rcWindow.bottom - rcWindow.top, hdcShot, 0, 0, SRCCOPY);


pPixels = new RGBQUAD[bm.bmWidth * bm.bmHeight];
if (!pPixels)return false;


SelectObject(hdcShotNew, OldBmp);

if(!GetDIBits(hdcShotNew, hbmapNEW, 0, bm.bmHeight, pPixels, &bmi, DIB_RGB_COLORS))
{
ReleaseDC(appWnd, hdcShot);
delete[] pPixels;
return false;
}

ReleaseDC(appWnd, hdcShot);

ScanContents scanContentsMain(bm, rcWindow, pPixels);

ScanBMP(&scanContentsMain);

if (pPixels)
free(pPixels);
SelectObject(hdcShot, hbmapOld);
DeleteObject(hdcShot);
DeleteDC(hdcShot);
DeleteObject(hbmapNEW);
DeleteObject(OldBmp);
DeleteDC(hdcShotNew);
//std::cout << "out of scan, took" << clock() - TimeTakenScreenAndScan << " milliseconds " <<std::endl;
}

}



}
Apr 7 '15 #1
5 3824
weaknessforcats
9,208 Expert Mod 8TB
The function prototype in your code is:

Expand|Select|Wrap|Line Numbers
  1. void SetupBitmapInfo(BITMAPINFO &bmi, int bHeight, int bitsPerPixel);
which shows 3 arguments.

The call in your code is:

Expand|Select|Wrap|Line Numbers
  1. SetupBitmapInfo(bmi, bm.bmWidth, bm.bmHeight, bitsPerPixel);
which shows 4 arguments.

So it does look like you have too many arguments.
Apr 8 '15 #2
Didn't work now SetupBitmapInfo is an error :/
Apr 8 '15 #3
weaknessforcats
9,208 Expert Mod 8TB
So where is the code for SetupBitmapInfo?

The function prototype just says the code for it is not in the file being compiled. The SetupBitmapInfo definition must be in another source file or in a library.

Apparently, the SetupBitmapInfo code can't be found so it appears as an error.
Apr 8 '15 #4
So how should i do this?
Apr 8 '15 #5
weaknessforcats
9,208 Expert Mod 8TB
Do you have the code for SetupBitmapInfo?

If not do you have the library for it?
Apr 8 '15 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

9
by: Chuck Anderson | last post by:
I have a function with 7 inputs. The last three have default values. I want to call that function specifying the first four, skip two and then specify the last. I thought I could write this...
2
by: bwooster47 | last post by:
I'm a newcomer to python - what is the best way to convert a list into a function call agruments? For example: list = (2005, 5, 5) date = datetime.date( list ) fails with: TypeError:...
39
by: Randell D. | last post by:
Folks, I'm sure this can be done legally, and not thru tricks of the trade - I hope someone can help. I'm writing a 'tool' (a function) which can be used generically in any of my projects. ...
11
by: Neo | last post by:
Why the following code is compilable? The function abc() doesn't take any arguments, still i can call the function with arbitraty number of arguments. Even compiler doesn't show any warning. What...
9
by: ashok.anbalan | last post by:
Hi, Can someone tell me if the language imposes any restrictions on the maximum number of arguments that can be passed via a function call? Thanks, Ashok
4
by: golubovsky | last post by:
Hi, Is there an easy way to construct a function call out of a function and an array of actual arguments? e. g. given a function `fun' and an array I need to obtain equivalent of...
7
by: lordkain | last post by:
Hello all, I have a problem which I cant seem to solve, I dont know if it is solvable.. it should though. What I want is to call a function, whith x arguments on base of an xml file. In the...
5
by: kris | last post by:
Hi I have written a program which prints the hostid on a linux system. The programm uses gethostid() function call which is defined in the library file unistd.h. But my programm gets compiled...
34
by: Srinu | last post by:
Hi all, Can we assign return value of a function to a global variable? As we know, main() will be the first function to be executed. but if the above is true, then we have a function call before...
9
by: Yannick | last post by:
Hi everyone - I am not quite sure to understand what is really going on when a function defined in one translation unit calls a function defined in a different translation unit without knowing...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.