Unable to hide an edit control programmatically

Ramesh Deekonda 216 Reputation points
2021-06-13T15:45:21.747+00:00

Hi,

I am unable to hide an edit control on a property page using ShowWIndow(SW_HIDE). For the edit controlI have defined a control variable
noOldZipBackups of type CEdit .Then I have tried noOldZIpBackups.ShowWIndow(SW_HIDE), and also tried using the Item ID GetDlgItem(IDC_NOOLDZIPBACKUPS)->ShowWindow(SW_HIDE).I also tried hiding using the window handle of control.

I have traced execution of the program in the debugger but could not point out the problem. Problem appears with any edit control on the page.
I am calling the hide logic in the handler of a list box and also in the WM_PAINT handler of other controls on the property page.
The ShowWindow call is in the main user interface thread and not in a worker thread.
I have also tried ShowWindowAsync but still could not hide the control.

Windows API - Win32
Windows API - Win32
A core set of Windows application programming interfaces (APIs) for desktop and server applications. Previously known as Win32 API.
2,427 questions
C++
C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,540 questions
{count} votes

Accepted answer
  1. Guido Franzke 2,196 Reputation points
    2021-06-14T05:58:20.177+00:00

    Hello,
    I've had this problem before too. I got rid of it by redrawing the whole property page instead of only the single edit control (this is done by ShowWindow already too).
    Instead of "m_NoOldBackups1.UpdateWindow();" try "RedrawWindow();".
    Regards, Guido

    Edit: which VS are you using?


0 additional answers

Sort by: Most helpful