|
Hello!!
There is a setting in the control panel -> Power Options-> Power schemes tab, for setting Standby and Hibernate time. i.e. after what unit of time the system should go into stand-by state and similar combo box is also present for hibernate state.
I have tried to use the API GetCurrentPowerPolicies(). In this, a structure is filled for POWER_POLICY->MACHINE_POWER_POLICY. In that, according to MSDN, values for stand-by and hibernate should get filled , but it does not.
I am getting the time for disk spindown and video time out and also the Power Scheme, but I am not getting the standy-by and hibernate time.
Can anyone of you tell me how to obtain the standby and hibernate time.
Thanks in advance.
|
|
|
|
|
I HAVE NOTICED WHEN TYPING IN A ENTRY BOX MY CURSOR DISAPPEARS. WHEN I TAB OFF THE CURSOR COMES BACK
THE PROBLEM THAT I HAVE NOW IS IF I TAB FROM AN ENTRY BOX TO A COMBO BOX ( I HAVE SET IT AUTO OPEN)I LOOSE THE CURSOR AND CAN NOT GET IT BACK UNTIL I SELECT AN ITEM FROM THE COMBO LIST. IS THERE A WAY TO BRING THE CURSOR BACK.
THANK YOU.
|
|
|
|
|
THIS IS DEFINED BEHAVIOUR IN WINDOWS
P.S. DON'T SHOUT.
Christian
I am completely intolerant of stupidity. Stupidity is, of course, anything that doesn't conform to my way of thinking. - Jamie Hale - 29/05/2002
Half the reason people switch away from VB is to find out what actually goes on.. and then like me they find out that they weren't quite as good as they thought - they've been nannied. - Alex, 13 June 2002
|
|
|
|
|
hi all,
i met a bug that appear after my program run for few days. my program is monitoring a CAN card with a thread.
it run in win98. i found there is access violation for my code after it run for few days.
do you have any experience to check with such bugs? i really have no idea how to check for these error.
thanks,
jim
|
|
|
|
|
If you can, run the program in the debugger for a few days. If you don't have that option, then take a look at this article.
http://www.codetools.com/debug/postmortemdebug_standalone1.asp
Tim Smith
I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?
|
|
|
|
|
IME, things that break after running for a while almost always have to do with resource (Memory, GDI, etc.) leaks.
Next time the thing crashes, take a look at the registers: If "EAX" is equal or close to 0x00000000, or 0xFFFFFFFF, then I would bet that you are experiencing a leak-related problem (and a pointer/return-value checking problem, as well).
If you can get a development environment on the machine it crashes on, build and run a debug version (standalone, do not run it under the debugger), and attach the debugger to it when it finally crashes. That should give you a start in locating the problem areas. Why not run it under the debugger at first? It adds another variable to the mix (as if the debug version would not be enough changes).
Peace!
-=- James.
"Some People Know How To Drive, Others Just Know How To Operate A Car."
[Get Check Favorites 1.4 Now!]
|
|
|
|
|
There is an interesting behaviour, in that when I repaint something twice with the same string in GDI+ it becomes brighter, so I was wondering if the way that it paints the same string is not consistent.
I tried to test this by setting the background to black, and repainting the string with the background color, then repainting another string. If you look closely you can see the residue of the first DrawString(alot more aparent if you set background to brighter color).
Code Snippet:
<br />
Graphics g();<br />
SolidBrush b(Color(255, 0, 0, 255));<br />
SolidBrush bk(Color(255, 0, 0, 0));<br />
<br />
<br />
g.DrawString(A2CW("100"), -1, &font, pointF, &b);<br />
g.DrawString(A2CW("100"), -1, &font, pointF, &bk); <br />
g.DrawString(A2CW("101"), -1, &font, pointF, &b);<br />
So question is: Is this a feature, or am I missing something basic, or is it something so obvious that I should just rest, and think about it when I am up to speed again?
Side Note: Don't really consider this a VC++ question though posted here for a lack of a more suitable forum...
|
|
|
|
|
If you're drawing using smoothing, there may be some alpha blending going on, which would account for the brightening.
Christian
I am completely intolerant of stupidity. Stupidity is, of course, anything that doesn't conform to my way of thinking. - Jamie Hale - 29/05/2002
Half the reason people switch away from VB is to find out what actually goes on.. and then like me they find out that they weren't quite as good as they thought - they've been nannied. - Alex, 13 June 2002
|
|
|
|
|
Went back and rechecked my assumptions, realized the default wasn't high quality. I take that to mean the algorithim used to fill doesn't always produce the same pixels.
Thanks for the input, that made me even more eager to look around tonight. Wish MSDN docs were more detailed on this subject.
|
|
|
|
|
I'm new to MFC, so forgive me if this is a dumb question, but I'm playing with the idea of creating my own Super-Toolbar class and I figured that the best way to go about it might be to derive a new class from "CRebar" or "CControlBar". However, if I go into the MFC ClassWizard and try to add a new class, neither of those classes are listed in the "Base Class".
What up with that?
-John
"Ask me about my vow of silence"
|
|
|
|
|
The base class list is not terribly complete. You're going about it the right way, but you'll need to manually derive from those classes. Also, do you realise the code for CToolbar is installed with VC ? So you can look at what they do if you need ideas.
Christian
I am completely intolerant of stupidity. Stupidity is, of course, anything that doesn't conform to my way of thinking. - Jamie Hale - 29/05/2002
Half the reason people switch away from VB is to find out what actually goes on.. and then like me they find out that they weren't quite as good as they thought - they've been nannied. - Alex, 13 June 2002
|
|
|
|
|
Ok cool, that's kinda what I figured.
As I said, I'm new to the MFC thing, so forgive me if this sounds dumb, but if I make a new class manually is that gonna screw anything up with the whole way the AppWizard junk works? Also, what's your take in general on using the AppWizard? It seems like in some ways it makes things a bit easier to manage, but the code it spits out is ugly and at this point I'm constantly worried that I'm gonna do something to trip it up. Any words of wisdom?
Also, that's cool that the CToolbar code is included. Do you happen to know where I'd find that, as well as other classes? I think looking at what they're doing for their classes might be a great way for me to really figure this stuff out.
Thanks!
-John
"Ask me about my vow of silence"
|
|
|
|
|
Teknofreek wrote:
if I make a new class manually is that gonna screw anything up with the whole way the AppWizard junk works?
To be honest, I'd suggest the sooner you learn enough to not use the appwizard, the better. But if you derive from another class instead, then go through your class and change what it derives from, it should be OK.
Teknofreek wrote:
Also, what's your take in general on using the AppWizard? It seems like in some ways it makes things a bit easier to manage, but the code it spits out is ugly and at this point I'm constantly worried that I'm gonna do something to trip it up. Any words of wisdom?
Dunno about wisdom, but I'd suggest the best approach is to learn how to do it all yourself, then use the appwizard for speed, knowing that if it screws up ( and it will ), you know how to fix it manually. There are no manly points for not using a time saving tool, but you should be be dependant on it.
Teknofreek wrote:
Do you happen to know where I'd find that, as well as other classes?
I believe there is an MFC sub directory in the whole structure of VC. To be honest, I can never remember. I'd just start at the top and do a find in files for something like CToolbar::, that's bound to bring it up. Also, often these things are defined across multiple files, so the CToolbar:: search should find them all.
Christian
I am completely intolerant of stupidity. Stupidity is, of course, anything that doesn't conform to my way of thinking. - Jamie Hale - 29/05/2002
Half the reason people switch away from VB is to find out what actually goes on.. and then like me they find out that they weren't quite as good as they thought - they've been nannied. - Alex, 13 June 2002
|
|
|
|
|
Christian Graus wrote:
But if you derive from another class instead, then go through your class and change what it derives from, it should be OK.
Ok, cool.
Christian Graus wrote:
Dunno about wisdom, but I'd suggest the best approach is to learn how to do it all yourself, then use the appwizard for speed, knowing that if it screws up ( and it will ), you know how to fix it manually. There are no manly points for not using a time saving tool, but you should be be dependant on it.
Sounds like sound advice
Christian Graus wrote:
Also, often these things are defined across multiple files, so the CToolbar:: search should find them all.
Good call. Thanks again man!
-John
"Ask me about my vow of silence"
|
|
|
|
|
I have a seemingly small problem that is driving me insane. I can not seem to get to create an ImageList that is masked by another Bitmap (NOT just a single color). I didn't have too much trouble with this in Win32, but I can't seem to get it to work using MFC no matter what I try.
// What I've done is that I've created a Toolbar, like so:
m_wndToolBar.CreateEX ( this, TBSTYLE_FLAT | TBSTYLE_TRANSPARENT, WS_CHILD | WS_VISIBLE /*etc*/ );
// Then, I tried to create the ImageList like so:
CImageList tbImgList;
CBitmap tbBMP_Color;
CBitmap tbBMP_MASK;
tbBMP_COLOR.LoadBitmap ( IDB_MAIN_TOOLBAR_I );
tbBMP_MASK.LoadBitmap ( IDB_MAIN_TOOLBAR_A );
tbImgList.Create ( 24, 24, ILC_COLOR24 | ILC_MASK, 0, 0 );
tbImgList.Add ( &tbBMP_COLOR, &tbBMP_MASK );
// Then I try to Set the ImageList like so:
m_wndToolBar.SetImageList ( tbImgList );
tbImgList.Detach();
tbBMP_COLOR.Detach();
tbBMP_MASK.Detach();
But for some reason it doesn't seem to work right. I'm using a 24-bit BMP for the color and an 8-bit BMP for the mask. I've also tried creating an HIMAGELIST instead and set it using SendMessage with a TB_SETIMAGELIST command, but that doesn't work either. The same scenario both ways masks just fine if I use a single color instead, like so:
tbImgList.Add ( &tbBMP_COLOR, RGB(255,0,255) );
Does anyone have any insight to this? I fear my sanity depends on it
-John
"Ask me about my vow of silence"
|
|
|
|
|
I meet the same error as you
But dont't know the reason !!
Who knows ??
It's me, code_cold
|
|
|
|
|
When I press ESC or ENTER key,the MediaPlayer will stop.
How can i disable ESC and ENTER in MediaPlayer OCX.
TNKS!
|
|
|
|
|
I'm trying to write a basic dialog program with MFC that loads a file up, lets you edit it then lets you save it so I can add a file to the games I've started making. Simple enough I thought It loads up the file fine, it lets you edit it to your hearts content in the control, but saving it it adds the characters ÿ to the first line of the file at the start :/ For the life of me I don't have a clue what its doing or why its doing it but I'm needing it to play nice and not do it
Using TRACE commands I've seen that its not adding the chars to the CString I'm using to hold all the data before its saved, its only when its saved that its added.
newDiz.Open("file_id.diz",CFile::modeCreate|CFile::modeReadWrite);
CArchive diz(&newDiz,CArchive::store);
diz << m_dizView;
diz.Close();
newDiz.Close();
Thats with newDiz being a CFile and diz obviously being a CArchive Using code like that before its worked in another program I wrote but in this one its being a pain in the bum.
Has anyone any idea why it would add these characters to the start of the file? Thanks for your help
|
|
|
|
|
Hi all,
Can anybody point out any site for window XP tips?
thanks
regards
/rsasalm
|
|
|
|
|
|
Hi,
i have some problems with getting info whether the given parent item is expanded or collapsed. My code is:
if (TVIS_EXPANDED == m_cMyTree.GetItemState(hMyTreeItem,TVIF_STATE))
else
but it seems not to work, and I cannot find info on this. Could you please help?
Thanks
R.
|
|
|
|
|
I might be wrong but have you tried.....
if (TVIS_EXPANDED == m_cMyTree.GetItemState(hMyTreeItem,TVIS_EXPANDED))
//Expanded
else
//not expanded
Or something like that, there is an axample in the MSDN Library that seems to indicate you need to change TVIF_STATE to TVIS_EXPANDED
JohnJ
http://www.rainbow-innov.co.uk
|
|
|
|
|
it is quite surprising for me but both function calls return the same results:
m_cTree.GetItemState(m_hType,TVIF_STATE);
m_cTree.GetItemState(m_hType,TVIS_EXPANDED);
the problem was that the return value contains bitwise information so the call must have been used in this way:
if (TVIS_EXPANDED & m_cTree.GetItemState(m_hType,TVIS_EXPANDED))
else
Thank you for pointing the above issue out.
R.
|
|
|
|
|
This is the map definitions:
typedef std::map<int, std::string> strmap;
strmap mPaths;
strmap::iterator miIterator;
First you do this:
miIterator = mPaths.find(index);
right? but what do you do next if you want to copy ther string into a char *?
thanks
|
|
|
|
|
You need to post more info on the map declaration:
Is is a map<string, int> or what?
You might find your answer in .second and .first
miIterator.first->c_str()
....
James
|
|
|
|
|