|
MFC have CTimeSpan Class, add your date and time int one object and
bithday time in other
CTimeSpan objBithday(dd,mm,yy,hr,mm,ss);
CTimeSpan objToday(dd,mm,yy,hr,mm,ss);
CTimeSpan TimeDIff = objToday - objBithday;
Try This............ :
laugh:
|
|
|
|
|
chk this;
CString today_date_str,birth_date_str;
GetDlgItemText(IDC_DATETIMEPICKER1, today_date_str);
GetDlgItemText(IDC_DATETIMEPICKER2, birth_date_str);
m_today_dt_ole.ParseDateTime(today_date_str,0,LANG_USER_DEFAULT);
m_birth_dt_ole.ParseDateTime(birth_date_str,0,LANG_USER_DEFAULT);
CString chk_dt1=m_today_dt_ole.Format(_T("%d/%m/%Y"));
CString chk_dt2=m_birth_dt_ole.Format(_T("%d/%m/%Y"));
m_today_dt_ole.ParseDateTime(chk_dt1,0,LANG_USER_DEFAULT);
m_birth_dt_ole.ParseDateTime(chk_dt2,0,LANG_USER_DEFAULT);
COleDateTimeSpan daydiff=(m_today_dt_ole-m_birth_dt_ole);
int noofday=0;
noofday=(int)daydiff.GetTotalDays();
if(noofday<=0)
{
noofday=-(noofday);
}
noofday++;
CString Value ;
Value.Format(_T("%d"),noofday);
|
|
|
|
|
well mate i guess this is C++ or C#_? cause i can't understand the codes. i am working with C . but thanks for your help
|
|
|
|
|
I'm not the one having a problem with datetimes, I merely try to help out the OP.
And I don't think he is using or willing to use MFC.
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
and also i guess this is for C#_?. .
|
|
|
|
|
If you want to be exact, you need them all: days, months and years.
The uears because of the leap day in February.
The year is a leap year if the year is divisible by four, but not by 100, except if it's divisible by 400.
Otherwise you might want to calculate days from the start of the year (takes care of different length months). Just have a table of days in each month and remember to add a day in february if it's a leap year.
|
|
|
|
|
Hi there,
I'm working on a Application developed using Visual Studio 2008 (VC++).
I'm looking for a way to get the name of the current user session using the process ID.
My intention here is to check for a particular process (AA.exe) and see this is not running for a current user.
I'm using the CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, NULL) to get the list of process, and traverse thru the list for a matching AA.exe process. But this returns the list of processes from all users.
I've gone thru the example:
List Processes Which Are Created By Specific Users[^]
But the function LookupAccountSid() returns 0 and the get last error also returns 0.
The value of the username field seems to be NULL.
Kindly let me know, if there are any other ways to get the name of the current user session using the Process ID.
Thanks in advance.
regards,
Rajesh
|
|
|
|
|
In the call to LookupAccountSid() both cchName and cchReferencedDomainName are uninitialized.
If you set them to 255 before the call does it work then?
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Thanks Mark. It worked after initializing those two variables.
regards,
Rajesh
|
|
|
|
|
Hi,
Can you suggest the fastest algorithm to generate unique combination of string of fixed length?
|
|
|
|
|
Unique compared to what? Are you talking about a function that will return a new string every time it's called? Or do you have a list of strings you don't want to duplicate?
|
|
|
|
|
|
|
Thanks for your reply.
But I want the all possible comabination of given string of specific length.
I am developing a password recovery utiluty so I need to pass all string combination to match the desired string.
Can you suggest me the fastest one to do so.
|
|
|
|
|
Check my post about enumerating the strings. But before you get too enthusiastic, you should read about something that might get in your way: Salt[^].
|
|
|
|
|
The fastest way would be to enumerate the possible combinations of the desired alphabet on the fly, and for each call advance a step, and remember the last unique string. For short strings, you could benefit from having them pre-generated.
|
|
|
|
|
The fastest way what I think will be using TimeStamp.
1) Get the current Time (in Milliseconds )
2) Append it to string or if comfortable, use the same as a string...
UuidCreate() is a good option but fastest will be timestamp + YourSignature
--
CHEERS!!!
|
|
|
|
|
You mean the fastest in 'code development time', I guess.
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
[My articles]
|
|
|
|
|
Almost all utilty find the password string match within few seconds.
I want to do the same. So I need to pass string to match. So suggest me fastest method to generate string.
Please suggest something meaningful.
|
|
|
|
|
That's not your original request (at least in the motivation). Why should we encourage your hacking intentions?
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
[My articles]
|
|
|
|
|
You are right... I think the intension is a bit shabby...
ha ha ha ha. Caught!!! This guy needs to enumerate all possible string.
Brute Force with Alpha Numerics takes a lot of time + Ethics please.
|
|
|
|
|
If you can not give answer dont laungh on others
|
|
|
|
|
Hey John... Always try to be smart while seeking answers of indirect questions. You have been already answered .
BTW In Advance Login system (used in most of the places where you see "User Name" and "Password" currently), the no. of guesses you can make is always limited. So Brute force really shouldn't be your approach. The Probability of you cracking the password is 1/((All the case sensitive alphabet + Numbers + Special Characters) ^ (length of the password - which is unknown). If you are still trying - Read this: - This guess will be +ve if you get the correct password in "almost The Best case" i.e. you must be able to guess it in 3 chances (approx).
(Advice) Try something else... Best Super Computers if used will take days to crack one strong password by Brute Force.
And yes, Always be ethical!!!
PS: - The above message has no relevance to the initial question.
|
|
|
|
|
the trick to doing it quickly is to not generate all possible strings. the trick is to generate likely strings first. "dictionary" is the magic word.
if the dictionary fails, then you have to do it the hard way:
aaaa
aaab
aaac
aaad
...
ZZZZ
|
|
|
|
|
I have one VC++ projects which was build on VS2003 on japanese windows XP OS, but when i compile same program on VS2003 English XP,i have found syntax error related to ; { }.
My code contains some japanese characters as string. Is it necessary to compile project on japanese OS only?
Thanks
Atul
|
|
|
|