How to create a radio button and see if it is checked?

How to create a switch and see if it is checked?

  • Windows Vista li>
  • Dev-c ++
  • Win32 API
  • WM styles
+3
source share
2 answers

To find out if a switch (or checkbox) is checked, send a message BM_GETCHECKto the control and check the return value. You will need HWNDyour control; to get this from the identifier of the control, call GetDlgItem().

+4
source

Use CreateWindow()either the styleCreateWindowEx() button or to create it. For instance:. BS_RADIOBUTTONBS_AUTORADIOBUTTON

HWND radioButtonHandle = CreateWindow(
    TEXT("BUTTON"), TEXT("my radio button"), 
    WS_CHILD | WS_VISIBLE | BS_RADIOBUTTON,
    /* ... */);
+2
source

Source: https://habr.com/ru/post/1734727/


All Articles