In winapi, when creating buttons, the Access violation reading location exception occurs and in debugger writes that hWnd unused = ??? What does it mean?
Create buttons:
case WM_CREATE: // Π‘ΠΎΠΎΠ±ΡΠ΅Π½ΠΈΠ΅ ΠΏΡΠΈΡ
ΠΎΠ΄ΠΈΡ ΠΏΡΠΈ ΡΠΎΠ·Π΄Π°Π½ΠΈΠΈ ΠΎΠΊΠ½Π° easyLevel = CreateWindow("button", "ΠΠ΅Π³ΠΊΠΈΠΉ", WS_CHILD, 420, 250, 150, 25, hWnd, (HMENU)1, ((LPCREATESTRUCT)lParam)->hInstance, NULL); middleLevel = CreateWindow("button", "Π‘ΡΠ΅Π΄Π½ΠΈΠΉ", WS_CHILD, 420, 290, 150, 25, hWnd, (HMENU)2, ((LPCREATESTRUCT)lParam)->hInstance, NULL); hardLevel = CreateWindow("button", "Π‘Π»ΠΎΠΆΠ½ΡΠΉ", WS_CHILD, 420, 330, 150, 25, hWnd, (HMENU)3, ((LPCREATESTRUCT)lParam)->hInstance, NULL); buttonPlay = CreateWindow("button", "ΠΠ³ΡΠ°ΡΡ!", WS_CHILD | WS_VISIBLE, 420, 250, 150, 25, hWnd, (HMENU)100, ((LPCREATESTRUCT)lParam)->hInstance, NULL); buttonExit = CreateWindow("button", "ΠΡΡ
ΠΎΠ΄", WS_CHILD | WS_VISIBLE, 420, 300, 150, 25, hWnd, (HMENU)101, ((LPCREATESTRUCT)lParam)->hInstance, NULL); break; Generation of a field for a sapper game. If the button in the field is a bomb, then write "b" in it.
if (LOWORD(wParam) == 1) { ShowWindow(easyLevel, SW_HIDE); ShowWindow(middleLevel, SW_HIDE); ShowWindow(hardLevel, SW_HIDE); Field myField = Field(10, 10); for (int i = 0; i < myField.getSizeX(); i++) { for (int j = 0; j < myField.getSizeY(); j++) { if (myField.getField()[i][j].isBomb()) { myField.getField()[i][j].setButton(CreateWindow("button", "b", WS_CHILD | WS_VISIBLE, 370 + j * 25, 250 + i * 25, 25, 25, hWnd, (HMENU)(i + j + 1), ((LPCREATESTRUCT)lParam)->hInstance, NULL)); } else { myField.getField()[i][j].setButton(CreateWindow("button", "", WS_CHILD | WS_VISIBLE, 370 + j * 25, 250 + i * 25, 25, 25, hWnd, (HMENU)(i + j + 1), ((LPCREATESTRUCT)lParam)->hInstance, NULL)); // ΠΌΠ΅ΡΡΠΎ, Π³Π΄Π΅ Π²ΠΎΠ·Π½ΠΈΠΊΠ°Π΅Ρ ΠΎΡΠΈΠ±ΠΊΠ° } UpdateWindow(myField.getField()[i][j].getButton()); } } }