Hiding Controls at runtime

I am using VC++ 6 and am trying to hide controls at runtime given various conditions, but have been unsuccessful to this point figuring out how to do this. It is very easy in VB, so I am not sure what the problem is. I have edit controls and comboboxes that I would like to hide/show given certain criteria. Disabling might be a better option as well.

Are you using a dialog box? If so have you used class-wizard to setup a CONTROL variable for each edit box and/or combobox you want to control?

If you do not have control variables setup, you can still use GetDlgItem() to get a handle to the control.

Once you have a control handle (either setup by class-wizard, or done in code using GetDlgItem() ), you can simply call ShowWindow() with either 'TRUE' or 'FALSE' and this should allow you to show or hide the window.

These are windows API functions, not MFC. MFC specifically hides HWNDs whenever possible, because they're not object oriented. take a look at the api, it has all sorts of nifty functions like DestroyWindow, GetWindowText, ResizeWindow, etc. They're all exposed in CWnd's functions, if you can get a CWnd, but they're origionally API calls.

You are problaby right. I just make the comment because the question was posted in the MFC area. Not looking for points for it, just trying to help people along where I can, so that when i need help, people will do the same for me =)

0

Featured Post

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Introduction:
Dialogs (1) modal - maintaining the database.
Continuing from the ninth article about sudoku.
You might have heard of modal and modeless dialogs. Here with this Sudoku application will we use one of each type: a modal dialog …

Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"!
Step 1: Open a new google tab
Step 2: Go to the left hand upper corn…