Essentially you need to return a DWORD pointer to a char pointer :
DWORD ReverseString( DWORD pOldString, DWORD pStringIn )
{
// Delete old string
if(pOldString) g_pGlob->CreateDeleteString ( (DWORD*)&pOldString, 0 );
// Return string pointer
LPSTR pReturnString=NULL;
// If input string valid
if(pStringIn)
{
// Create a new string and copy input string to it
DWORD dwSize=strlen( (LPSTR)pStringIn );
g_pGlob->CreateDeleteString ( (DWORD*)&pReturnString, dwSize+1 );
strcpy(pReturnString, (LPSTR)pStringIn);
// Reverse the new string
strrev(pReturnString);
}
// Return new string pointer
return (DWORD)pReturnString;
}
You need to use the CreateDeleteString to deallocate previous string memory and allocate new memory.
Then, in the resource file, you use 'S' as the input/output parameter, so its something like :
reverseString[%SS%ReverseString%Reverses a string
If your not going to return a string (ie its just passed as a parameter), then
DWORD pOldString isn't needed.
The command will then be called using :
a$=reverseString("TEST") - Note : 2 parameters are not passed, as we should not count
DWORD pOldString as one.
Come to the UK Convention on the 23rd & 24th of October