how to enable a control at run time

I have a label that I disable at design time, but I would like to enable 
it at run time and I can't figure out to do this.  I tried using 
showwindow, but all that does is hide the control.

	Z.K.
0
nospam2791 (369)
11/17/2005 7:02:51 PM
vc.mfc 33608 articles. 0 followers. Follow

3 Replies
380 Views

Similar Articles

[PageSpeed] 19

Use EnableWindow:

ASSERT_VALID(pMyControl);
pMyControl->EnableWindow();

More here:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/_mfc_cwnd.3a3a.enablewindow.asp

---------
Ajay Kalra
ajaykalra@yahoo.com

0
ajaykalra (6842)
11/17/2005 7:21:29 PM
In addition to what Ajay answered, make sure that you hook into the control 
with a member variable.  Then you can reference all of the members 
functionality (EnableWindow(), ShowWindow(), etc.) to manage your controls 
based on conditions in the program.  You can also use 
GetDlgItem(IDC_MYCONTROL), but the DDX version is preferred by most.

Tom

"Z.K." <nospam@nospam.net> wrote in message 
news:eAx1Dm66FHA.2384@TK2MSFTNGP12.phx.gbl...
>I have a label that I disable at design time, but I would like to enable it 
>at run time and I can't figure out to do this.  I tried using showwindow, 
>but all that does is hide the control.
>
> Z.K. 


0
tserface (3861)
11/17/2005 7:34:54 PM
Oh okay, I did not see that one.  I was looking for just enable or 
visible.  Thanks.

	Z.K.

Ajay Kalra wrote:
> Use EnableWindow:
> 
> ASSERT_VALID(pMyControl);
> pMyControl->EnableWindow();
> 
> More here:
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/_mfc_cwnd.3a3a.enablewindow.asp
> 
> ---------
> Ajay Kalra
> ajaykalra@yahoo.com
> 
0
nospam2791 (369)
11/17/2005 8:02:11 PM
Reply:

Similar Artilces:

Tree View Control state image list
I'm trying to implement a tree view in an MFC wizard property sheet that has check boxes that can be dimmed. In order to do this, I've created an image list that has the check boxes in each of their 4 possible combinations of unchecked/checked and enabled/disabled (as well as a blank image at index 0). However, when I set this image list as the tree view control's state image list, all I see are blank images where the check boxes should be. (I use the correct state indices when I add the various items. I'm using commctl32 version 5.80 and Visual Studio 2005, so according...

Format Axis
Hi, Using XL 2003. I have a workbook with 3 graphs. Two of the graphs are correct and they both source their data off of a particular worksheet. The third graph is giving me grief as I am not able to have its X-Axis show as time. It sources its data from a different sheet. When I Format Axis, I expect to see Time (X) axis scale Minimum Maximum Base Unit Major Unit Minor Unit Value (Y) blah blah... Instead I get the following: Value (X) axis scale Minimum Maximum Base Unit Major Unit Minor Unit Value (Y) I am missing the base unit. The source data is DEFINITELY a date as I have format...

Error : The Microsoft Jet database engine stopped the process because you and another user are attempting to change the same data at the same time
Dear all, I open a SQL table (connections via ODBC) and want to delete record. I can't delete the record because I get the following error : The Microsoft Jet database engine stopped the process because you and another user are attempting to change the same data at the same time What is the solution for this error ? Thanks. Chlaris ...

why I can not do different things on different CViews at the same time using SDI?
I create two CViews in SDI, i want to play different videos on them at the same time,however,i always fail,i can only see one video showing on one view, nothing on the other view.why? how can i do it using SDI? whether need i use MDI? Could it be because you have chosen SDI, in which there can only be one view at a time? No, that would be too simple an answer... But it's the right answer. Consider, however, using SDI with a splitter window. That should work. joe On 24 Nov 2006 10:36:12 -0800, "shenhua" <mtshenhua@hotmail.com> wrote: >I create two CViews in SD...

Favorite Excel Time Saving Tips
Greetings. I just started working on a web page featuring favorite Excel time saving tips. Unfortunately, it is 9PM, I'm exhausted from watching football and playing with the grandkids and working on taxes. So, I can only think of a few. My favorite is selecting a range of cells, typing or creating an entry, and pressing CTL-Enter to fill the cells. I'm hoping to start a thread of favorite tips to help me create a page of favorite tips. I suspect I will also learn in the process. So, tips appreciated! I'll let the group know when I post the first set of tips (most li...

Microsoft Monthview Control 6.0 (SP6)
Hello, I have an own programm, which use Monthview from MSCOMCT2.ocx. I make wrapper-classes for MonthView. My Programm is - compiled with VC2003, - use mfc71 - UNICODE On - Windows XP - Vista I have no problems to create the monthview objects. On - Windows NT the creating of the monthview-objects fails, GetLastError==0. I make a test with a simple test MFC-Programm. ----------------------------------------------------------------------- Windows NT: I have no problems - if I use Multibyte- Programm. But I use Unicode, the objects are not created. I put mfc7u.dll into the Windows-NT d...

IM-importing gl entry multiple times
When I import a gl entry from Excel, it brings in the entire entry multiple times. It seems that if there are 25 gl accounts used, it brings it in 25 times. I can't find any reason why it does this. Any ideas? Thanks! Tracey D Are you getting 25 entries with one account in each entry? If so, let me lay out the steps you need to verify. 1. You need to have a header query and a detail query. 2. The header query, assuming it's from the same file as the detail query, should be grouped based on a common field. If you view the header query, you should see only one record for e...

Find Available Times
I'm trying to limit resource availability to true work hours of 6 AM to 5 PM, while also having Services that span 1+ days. Is Scheduling Engine functionality capable of Finding Available Times for Resources that do not have consecutive availability of more than 12 hours? What happens now is that if I don't have resource availability of All Day, the Scheduling Engine returns a result of "No results found. Try choosing..." ...

DTPicker: Incrementing Time Value
I have a form with the following DTpicker's InterviewStart (format= "mm/dd/yyyy HH:mm") InterviewEnd (format= "mm/dd/yyyy HH:mm") When the user inserts a record, the InterviewStart field updates to Now(). I would like to set the default value of InterviewEnd to be 1.5 hours from Now(). How does the VBA code look in order to accomplish this? TIA! Hi Brandon, You might try something like: Me.InterviewEnd = DateAdd("h", 1.5, Now()) or Me.InterviewEnd = DateAdd("h", 1.5, Me.InterviewStart Hope that helps... "Bran...

Control Panel Mail Icon not visible Win7 x64
Hello, The mail icon is not visible in control panel for the Outlook 2007 mail icon on Win7 Ultimate x64. How can I restore the icon or run the Mail utility manually? Many thanks ... Andrew Are you looking in the 32 bit area? Andrew_UK wrote: > Hello, > The mail icon is not visible in control panel for the Outlook 2007 mail icon > on Win7 Ultimate x64. How can I restore the icon or run the Mail utility > manually? > > Many thanks ... Andrew Type mail in the start search field of the Start menu or, if you prefer to open control panel, switch t...

Outlook running in background
Outlook 2000 is open when I check the task manager.. I have had this problem and lived with it, but now I installed a Spam program and it won't load when I open Outlook because it is running in the background.. How can I prevent this ...

Formula for adding time
Fred this works the first time but tomorrow when I change the time in b2 the time in b3 does not change. I have been formatting all cells for time " 13:30 ". Is this correct? Doug 1. What happens when you press F9 (recalculate the workbook)? Do you have Calculation set to automatic? In XL2007, use Excel button>Excel Options>Formulas>Workbook Calculation>Automatic. 2. Use whatever format you want. Formats change only the appearance of the cell. Calculations are independent of the format and will be the same regardless of what format you use. Reg...

Running an Embedded object in a Form
Hello All. I have been using access for a short while, and am fairly proficient with querying and write VB code. However, I am completely new to developing forms and reports. I was hoping you could help me. The access database I am working with has a series of reference files (word/pdf). Originally, these files were stored on a central server and we provided links to them, but for various reasons we would like to embed them in access. I was able to add each of the files into a table using the OLE Object type with an associated name and description. The difficulty comes when trying t...

Activex Windows Media Player control issue
I have a form with an Activex WMP control, and I wish to have the control play a .wma file when a command button is clicked. I want the .wma to be determined based on the currently displayed record (i.e. the record refers to a song, and I want that song to play). If I hard-code the path to the .wma into the Player.URL field, it works fine, but if I try to use a variable (constructed from fields and constants), it does not. I get an error "The file you are attempting to play has an extension (.wma") that does not match the file format. Playing the file may result in unexp...

How do i enable the Query Parameter menu option on the External D. #2
I am trying to add a query to my worksheet using a cell as a parameter to the query. But the Query Parameter on the External Data menu option is disabled. How can I enable this. ...

Idle user time-out for GP clients
Does anyone know of a way to automatically logout users that have been idle for a certain length of time? We have a 15 user license but occasionally run short for a time. Some users login just to hold their spot and that means other get locked out. I know we can spend more $$ and get more licenses but it would be nicer if we could prevent users from holding sessions open for long periiods who are not actually doing anything. -- Bruce Elniski IT Manager The DoorStore of Alberta Take a look at the Omni Tools available from Rockton software www.rocktonsoftware.com The module within Omn...

Can I make multiple excel workbooks populate information to one main wrkbk real time?
To give you an idea of what I am trying to accomplish... I run a mortgage company and I have about 16 loan officers I personally manage. Currently each of them keep their own excel pipeline of loans in progress in their personal folder on the server, of which I have to go into each one to check on. I can design the new pipelines however here is my main goal. I'd like to create one large read only (to them) pipeline with all the loan officers names in it, along with the appropriate info to the loan. I would like to create personal pipelines for each of them to input their data into. I ...

eacht time outlook is sending 11 items and it failes
So this always gives me a send and receive error. Those messages are not in the outbox. pls help. Krgds, Arjan ...

Access Runs Non-Existing Function
I've running a function from the On Close of one of my forms for years. In wanting to know what the code is since I haven't seen it for a while I have found that the function doesn't exist. A search of all 4 of my code modules didn't turn up the function name. When I take the code out of the On Close of the form the code doesn't run. "JamesJ" <jjy@darwin_roadrunne0r.com> wrote in message news:%23kyymGrZKHA.1640@TK2MSFTNGP06.phx.gbl... > I've running a function from the On Close of one of my forms > for years. > In wanting to know ...

How do I tell if the server is running Enterprise or Standard
Hello, If I open ESM - I can tell it is 6.5 but how do I tell if it is Enterprise or Standard. The store is small so I can't tell what version it is. I don't want to assume it is standard or enterprise. Thanks PS When will MS just let you open ESM go to help about and see EXCHANGE 2003 SP2 Enterprise. I don't understand why they can do that in 50 other products but still don't do it in SQL or Exchange. On Sat, 18 Mar 2006 08:00:45 -0800, "Boe" <boe_d@notspam.hotmail.com> wrote: >Hello, > >If I open ESM - I can tell it is 6.5 but how do I t...

Run excel when logged off.
Is it possible to run excel when I'm logged of the computer? I have a excel document that launches a bunch of macros. I would like to have task scheduler run it at night without me being logged in. Is that possible? Thanks, Jasper What happens when you try? Of course if you try accessing "mapped drives", you will have to fix that issue too. Jaz wrote: > Is it possible to run excel when I'm logged of the computer? > > I have a excel document that launches a bunch of macros. I would like to > have task scheduler run it at night without me being logged in...

Task default due time
Is there a configuration setting the change the default due time of tasks from 12:00AM? Am I missing something but what is the reasoning for it defaulting to an odd hour in the first place. Thanks, John ...

Calendar Time Zones
I recently moved from the Eastern Time Zone,and therefore switched my computer to Mountain Time Zone. Calendar events (birthdays, holidays, etc.) which were scheduled as all day events now stretch over two days, being two hours in one zone and 22 in the new zone. How do I get these events to appear only on the given day in the Mountain zone (e. g. Christmas on December 25th only). -- Ar Dub Group your Calendar by Category and remove the Holidays. Then add them again through Calendar Options... -- Robert Sparnaaij [MVP-Outlook] www.howto-outlook.com Tips of the month: -What do the ...

macro process running in task manager after the job is done 01-02-08
I've done that. It closed out the ms access application, but the process is still hanging with zero cpu utilization. I found out that when you click the macro it works. It runs the macro. After it finishes, ms access closes and there is no process in the task manager. The problem occurs when you use the windows scheduler and try to schedule it. The scheduler runs the macro to the end, but leaves the process in the task manager even though the ms access application is closed. How can I fix this problem in the windows scheduler? > "Steve Schapel" wrote: &g...

question about ms-flexgrid control
hi all i have a question.when i want to insert a flex-grid control on my dialog it gives me a message about "design-time licence".can any one help me what is it. best regards, amir ...