|
This wont work if updating access times is turned off. (registry hack, speeds up quite a bit)
...if you're under 8 or younger. Chris Maunder, the Lounge
|
|
|
|
|
This hack sounds cool. More info?
Signature space for rent. Apply by email to....
|
|
|
|
|
|
I don't think this will work.
The last accessed timestamp of the file user32.dll is updated with a date of the past,
when you set backwards the clock.
But you can't check that. The computer thinks 'now' is that date in the past.
Some more details about my question:
Time line: A1 < A2 < X < E < Y
My App is started at A1 end stopped at A2.
My app informs the user that his license will expire at E.
At time Y the user does the following:
- he sets back the clock to X
- he starts up my app
How can my app know
- the computer ever ran at Y (>E)?
- the license is expired
|
|
|
|
|
This might be a problem on PCs that use daylight saving, or on systems that sync with an external time source, such as a server or radio clock.
I'd allow a margin of at least 2 hours to be a valid change, although I'm assuming you want to do some kind of expiry-time protection.
Steve S
[This signature space available for rent]
|
|
|
|
|
That was an issue I indeed already thought of.
Nevertheless, thanks for the input.
|
|
|
|
|
Think about it from another direction:
Why not record the time each time your app exits (keep it in a registry key or a hidden file or something of the sort). When your app starts compare the current time with the last-exit time. If the last-exit time appears to be in the future someone may be cheating. Just remember to allow for DST as someone else suggested.
The opinions expressed in this communication do not necessarily represent those of the author (especially if you find them impolite, discourteous or inflammatory).
|
|
|
|
|
The scenario you suggest fails in the following case:
Time line: A1 < A2 < X < E < Y
My App is started at A1 end stopped at A2.
My app informs the user that his license will expire at E.
At time Y the user does the following:
- he sets back the clock to X
- he starts up my app
When my app starts A2 < X, so it doesn't detect any cheating.
How can my app know
- the computer ever ran at Y (>E)?
- the license is expired
|
|
|
|
|
a) examine the eventlog - events there are in chronological order.
b) write to eventlog your own entries.
c) examine registry entries. booting leaves trails in registry. hint: RegQueryInfoKey()
combine methods.
...if you're under 8 or younger. Chris Maunder, the Lounge
|
|
|
|
|
What is the syn. function for _ttoi() to convert a string to a float/double (must compile with ANSI and UNICODE).
|
|
|
|
|
wcstod
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
For a no source code change, use _tcstod, which I think is what the original poster wanted.
Steve S
[This signature space available for rent]
|
|
|
|
|
I am using CAsyncSocket class in one of my very simple windows application. The problem is that whenever i called the connect function, my program blocks for few seconds. How can i get rid of this blocking problem ??
|
|
|
|
|
you can put your sockets in separate worker threads, or deal with the blocking issue,
put the string into MSDN:
Windows Sockets: Blocking
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
hi all,
when i used FindFirstFile() i got the file name as ".",for the first
FindNextFile() call i got the name as ".." and for the third i got the correct one..how can i avoid the first two cases..
|
|
|
|
|
Use proper wildcards. If you use *.* then it is quite normal you get those two (which are part of the operating system (. is an alias for the current dir, .. is an alias for parent dir)).
if you start putting in too manay features, it no longer remains useful for beginners
quote in a CP article comment, shiraz baig
|
|
|
|
|
You can't exactly, but for stuff other than the root directory of a drive, this will always be the case (just like *n*x systems), so inevitably I have a check for "." or ".." in things dealing with this.
If you only want files and not directories, you can also check the attributes that are present in the results.
Steve S
[This signature space available for rent]
|
|
|
|
|
.IsDots() member function give true if they are DOTS...
A Programmer Never Dies..***
|
|
|
|
|
You must be saving the result in an array or a buffer. Just omit the first two elements when retrieveing the array.
JJ
|
|
|
|
|
Hi
i am trying to read an integer given as a command line argument to my program, but i can only get it as a string, that is argv[1], how can i get it as an integer ?
tahnks
|
|
|
|
|
|
I have the following code:
CString str("112");
int n = atoi((LPCTSTR) str);
This code works fine under VC++ 6.0, but under eVC++ 3.0 (UNICODE) the code doesn't compile, because the function atoi doesn't support UNICODE.
How can I write the function (convert a CString to a integer and float) so that it works with and without UNICODE?
I need to functions... one to convert a CString to a float and one to convert a CString to a integer!
|
|
|
|
|
use _ttoi which is the TCHAR version
int n = _ttoi((LPCTSTR) str);
|
|
|
|
|
And what kind of function is to convert a string (CString) to a float?
|
|
|
|
|
Like any of the A functions atoi() never ever supports unicode (same goes for itoa()). Use either _wtoi or _ttoi.
Anonymous wrote:
How can I write the function (convert a CString to a integer and float) so that it works with and without UNICODE?
int whatever = _ttoi((LPCTSTR)str);
or, if you want explicit support
if(bUnicode)
whatever = _wtoi((LPCWSTR)str);
else
whatever = atoi((LPCSTR)str);
...if you're under 8 or younger. Chris Maunder, the Lounge
|
|
|
|