The SetWindowText
function expects a pointer to a nul-terminated string. But you're trying to pass it a single character.
As a commenter mentioned, this code shouldn't even compile. You mention something about "needing to precast everything". This is likely the problem. Casting is like telling the compiler "don't worry about it, I know what I'm doing". But in this case, you don't. The compiler errors were trying to protect you from making a mistake, you should have listened.
Change the code to look like this:
// Declare a character array on the stack, which you'll use to create a
// C-style nul-terminated string, as expected by the API function.
wchar_t str[2];
// Go ahead and nul-terminate the string, since this won't change for each
// loop iteration. The nul terminator is always the last character in the string.
str[1] = L'\0';
for (i = 0; i < 15; i++)
{
// Like you did before, except you're setting the first character in the array.
str[0] = L'a' + i;
SetWindowText(game_board[i], str);
UpdateWindow(game_board[i]);
}
Note the L
prefix. That indicates to the compiler that you're using a wide character/string—required for the wchar_t
type.