I get compile error c2440 it tells me cannot convert from void please help
-
#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;
}
-
#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;
}
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++ -
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++ -
-
#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;
}
What is at address
0x4E5DA2
? Thewhile()
loop does not appear to do anything sinceg_dwGlDrawElements
is neverNULL
. 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
-
What is at address
0x4E5DA2
? Thewhile()
loop does not appear to do anything sinceg_dwGlDrawElements
is neverNULL
. 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
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.
-
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.
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
-
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