سؤال

I want to change the font of the richedit control in my win32 program to Consolas. When i try to do the following:

CHARFORMAT2 cformat;
cformat.dwMask = CFM_FACE;
cformat.cbSize = sizeof(cformat);
cformat.szFaceName = "Consolas";

On the last line it says that

Expression must be modifiable value

What is the problem here?

Regards,

Devjeet

هل كانت مفيدة؟

المحلول

From the documentation, you can see that szFaceName is an array. You cannot assign to an array that way. (That's what the compiler is trying to tell you. You're trying to assign "Consolas" to something that cannot be modified in that way.) You need to use a string copy function.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top