I have a game sapper. When you press the select button, the difficulty level starts like this
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()); } } }
This code displays the field on the screen. But when you call getField, the Access violation reading location exception occurs.
HWND
? - AnT pm