Firstly, the dbMid command takes an extra string as the first parameter (The string that it will be replacing). You can pass NULL if there is nothing to replace.
Secondly, once you receive the string returned by dbMid, you need to free it before the end of your for loop. (You should use CreateDeleteString for this, which can be found in globstruct.h)
Thirdly, if you are going to use the DBP commands, you need to make sure that the required dlls are included in the .exe. In your example, you haven't used any string commands in your test program, and so the string .dll was never included. Put 'temp$ = mid$("",1)' at the bottom of your test program, and run it again. The same applies to 'dbPasteImage'
Fourthly, you never increase the variable 'b' in your loop, causing an infinite loop!
That way is very inefficient anyway, here is a much better and easier way:
MYCOMMAND void c_pastefont(LPSTR names,int xx,int yy)
{
if (names)
{
for (char* b=names ; *b; b++)
{
dbPasteImage(*b,xx,yy);
xx+=32;
}
}
}
This works, because LPSTR is just another way of saying char* (a pointer to a char, or an array of chars). A char contains the ascii value for the letter it represents, so there is no need to use dbAsc. Increasing the value of 'b' (b++) is another way of advancing to the next character in the string. All DBP strings end with a NULL, so we know where the end of the string is. The condition in the for loop ('*b') checks if the character pointed to by 'b' is not NULL. (If it's not NULL, then it's not the end of the string yet
). Also, I added an if statement to make sure that 'names' is not a NULL pointer. If it was, it would have caused your example to crash with a fatal exception.