I have a group box on which there are three buttons. When you click on one of them, this group box should become invisible. I tried SetWindowLong, but it does not work. Maybe she is not in the subject at all (I don’t know English, so I don’t understand English-speaking resources). In general, the question is: how to change the styles of elements? When you click on the button, the whole window hangs, although if you remove SetWindowLong and leave the MessageBox, then everything is fine. Where could screw up?

LRESULT CALLBACK GrpBoxWndProc(HWND hGroupMainMenu, UINT message, WPARAM wParam, LPARAM lParam) { LONG style; switch (message) { case WM_COMMAND: if(wParam == BM_NEWGAME){ MessageBox(NULL,_T("DFGGDF") , _T("Win32 Guided Tour"), NULL); style = GetWindowLong(hGroupMainMenu,GWL_STYLE); style = style = style || WS_BORDER ; SetWindowLong(hGroupMainMenu,GWL_STYLE,style); } break; default: return DefWindowProc(hGroupMainMenu, message, wParam, lParam); break; } return 0; } 
  • 2
    That programmer who does not know English is bad ... - AseN
  • I do not argue ... it interferes with rapid growth - Dimka
  • Everything seems to understand! This is a global re-draw of the Group box. - Dimka
  • If that, I then wrote the “group box” solely for the sake of petrosyanism, and so it is groupbox :-) And I think the style should be reset to WS_VISIBLE. - karmadro4
  • one
    I used to enjoy watching G.V. Petrosyan, and therefore supported. As for Visible, it is yes, but in my case of studying these things, even the use of a line turns out to be incomprehensible. - Dimka

1 answer 1

  1. After performing the line

    style = style = style || WS_BORDER;

the style variable will contain 1, since it is not the bitwise addition of '|', but the logical one ('||').

  1. Why do 2 assignments ??
  • I understand misunderstanding, this is because I still do not understand everything myself, and this understanding was introduced to my understanding by one of the goooogle examples of examples. - Dimka
  • I decided not to blow up the brain with so many words "understanding")) If you need to remove the WS_BORDER flag, then you need to write: style & = ~ WS_BORDER; - AlekseyOk