|
CApplication app;
...
app.Quit;
system
|
|
|
|
|
Hi,
I found the code below work, but got a problem.
_variant_t var(NULL);
app.Save(var);
If I choose cancel in the SaveAs dialog, the will be an error that says Save method is invalid.
Any suggestion?
system
|
|
|
|
|
hi ,
I have a application to disable buttons .
Example :
There are 50 buttons , If i put 20 in the text box 20 buttons should be shown . Please tell me using ARRAY .
Because i have done it manually i.e
Getdlgitem(id_button)->enablewindow(true);
I need using ARRAY because ,there r 50 buttons know ..
With warm regards
K.Guru moorthy
k.guru moorthy
|
|
|
|
|
The real question is, "Why is your window having 50 buttons on it?".
Anyways, if the IDs of the buttons are sequential, you may run a loop and call EnableWindow(true) from within it.
|
|
|
|
|
v are using for calender appli ,Small buttons .
Say how to do using array
k.guru moorthy
|
|
|
|
|
What array are you talking about? Your controls should have been defined like this:
#define IDC_BUTTON1 1000
#define IDC_BUTTON2 1001
#define IDC_BUTTON3 1002
#define IDC_BUTTON4 1003
#define IDC_BUTTON5 1004
#define IDC_BUTTON6 1005
If they are defined sequentially, then you may run a loop like this to enable or disable them:
for(int i = IDC_BUTTON1; i<= IDC_BUTTON6, ++i)
{
GetDlgItem(i)->EnableWindow(true);
}
|
|
|
|
|
thanks. it works fine
k.guru moorthy
|
|
|
|
|
You must be absolutely sure that you don't have duplicate IDs for your controls (the compiler will warn you though). If you have duplicate IDs, the loop won't go through as you expect it to.
|
|
|
|
|
Well, if the button IDs are contiguous then you simply make an iteration
for (int i=0; i < iEnabledCount; i++)
{
GetDlgItem(ID_BUTTON0 + i)->EnableWindow(TRUE);
}
On the other hand, if the button ID s are sparse, you may use an array:
UINT uBtnId[]= { ID_BUTTON0, ID_BUTTON1, ... };
for (int i=0; i < iEnabledCount; i++)
{
GetDlgItem(uBtnId[i])->EnableWindow(TRUE);
}
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
5! Good thing you explained him of using an array - I simply did not get what he was asking to do with an array. Monday is CPMRU rest day, you see.
BTW, I love infinite loops like this:
while(2)
{
}
|
|
|
|
|
Rajesh R Subramanian wrote: BTW, I love infinite loops like this:
while(2)//Be twice as confident!
{
//do stuff here
}
I like the infinite-almost-for-sure ones:
while (! ProtonDecayOccurred )
{
}
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Rajesh R Subramanian wrote: while(2)//Be twice as confident!
hmmm....I don't agree. 2 in binary is still only 1 set bit.
I'd use 3 so if one of the bits fails there's another to fall back on.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi all,
How CPU usage is calculated under windows?
- Vikram S
|
|
|
|
|
GetProcessMemoryInfo,GetSystemTimes and GetPerformanceInfo may be of some help.
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
I don't want the CPU usage but I am interested in knowing how it is calculated.
|
|
|
|
|
the API access the hardware directly...
|
|
|
|
|
Again I want to know
is there any formula which they use to calculate CPU usage.
As far I know any process can use either 0% or 100% CPU at specific instance. So as a result I wanted to know
1) Do they use some time frame to calculate CPU usage?
2) What about multi core systems? What is formula for calculating CPU usage for this kind of hardware?
|
|
|
|
|
Hi,
this will show you how it can be done.
Assume you go to the shopping mall; don't forget to carry your watch.
Note the entry time ("mallStart")
Now for an arbitrary number of iterations:
- choose a shop i
- note entry time ("istart")
- wander around
- note exit time ("istop")
At the end, note the time you leave the mall ("mallStop")
Now the total time was mallStop-mallStart
and the time spent in shop i was istop-istart (or if you went to shop i more than once, it
was sum of each of the istop minus sum of each of the istart)
And the fraction of time alloted to shop i was (istop-istart)/(mallStop-mallStart)
If you add all the fractions, you will end up less than one, the remainder is the time
spent in the mall but outside the shops, let us call it the idle time.
Now imagine you are a CPU, and the shops are the processes that need to run. There you go.
|
|
|
|
|
Thank you very much: now I understand why female processes take far more CPU time than male ones.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
|
Fix occurred here. Remember to feed your troll today.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Thanks for the fix.
I think the troll's name should be uni-puke.
|
|
|
|
|
Thanks for detailed information !
|
|
|
|
|
I have derived my own custom class from MFC CTreeCtrl and using this arical
http://www.codeguru.com/cpp/control...ticle.php/c723/
I have made multiple tree selection possible. Now the problem comes while deleting multiple items. I am finding it very complex logically.
The problem is while deleting multiple items, [B][I]"if one of the selected items is a child item and its parent is deleted first, then all the children will be deleted too and all the information about the deleted item will be lost."[I][B].
Can someone help me in finding a good solution? Thanks in advance
Maverick
|
|
|
|
|
you can delete the selected children first. If after deletion you have some nodes that are still existing you don't delete the parent else you can delete it. You can implement a recursive function for this.
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|