|
How do you get the killfocus for a CButton. There is a ON_BN_KILLFOCUS but that never comes. In the class wizard there is no option for killfocus.
scott
|
|
|
|
|
Just a guess, but according to the platform SDK, buttons must have the BS_NOTIFY style set if you want them to send BN_KILLFOCUS. Does your button have that style set?
"We are the knights who say Ni" (The Knights Who Say Ni)
|
|
|
|
|
You probably can't get the KillFocus message because it doesn't propagate up to the button's parent window. So you need to derive your own class from CButton and then you can add a message handler for WM_KILLFOCUS.
Regards,
Alvaro
All you need in this life is ignorance and confidence, and then success is sure. -- Mark Twain
|
|
|
|
|
WM_KILLFOCUS doesn't propagate up, but the button does send BN_KILLFOCUS to its parent window (if its BS_NOTIFY style is set) - so handling the BN_KILLFOCUS notification in the parent should work.
"We are the knights who say Ni" (The Knights Who Say Ni)
|
|
|
|
|
Cool, so he just needs to handle the WM_NOTIFY message on the parent and check for BN_KILLFOCUS along with the proper ID for the button.
Thanks for the info.
Regards,
Alvaro
All you need in this life is ignorance and confidence, and then success is sure. -- Mark Twain
|
|
|
|
|
|
I neded a feature where I want my Dialog application to be versioned (Like a timestamp) whenever I recompile my file. I am unaware of methods to do this . Please help
|
|
|
|
|
See __DATE__, __TIME__, __TIMESTAMP__ predefined macros in MSDN library
|
|
|
|
|
http://www.codeproject.com/macro/incprivatebuild.asp
or search for auto-incrementing a version number here or on CodeGuru
-pete
|
|
|
|
|
My program when first opened takes up about 1K of memory. Then When open some dialogs and documents etc. the usage goes up.
Closing all the children doesn't shrink the usage, though, at least not by anything significant. However, when I minimize and maximize, I'm back to 1k.
Is this pretty normal? Does windows just assume the memory is still associated with my task, until it gets freed during minimize? Or does this signify I'm leaking memory?
I'm running Win2000, if it matters.
Thanks
BW
"Gandalf. Yes. That is what they used to call me. Gandalf the Grey. *I* am Gandalf the White."
- Gandalf the White
|
|
|
|
|
What you are describing is normal behavior. I don't know exactly what Windows is doing, but minimizing an application does seem to flush the cache. If you want to know for certain if you are leaking, buy a copy of Bounds Checker or just run your application in the debugger. When you exit look at the output window and search for the word leak. These are only basic leaks that Visual Studio finds though; a new without delete. Bounds checker will find the more difficult leaks; like creating a com object and not calling release. But with any more sophisticated tool, you have a bigger learning curve and it can be frustrating to use.
Ron Ward
|
|
|
|
|
Thanks Ron!
BW
"Gandalf. Yes. That is what they used to call me. Gandalf the Grey. *I* am Gandalf the White."
- Gandalf the White
|
|
|
|
|
Hi,
To use StrStrI, I
#include "shlwapi.h"
#pragma comment(lib, "shlwapi.lib") // link to shlwapi.lib
MSDN states: "shlwapi.dll 4.71 or later" (and, basically, IE4 must be installed)
However, on 98SE, even with IE6 installed, I get:
"missing export Shell32.dll:StrStrIA"
What's wrong? Do I need to write my own StrStrI? (I need to support 98, IE4 is no problem)
Nur wer feige ist tötet Liebe durch das Wort allein [sighist] | [Agile Programming] [doxygen] If you look for evil in me you will find it whether it's there or not.
|
|
|
|
|
Because of the final "A", it sounds like a problem of ANSI/UNICODE versions of the function
is your code built UNICODE?
Angels banished from heaven have no choice but to become demons
Cowboy Bebop
|
|
|
|
|
no, it's a straight MFC/ANSI build.
I'm a little bit confused by the dll name mismatch.
Nur wer feige ist tötet Liebe durch das Wort allein [sighist] | [Agile Programming] [doxygen] If you look for evil in me you will find it whether it's there or not.
|
|
|
|
|
You probably need to define WINVER to be 0x0400 or 0x0500 or something like that
"No matter where you go, there your are..." - Buckaoo Banzi
-pete
|
|
|
|
|
I have a controller program working like this. controller is set as a time event 1000/sec. But the "current_trials", sometime increments, even the controller doesn't go into state 1. why? Thank you.
controller()
{
static clock_t start_time, end_time;
if(state==1)
{
position= get_position();
set_force(position);
if(position > 10.0)
{
start_time= clock();
state = 2;
}
}
if(state==2)
{
end_idle = clock();
idle_time = (end_idle - start_idle);
if (idle_time >= IDLE_DURATION)
{
start_idle = end_idle = 0;
state=3;
}
}
else//state=3
{
position=get_position();
if(position < 0.5)
{
load_force_spatial_profile();//this is time consuming
state = 1;
current_trial++;
}
}
}
|
|
|
|
|
What is state intialised to, and where?
Also, your states are best described by an enum
e.g.
enum MyStates {ms_timing = 0, ms_loading, ms_state_to_be_defined, ms_error, ....};
This will make your program much more readable for yourself and others in the future.
Roger Allen
Sonork 100.10016
WHats brown and sticky?
A stick or some smelly stuff!
|
|
|
|
|
Hello!
I wonder how you Gurus are managing all Error Messages in a large project?
I think that each Message should have a unique number, severity, text in current language, ... What else?
Do you number all error messages sequencially discarding severity or do you have one sequence per serverity?
Do you use the Message Compiler (mc)??
Are there any add-in for Managing Error Messages?
All input is valued!
Cheers!
Mike Eriksson
Sonork 100.21825
|
|
|
|
|
Mike, sounds like you are asking about logging eh? There are as many ways to log as there are people to answer the question
You might consider using the OS log mechanism if that makes sense for your product. Otherwise you can do whatever you want. I've done logs with a UDP socket and a database for persistance. I've also done logging directly to disk files using XML.
You really need to consider your project specific requirements for logging. The main consideration in some projects like server side projects is to get logging working day ONE! Makes life simpler.
-pete
|
|
|
|
|
Thanks for your answer!
No, I not specifically talking about logging. I'm talking about Error Messages, which most of the time just get display via an dialog. I'm also talking about multiple languages and the importance of a unique error number.
I do application which are translated into English, Swedish, Finnish. If a user calls/emails me with an error and the error messages is in Finnish, I have no clue on what the error is, since I don't speak or read Finnish. If I have a unique error number then I just look at the Swedish error message and usually I understand it
The above scenario is one major drawback of Windows, which has all error messages translated into different languages. So I use a Swedish Windows, then I get Swedish error messages, which I have to translate into English in order to find any info about the error ...
My original question was more of how to manage/administrate these error numbers, messages and how to use then in a MFC environment.
Cheers!
Mike Eriksson
Sonork 100.21825
|
|
|
|
|
I looked around and found this http://support.microsoft.com/default.aspx?scid=kb;EN-US;231777
which shows how to make an ERD (emergency repair disk). But I dont know if this also backs up my registry.
Also while running the backup utility does one have to shut down all apps? Or can one keep working and let it do its stuff in the background? The aricle doesnt say....
Thanks
Appreciate your help,
ns
|
|
|
|
|
Not sure about Win2K, but it certainly backs up the registry in Win98.
"We are the knights who say Ni" (The Knights Who Say Ni)
|
|
|
|
|
Hi,
I'm wondering where to get info on how to burn files on a cd. I didn't find a SDK or API or something like that.
I want to make a simple app to create and burn files on multi-session cds.
-widi
-
|
|
|
|
|