   Function problem
  I got this code. It isn't supposed to do anything special. I'm only trying to get a function from divx.dll. #include <windows.h>#include <mmsystem.h>#include <iostream.h>typedef LRESULT (*MYPROC)(DWORD, HDRVR, UINT, LPARAM, LPARAM);HMODULE hMod;int main(){MYPROC pDriverProc; hMod = LoadLibrary("c:\\windows\\system32\\divx.dll");if(!hMod){cout << "LoadLibrary failed!\n";return 0;}pDriverProc = (MYPROC)GetProcAddress(hMod, "DriverProc");if(!pDriverProc){cout << "GetProcAddress failed!\n";return 0;}(pDriverProc)(0,0,0,0,0);FreeLibrary(hMod); return 0;}It compiles fine but when I run it I get this error when it comes to the line "(pDriverProc)(0,0,0,0,0);":"Run-Time Check Failure #0 - The value of ESP was not properly saved across a function call.  This is usually a result of calling a function declared with one calling convention with a function pointer declared with a different calling convention."I'm using MSVC++ 6.0.Is it anyone who knows why I'm getting this error?[edited by - emilbbb on May 12, 2004 8:13:53 PM]
  You''re probably getting the error because you''re calling a function pointer with the wrong calling convention. What''s the default calling convetion for your project? If it''s __stdcall try declaring the function pointer as __cdecl. If it''s __cdecl try declaring the function pointer as __stdcall. 