Hello, I have an application made in C NOT C++ in which when painting or creating a LISTBOX control it gives the error Exception code: 0xc000041d in the CreateWindow statement in WINDOWS 11 24H2
Villarreal, Jesus
0
Reputation points
Hello, I have an application made in C NOT C++ in which when painting or creating a LISTBOX control it gives the error Exception code: 0xc000041d in the CreateWindow statement in WINDOWS 11 24H2 Has anyone else had this happen to them and how did they correct it? Does continuing to use this language in this Windows 11 24H2 operating system have any expired support? ...
Why does my application work in Windows 23H2?
ejem
LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) {
WNDCLASS wc = {0};
wc.lpfnWndProc = WndProc;
wc.hInstance = hInstance;
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.hbrBackground = (HBRUSH)(COLOR_WINDOW + 8);
wc.lpszClassName = "MiClaseVentana";
RegisterClass(&wc);
HWND hwnd = CreateWindow("MiClaseVentana", "Ejemplo de ListBox",
WS_OVERLAPPEDWINDOW | WS_VISIBLE,
CW_USEDEFAULT, CW_USEDEFAULT, 400, 300,
NULL, NULL, hInstance, NULL);
// Bucle
MSG msg;
while (GetMessage(&msg, NULL, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return msg.wParam;
}
LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) {
switch (msg) {
case WM_CREATE: {
// Crear el ListBox
HWND hwndListBox = CreateWindow("LISTBOX", NULL,
WS_CHILD | WS_VISIBLE | LBS_NOTIFY,
10, 10, 200, 150,
hwnd, (HMENU)ID_LISTBOX,
((LPCREATESTRUCT)lParam)->hInstance, NULL);
break;
}
case WM_COMMAND: {
if (LOWORD(wParam) == ID_LISTBOX
&& HIWORD(wParam) == LBN_SELCHANGE) {
HWND hwndListBox = (HWND)lParam;
int index = SendMessage(hwndListBox, LB_GETCURSEL, 0, 0);
char buffer[256];
SendMessage(hwndListBox, LB_GETTEXT, index, (LPARAM)buffer);
}
break;
}
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefWindowProc(hwnd, msg, wParam, lParam);
}
return 0;
}
Sign in to answer