0

I am quite new to GLFW and I just wanted to know how my code was going right. I used Win32 API because I don't like console pop up in my program. I set my error callback as below:

static void glfwError(int id, const char* description)
{
    MessageBox(NULL, (LPCWSTR)description, L"Error", MB_OK);
}
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
    glfwSetErrorCallback(&glfwError);
}

The problem is, it did show Chinese however hard I tried. Can anyone help me???

  • They told me to disable unicode mode but I simply couldn't find it out. – user16882937 Sep 11 '21 at 07:30
  • Right now you are mixing two character sets. You pass an 8-bit string to a function that expects a wide string. The compiler was trying to tell you that this was a bad idea (via a compiler error), but you used a cast to say "Trust me, I know what I'm doing. Let me break the rules." And it turns out that it didn't work. One option is to use the `MessageBoxA` function, which accepts an 8-bit string. – Raymond Chen Sep 11 '21 at 13:58

0 Answers0