-3

I am using win32 API in c++ and I have a static piece of text. How would I delete the static text when the user presses a button? I can't figure out to do that.

toyboat100
  • 11
  • 1
  • 2
  • Impossible to answer accurately without knowing how the static text is created and/or hosted and/or rendered by whatever context in which it appears. My crystal ball tells me the combination of [`GetDlgItem`](https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-getdlgitem) and [`DestroyWindow`](https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-destroywindow) will do what you want, but that's a pure guess based off an inadequate and incomplete description of the running environment. – WhozCraig May 11 '22 at 16:37

1 Answers1

1

Assuming you have the window handle hwnd of the STATIC control, you can delete it via DestroyWindow(hwnd) or simply make it not be visible with ShowWindow(hwnd, SW_HIDE).

jwezorek
  • 8,592
  • 1
  • 29
  • 46