Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. I get compile error c2440 it tells me cannot convert from void please help

I get compile error c2440 it tells me cannot convert from void please help

Scheduled Pinned Locked Moved C / C++ / MFC
helpgraphics
8 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    nah1337
    wrote on last edited by
    #1

    #include #include #include #include #include #include #include #include #include #include //icludes are they windows.h ;stdio.h;detours.h;math.h;process.h;vector;mmsystem.h;tlhelp32.h

    #pragma comment(lib, "glu32.lib")
    #pragma comment(lib, "opengl32.lib")
    #pragma comment(lib, "winmm.lib")

    #define Client_GLDRAWELEMENTS 0x4E5DA2

    #define CAST( Type, Address ) ( ( Type )( Address ) )

    typedef void ( WINAPI *GLDRAWELEMENTS_TYPE )( GLenum iMode, GLsizei iCount, GLenum iType, const GLvoid *pvIndices );

    GLDRAWELEMENTS_TYPE g_dwGlDrawElements = NULL;

    void WINAPI glDrawElementsHook( GLenum iMode, GLsizei iCount, GLenum iType, const GLvoid *pvIndices )
    {

    ( g\_dwGlDrawElements )( iMode, iCount, iType, pvIndices );
    

    }

    DWORD OpenGLHooks( PVOID pvArgs )
    {
    do
    {
    g_dwGlDrawElements = *( DWORD * )Client_GLDRAWELEMENTS;

               Sleep( 100 );
    
        } while( g\_dwGlDrawElements == NULL );
    
        \*( DWORD \* )Client\_GLDRAWELEMENTS = PtrToUlong( glDrawElementsHook );
    
        return NULL;
    

    }

    bool WINAPI DllMain(HINSTANCE hDll, DWORD dwReason, PVOID pvReserved)
    {
    if(dwReason == DLL_PROCESS_ATTACH)
    {

    CreateThread( NULL, 0, ( LPTHREAD\_START\_ROUTINE )OpenGLHooks, NULL, 0, NULL );
    
    
    
    return true;
    }
    else if(dwReason == DLL\_PROCESS\_DETACH)
    {
    }
    return false;
    

    }

    C D 2 Replies Last reply
    0
    • N nah1337

      #include #include #include #include #include #include #include #include #include #include //icludes are they windows.h ;stdio.h;detours.h;math.h;process.h;vector;mmsystem.h;tlhelp32.h

      #pragma comment(lib, "glu32.lib")
      #pragma comment(lib, "opengl32.lib")
      #pragma comment(lib, "winmm.lib")

      #define Client_GLDRAWELEMENTS 0x4E5DA2

      #define CAST( Type, Address ) ( ( Type )( Address ) )

      typedef void ( WINAPI *GLDRAWELEMENTS_TYPE )( GLenum iMode, GLsizei iCount, GLenum iType, const GLvoid *pvIndices );

      GLDRAWELEMENTS_TYPE g_dwGlDrawElements = NULL;

      void WINAPI glDrawElementsHook( GLenum iMode, GLsizei iCount, GLenum iType, const GLvoid *pvIndices )
      {

      ( g\_dwGlDrawElements )( iMode, iCount, iType, pvIndices );
      

      }

      DWORD OpenGLHooks( PVOID pvArgs )
      {
      do
      {
      g_dwGlDrawElements = *( DWORD * )Client_GLDRAWELEMENTS;

                 Sleep( 100 );
      
          } while( g\_dwGlDrawElements == NULL );
      
          \*( DWORD \* )Client\_GLDRAWELEMENTS = PtrToUlong( glDrawElementsHook );
      
          return NULL;
      

      }

      bool WINAPI DllMain(HINSTANCE hDll, DWORD dwReason, PVOID pvReserved)
      {
      if(dwReason == DLL_PROCESS_ATTACH)
      {

      CreateThread( NULL, 0, ( LPTHREAD\_START\_ROUTINE )OpenGLHooks, NULL, 0, NULL );
      
      
      
      return true;
      }
      else if(dwReason == DLL\_PROCESS\_DETACH)
      {
      }
      return false;
      

      }

      C Offline
      C Offline
      Cedric Moonen
      wrote on last edited by
      #2

      Please, post the exact error message and tell us which line of code is the problem.

      Cédric Moonen Software developer
      Charting control [v1.5] OpenGL game tutorial in C++

      N 1 Reply Last reply
      0
      • C Cedric Moonen

        Please, post the exact error message and tell us which line of code is the problem.

        Cédric Moonen Software developer
        Charting control [v1.5] OpenGL game tutorial in C++

        N Offline
        N Offline
        nah1337
        wrote on last edited by
        #3

        ok when i get at home then il post the excat error and tell you what line it has

        N 1 Reply Last reply
        0
        • N nah1337

          ok when i get at home then il post the excat error and tell you what line it has

          N Offline
          N Offline
          nah1337
          wrote on last edited by
          #4

          Im still not home but this is the line what creates the error and the code is compile ready i mean its the full source code u can just start compiling it and i belive u get the excat error: g_dwGlDrawElements = *( DWORD * )Client_GLDRAWELEMENTS;

          1 Reply Last reply
          0
          • N nah1337

            #include #include #include #include #include #include #include #include #include #include //icludes are they windows.h ;stdio.h;detours.h;math.h;process.h;vector;mmsystem.h;tlhelp32.h

            #pragma comment(lib, "glu32.lib")
            #pragma comment(lib, "opengl32.lib")
            #pragma comment(lib, "winmm.lib")

            #define Client_GLDRAWELEMENTS 0x4E5DA2

            #define CAST( Type, Address ) ( ( Type )( Address ) )

            typedef void ( WINAPI *GLDRAWELEMENTS_TYPE )( GLenum iMode, GLsizei iCount, GLenum iType, const GLvoid *pvIndices );

            GLDRAWELEMENTS_TYPE g_dwGlDrawElements = NULL;

            void WINAPI glDrawElementsHook( GLenum iMode, GLsizei iCount, GLenum iType, const GLvoid *pvIndices )
            {

            ( g\_dwGlDrawElements )( iMode, iCount, iType, pvIndices );
            

            }

            DWORD OpenGLHooks( PVOID pvArgs )
            {
            do
            {
            g_dwGlDrawElements = *( DWORD * )Client_GLDRAWELEMENTS;

                       Sleep( 100 );
            
                } while( g\_dwGlDrawElements == NULL );
            
                \*( DWORD \* )Client\_GLDRAWELEMENTS = PtrToUlong( glDrawElementsHook );
            
                return NULL;
            

            }

            bool WINAPI DllMain(HINSTANCE hDll, DWORD dwReason, PVOID pvReserved)
            {
            if(dwReason == DLL_PROCESS_ATTACH)
            {

            CreateThread( NULL, 0, ( LPTHREAD\_START\_ROUTINE )OpenGLHooks, NULL, 0, NULL );
            
            
            
            return true;
            }
            else if(dwReason == DLL\_PROCESS\_DETACH)
            {
            }
            return false;
            

            }

            D Offline
            D Offline
            David Crow
            wrote on last edited by
            #5

            What is at address 0x4E5DA2? The while() loop does not appear to do anything since g_dwGlDrawElements is never NULL. Is that intentional?

            "Love people and use things, not love things and use people." - Unknown

            "The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch

            N 1 Reply Last reply
            0
            • D David Crow

              What is at address 0x4E5DA2? The while() loop does not appear to do anything since g_dwGlDrawElements is never NULL. Is that intentional?

              "Love people and use things, not love things and use people." - Unknown

              "The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch

              N Offline
              N Offline
              nah1337
              wrote on last edited by
              #6

              well the excat error is this : error C2440: '=' : cannot convert from 'unsigned long' to 'void (__stdcall *)(unsigned int,int,unsigned int,const void *)' Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast Error executing cl.exe.

              D 1 Reply Last reply
              0
              • N nah1337

                well the excat error is this : error C2440: '=' : cannot convert from 'unsigned long' to 'void (__stdcall *)(unsigned int,int,unsigned int,const void *)' Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast Error executing cl.exe.

                D Offline
                D Offline
                David Crow
                wrote on last edited by
                #7

                Yes, a GLDRAWELEMENTS_TYPE cast will pacify the compiler. But that may not ultimately solve your problem. What are you trying to do?

                "Love people and use things, not love things and use people." - Unknown

                "The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch

                N 1 Reply Last reply
                0
                • D David Crow

                  Yes, a GLDRAWELEMENTS_TYPE cast will pacify the compiler. But that may not ultimately solve your problem. What are you trying to do?

                  "Love people and use things, not love things and use people." - Unknown

                  "The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch

                  N Offline
                  N Offline
                  nah1337
                  wrote on last edited by
                  #8

                  Well i want to hook opengl gldrawelements and using pointer for it so i have to wait valid opengl pointers also and the GLDRAWELEMENTS_TYPE didnt fix the error or i used it wrongly can u post me the whole line how it should look like ?

                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • World
                  • Users
                  • Groups