With some help I was able to get a callback to a DLL to work and pass the correct parameter values back and forth (by changing the callback function to a callback sub), however after the sub is called and does what it is supposed to do the program crashes with the following error it has a long description, so whatever I'm doing wrong must be pretty bad :

Microsoft Visual C++ Debug Library
Debug Error!
Program: (the app)
Module:
File i386\chkesp.c
Line: 42

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 convetion with a function pointer declared with a different calling convention.

That's basically it. If anyone wants source code or can help in any way I would greatly appreciate it.
Thanks