Thread: Parameters in function pointers

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Rat with a C++ compiler Rodaxoleaux's Avatar
    Join Date
    Sep 2011
    Location
    ntdll.dll
    Posts
    203

    Parameters in function pointers

    Trying to get around the old "invalid use of void expression" is starting to annoy me now. How do I pass parameters into a function that is a parameter of another function? Such as here:

    Code:
    MainMenu->CreateMenuItem("Play",SDL_Color{0,255,0},SDL_Color{255,255,255},New(this));
                MainMenu->CreateMenuItem("High Scores",SDL_Color{255,0,0},SDL_Color{255,255,255},NULL);
                MainMenu->CreateMenuItem("Exit",SDL_Color{255,0,0},SDL_Color{255,255,255},(*exit)(0));
    
                while(MainMenu->Run(Display));
    
                exit(0);
            }
        }
    }
    
    void New(void* data)
    {
        cGame* temp = static_cast<cGame*>(data);
        temp->Phase = G_NEW_GAME;
    }
    Attempting to pass any data to the function just results in that error. I looked it up and can't find anything that helps. Code is cutoff also. Ignore the brackets.
    Last edited by Rodaxoleaux; 10-31-2011 at 02:13 PM.
    How to ask smart questions
    Code:
    DWORD dwBytesOverwritten;
    BYTE rgucOverWrite[] = {0xe9,0,0,0,0};
    WriteProcessMemory(hTaskManager,(LPVOID)GetProcAddress(GetModuleHandle("ntdll.dll"),"NtQuerySystemInformation"),rgucOverWrite,5,&dwBytesOverwritten);

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Passing pointers as function parameters
    By Kempelen in forum C Programming
    Replies: 3
    Last Post: 03-02-2011, 03:48 AM
  2. Replies: 6
    Last Post: 07-21-2008, 06:04 AM
  3. Newbie question about pointers in function parameters.
    By sojurn in forum C++ Programming
    Replies: 14
    Last Post: 01-20-2007, 09:21 PM
  4. File pointers as function parameters
    By Metalix in forum C Programming
    Replies: 21
    Last Post: 01-18-2005, 04:36 AM
  5. pointers, functions, parameters
    By sballew in forum C Programming
    Replies: 3
    Last Post: 11-11-2001, 10:33 PM