Ok, so I'm trying to retrieve the text of a windows GUI control--an edt box to be specific. Here's the function:
DLLEXPORT DWORD GetElementText(HWND hWnd)
{
char szText[100];
GetWindowTextA(hWnd, szText, 100);
return DBPString(NULL, szText);
}
Initially the problem was that this function was simply returning a blank string--naturally I thought that I wasn't using GetWindowText() right, so I decided to check what szText contained after the function by calling PrintStringFunction(). And that's when I encountered a strange problem. If I change the string table so that DBP thinks the function is returning a DWORD, then the string is printed, and accurately represents what's in the edit box. It doesn't matter what I return--I can return a string using DBPString, or I can return a number--as long as I tell the string table I'm returning a DWORD szText is printed correctly. However as soon as I change the string table to return a string, szText no longer prints. It doesn't matter what string I return--it can be a blank string or szText--it simply doesn't print. Any ideas what's going on here?
i like orange