Ahhhhhhhhhhhhhhhhhhhhhhhhhhhhhh!!!
How hard is it to pass a string from one place to another without getting the BSOD!!!! Could anybody here give me a very simple program that will pass a string to a VC++ dll and then modify it and pass it back?? Thats all.
This is what im trying to do (but the not-so-good computer keeps crashing me for trying to do "illegal" things):
Please ignore all of the "mumble-jambo" that u see in there... i just want to be able to pass a string to vc and be able to alter that string...Code:' Visual Basic
Public Declare Function SayHello ( ByRef lpString As String, ' char*
ByRef lpLong As Long, ' int*
ByVal nLong As Long, ' int
ByVal lpFunc As Long ' Complicated :)
' Pointer to function: int foo(void*, int*, int)
) As Long
' The callback part is for emulating an "Event" in VB.
' The Event has to be of the form:
' foo(byref a as object, byref b as long, byval c as long) as long
' temp callback...
Public Function cbFoo( Obj as udtMyUdt, count as long, byval max as long ) as long
// Visual C++
// First the callback definition (to make things easier)
typedef int (*fnCallBack) (void*, int*, int)
int SayHello ( char* lpstr, int* lpn, int n, fnCallBack f) {
strncpy(lpstr, "Do you yahoooo!!", n);
(*lpn) ++; // Ignore this... just changing the value of lpn
return f( lpstr, lpn, n); // Ignore; this will "call the event"
}
EVERYONE that i asked told me a different answer that always seems to crash my program so please dont hesitate, im at the point where i will try ANYTHING (NOT including COM or ATL or MFC)!!
Thanks in Advance.
