On my Vista (Ultimate) a standard use has read/write permission to both the APPDATA and USERPROFILE directories.
This is a standard install (no modifications made to user rights.
In any event, if the settings are truly "for all users" then a standard user should not be able to modify them. Settings that affect all users should require additional privilege, while settings that affect only the specific user should be allowed (and should be in the USERPROFILE directory.
I'm playing with the new mfc features from the mfc update. I have a new wizard-generated application. Somehow the state of the docking panes is stored in the registry (I can find it there) but for the life of me i can't figure out where in the code this functionality is implemented or more importantly how to turn it off. Any ideas?
I am trying to figure out how to convert text in a CString to a double. I found this tutorial:
and it contains this example code for converting to an integer
I just compiled and ran that code, it works. But you already knew that.
Thank you Mihai.
The string to be converted will be extracted from a user dialog. The user may make an error in entering the number. Is there a method that will validate the string as being properly formatted or in some other way detect an input error to I can tell the user?
I have installed the Boost environment, I have added FloatEdit and BaseEdit to my project, and they will compile. Now I see method
double CFloatEdit::GetValue () const
in file FloatEdit.cpp
But I don't see how to apply it to my dialog box.
One of the fields that I want filtered has the ID:
and string in the box can be accessed via the variable name as follows:
GBE_x_position_string.GetWindowTextW( str );
That puts the value into CString names str.
Can you tell me how to use this FloatEdit to check the inputs to this field?
Thanks for your reply, but while the documentation tells that than I can use this class to filter the data, I am not able to see how to apply the class to do that. How do I use it?
Given that the text edit tool in my dialog has the id of
and the assigned variable of
with example usage: GBE_x_position_string.GetWindowTextW( str );
and variable str containg the string from said edit text tool:
Will you show me the line of code that invokes a method of FloatEdit to
1. validate the string as suitable for converting to float or double
2. provide the foat or double equvalent.
No it's NOT ugly and it is the way my suggestion pointed to. You have to deal only with 1 case and that's much more simpler than the general validation. Anyway you have to accomplish carefully your task. For instance 0 is a valid entry too (and, depending on your level of user-noise tolerance, also 0.00, 0.000,... are).
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
I really do appreciate the time you spent answering my question. But we do disagree on something. Elegant is something like this.
CString source = "1.23e6";
status = source.ConvertToFloat( &target );
If atof returns 0.0 in the double variable for an error, this it must also write 0.0 to the variable when the text is 0, or 0.0, or any of several other conditions as you have noted. In this event, either before the convert or after, we must have additonal code to check for any text string that would result in 0.0 to determine if we have an error, or if we really have a 0. Having to writing extra code to do that is indeed downright ugly.
Maybe I have missunderstood you. If so please help me out.