CompuServe Messages

#VB string params to DLL

    16-Oct-91 17:27:52
Sb: #VB string params to DLL
Fm: Frank Bielsik 73577,27
To: All
A couple of questions I've run into while trying to get some DLLs (in C) working when called from Visual BASIC… How does one declare in a VB program a DLL function that has a string as a parameter? I'd like the function to remain & work the same as it currently does with other C programs. I'm probably having a problem with VB's variable length strings — how can I declare a C-style fixed length null-terminated string in Visual Basic? As an example, if I had a DLL function like this… VOID FAR PASCAL ReverseString(LPSTR lpsz) { int i; char c; int nLen = lstrlen(lpsz); for (i = 0; i < nLen / 2; i++) { c = lpsz[i]; lpsz[i] = lpsz[nLen – i – 1]; lpsz[nLen – i – 1] = c; } } …how would the function declaration, string, and function call be done in Visual BASIC? Thanks. There is 1 Reply.