Too many arguments in function call

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Mindroix
    New Member
    • Apr 2015
    • 3

    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(R GBQUAD * pPixels, int height, int Width, int x, int y);
    void ScanBMP(ScanCon tents * 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_st r());


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


    POINT currentPos;
    GetCursorPos(&c urrentPos);
    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(h wnd, &rc);

    hdcShot = CreateCompatibl eDC(0);
    hbmap = CreateCompatibl eBitmap(GetDC(0 ), rc.right - rc.left, rc.bottom - rc.top);

    SelectObject(hd cShot, 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(hbm ap, 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(a ppWnd, &rcWindow);
    BITMAP bm;
    HBITMAP hbmap;
    HBITMAP hbmapOld;
    BITMAPINFO bmi;
    HDC hdcShot;
    HDC hdcScreen;

    RGBQUAD * pPixels;

    int TimeTakenScreen AndScan;
    while (true)
    {

    if (!GetAsyncKeySt ate('X'))
    {
    TimeTakenScreen AndScan = clock();


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

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

    HDC hdcShotNew = CreateCompatibl eDC(hdcShot);

    HBITMAP OldBmp = (HBITMAP)Select Object(hdcShotN ew, hbmapNEW);

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


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


    SelectObject(hd cShotNew, OldBmp);

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

    ReleaseDC(appWn d, hdcShot);

    ScanContents scanContentsMai n(bm, rcWindow, pPixels);

    ScanBMP(&scanCo ntentsMain);

    if (pPixels)
    free(pPixels);
    SelectObject(hd cShot, hbmapOld);
    DeleteObject(hd cShot);
    DeleteDC(hdcSho t);
    DeleteObject(hb mapNEW);
    DeleteObject(Ol dBmp);
    DeleteDC(hdcSho tNew);
    //std::cout << "out of scan, took" << clock() - TimeTakenScreen AndScan << " milliseconds " <<std::endl;
    }

    }



    }
  • weaknessforcats
    Recognized Expert Expert
    • Mar 2007
    • 9214

    #2
    The function prototype in your code is:

    Code:
    void SetupBitmapInfo(BITMAPINFO &bmi, int bHeight, int bitsPerPixel);
    which shows 3 arguments.

    The call in your code is:

    Code:
    SetupBitmapInfo(bmi, bm.bmWidth, bm.bmHeight, bitsPerPixel);
    which shows 4 arguments.

    So it does look like you have too many arguments.

    Comment

    • Mindroix
      New Member
      • Apr 2015
      • 3

      #3
      Didn't work now SetupBitmapInfo is an error :/

      Comment

      • weaknessforcats
        Recognized Expert Expert
        • Mar 2007
        • 9214

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

        Comment

        • Mindroix
          New Member
          • Apr 2015
          • 3

          #5
          So how should i do this?

          Comment

          • weaknessforcats
            Recognized Expert Expert
            • Mar 2007
            • 9214

            #6
            Do you have the code for SetupBitmapInfo ?

            If not do you have the library for it?

            Comment

            Working...