|
So in order to do this I have to detect which version of windows user is running on right(to be able to calling appropriate function)?
Can you suggest me the effective way to do this ?
And another question ,is this ProgramData not affect by data virtualization right?
since the folder that store my app config have
to be create when user running application not when user install them.
Sorry to bother you with such question since I dont have a VISTA machine to test now
|
|
|
|
|
xanagan666 wrote: So in order to do this I have to detect which version of windows user is running on right(to be able to calling appropriate function)?
That's the proper way to do it. On Windows Vista, SHGetFolderPath is a wrapper for SHGetKnownFolderPath , so you could just call the one function and it will behave properly.
xanagan666 wrote: Can you suggest me the effective way to do this ?
See this article: Getting the System Version (Windows)[^].
xanagan666 wrote: And another question ,is this ProgramData not affect by data virtualization right?
If by virtualization, you mean the automatic virtualization between 32-bit and 64-bit or the UAC virtualization, I believe that is correct. This folder is not virtualized.
Scott Dorman Microsoft® MVP - Visual C# | MCPD
President - Tampa Bay IASA
Hey, hey, hey. Don't be mean. We don't have to be mean because, remember, no matter where you go, there you are. - Buckaroo Banzai
[ Forum Guidelines][ Articles][ Blog]
|
|
|
|
|
I mean the UAC virtualization that cause writing file in system folder(like ProgramFile\MyProgramData\) redirect to virtual folder for seperate user(which I dont want,I want all user to use the same configuration of application).
|
|
|
|
|
xanagan666 wrote: I mean the UAC virtualization that cause writing file in system folder(like ProgramFile\MyProgramData\) redirect to virtual folder for seperate user(which I dont want,I want all user to use the same configuration of application).
I'm pretty sure this folder is not virtualized by UAC but you may need to ensure that the correct permissions are set on the subfolder you create.
Scott Dorman Microsoft® MVP - Visual C# | MCPD
President - Tampa Bay IASA
Hey, hey, hey. Don't be mean. We don't have to be mean because, remember, no matter where you go, there you are. - Buckaroo Banzai
[ Forum Guidelines][ Articles][ Blog]
|
|
|
|
|
Thank for your help (this really feel like a live chat ).
|
|
|
|
|
xanagan666 wrote: Thank for your help
You're welcome.
xanagan666 wrote: (this really feel like a live chat ).
You happened to catch me while I was still actively online.
Scott Dorman Microsoft® MVP - Visual C# | MCPD
President - Tampa Bay IASA
Hey, hey, hey. Don't be mean. We don't have to be mean because, remember, no matter where you go, there you are. - Buckaroo Banzai
[ Forum Guidelines][ Articles][ Blog]
|
|
|
|
|
Take a look at the environment variable APPDATA - this is a good place to store that type of information (Vista/XP/2000). For user specific data look at USERPROFILE.
Hope that helps.
Karl - WK5M
PP-ASEL-IA (N43CS)
PGP Key: 0xDB02E193
PGP Key Fingerprint: 8F06 5A2E 2735 892B 821C 871A 0411 94EA DB02 E193
|
|
|
|
|
The default rights only give a "standard user" Read related rights.
Not much use in the real world (Application updates, etc...)
|
|
|
|
|
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.
Karl - WK5M
PP-ASEL-IA (N43CS)
PGP Key: 0xDB02E193
PGP Key Fingerprint: 8F06 5A2E 2735 892B 821C 871A 0411 94EA DB02 E193
|
|
|
|
|
Are those "per user" locations? If so, the logged on user having write rights to it is a given.
For "per machine" I would think "FOLDERID_ProgramData" would be a good candidate since the users group has "special permissions" to "read/write" but lack the "delete" by default.
|
|
|
|
|
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?
|
|
|
|
|
To prevent your app from restoring the dockstate, in the constructor for your CMainFrame add:
EnableLoadDockState(FALSE);
|
|
|
|
|
|
CString a("2e3");<br />
double b = atof(a);
do right in VC++6.0 but wrong in VC++2008
CString a("2e3");<br />
double b = _tstof(a);
do right in VC++2008 but wrong in VC++6.0
|
|
|
|
|
It all depends if either _UNICODE or _MBCS are defined. Please check out MSDN for more information on this topic.
Regards,
Mihai Moga
|
|
|
|
|
Thats the TCHAR mapping for atof/_wtof. By default vc2008 defines TCHAR as a native type. You can use it in vc6, you just need to do so explicitly.
|
|
|
|
|
I am trying to figure out how to convert text in a CString to a double. I found this tutorial:
http://www.codeproject.com/KB/string/cstringmgmt.aspx#Converting%20a%20CString%20to%20an%20integer
and it contains this example code for converting to an integer
CString hex = _T("FAB");
CString decimal = _T("4011");
ASSERT(_tcstoul(hex, 0, 16) == _ttoi(decimal));
I don’t even see an integer declared in that fragment, much less how to convert the CString to an integer or decimal.
Here is what I need:
CString source = _T("1.2e6");
double target;
target = source.FormatAsDouble();
Obviously that does not work. But what will?
Thanks for your time
|
|
|
|
|
Rats, I miss typed and the edit did not seem to work.
This is what I want to do:
CString source = _T("1.2e6");
double target;
target = source.FormatAsDouble();
Thanks for your time
|
|
|
|
|
Hi, you should try like this:
CString source = _T("1.2e6");
double target = _tstof( source );
Regards,
Mihai Moga
|
|
|
|
|
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?
Thanks again.
Thanks for your time
|
|
|
|
|
Hi, for this task you should check out Ben Hanson's CFilterEdit[^] class. I use in one of my projects and I am gratefull to the author.
Regards,
Mihai Moga
|
|
|
|
|
RE: CFileterEDit, That class does look good. I downloaded it and the demo.
The file BaseEdit.h contains this reference:
#include <boost/regex.hpp>
This include file in not contained in either of the downloads. BaseEDit.h is the only file containing this include and it has no previous includes that lead me to the file.
Where do I find this file?
Thanks for your time
|
|
|
|
|
In order to recompile that project, you should consider downloading the boost::regex library from Boost's Official Page/[^].
Regards,
Mihai Moga
|
|
|
|
|
Hello Mahai,
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:
IDC_X_POSITION_EDIT
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 time
|
|
|
|
|
Well, FloatEdit will do it for you, it filters data so that you would have a valid floating value/string. It's enought to subclass you CEdit control with this one.
Regards,
Mihai Moga
|
|
|
|