私は私を怒らせるこの問題を抱えているので、私はあなたの助けを求めるためにここにいます。単純なウィンドウを作成して表示することになっている次のコードがあります。
void ShowMainWindow() {
WNDCLASSEX main_window_class; // New window class for the splash window //
main_window_class.cbSize = sizeof(WNDCLASSEX); // Set size of the splash window class //
main_window_class.style = CS_PARENTDC|CS_HREDRAW|CS_VREDRAW|CS_DBLCLKS; // Main window class style //
main_window_class.lpfnWndProc = MainProc; // Pointer to the main window procedure //
main_window_class.cbClsExtra = 0; // No extra bytes after class structure //
main_window_class.cbWndExtra = 0; // No extra bytes after window's instance //
main_window_class.hInstance = Instance; // Set instance of the window //
main_window_class.hIcon = LoadIcon(Instance, MAKEINTRESOURCE(MICON)); // Executable's icon //
main_window_class.hCursor = LoadCursor(NULL, IDC_ARROW); // Main window's default cursor //
main_window_class.hbrBackground = HBRUSH(COLOR_WINDOW + 1); // Main window's default background //
main_window_class.lpszClassName = L"MyAppClass"; // Main window's class name //
main_window_class.hIconSm = LoadIcon(Instance, MAKEINTRESOURCE(SICON)); // Application's small icon //
if (!RegisterClassEx(&main_window_class)) { // If the class was not registered //
MessageBox(NULL, L"RegisterClassEx", L"Error", MB_OK|MB_ICONERROR);
}
MainWindow = CreateWindowEx ( // Create the main window //
WS_EX_APPWINDOW, // Extended style to support transparency //
main_window_class.lpszClassName, // Assign the anterior class name //
(WCHAR*)"App Title", // Main window's title //
WS_OVERLAPPEDWINDOW|WS_CLIPCHILDREN|WS_CLIPSIBLINGS, // No border window //
CW_USEDEFAULT, // Default left position for the moment //
CW_USEDEFAULT, // Default top position for the moment //
600, // Main window width //
400, // Main window height //
NULL, // No parent //
NULL, // No ID //
Instance, // Assign to main instance //
NULL // No additional data needed //
);
if (!MainWindow) { // If the window was not created //
MessageBox(NULL, L"CreateWindowEx", L"Error", MB_OK|MB_ICONERROR);
}
long Style = GetWindowLong(MainWindow, GWL_STYLE);
Style &= ~WS_MAXIMIZEBOX;
SetWindowLong(MainWindow, GWL_STYLE, Style);
ShowWindow(MainWindow, SW_SHOWNORMAL); // Display main window at normal size //
UpdateWindow(MainWindow); // Update the window's client area //}
私の問題は、ウィンドウを開いたときのウィンドウのタイトルが「アプリのタイトル」ではなく、いくつかの奇妙な文字と「CreateWindowEx」であるということです。それはとても奇妙です。これは、MessageBox関数からウィンドウのタイトルにそのテキストを割り当てるようなものです。UNICODEエンコーディングを使用することを指定する必要があります。とにかく、それは以前に私に起こったことはなく、私は何が間違っているのかわかりません。ありがとう!