Click here to Skip to main content
15,909,747 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Win95 DOS Shell versus WinNT Dos Shell Pin
Gerry22-Mar-01 21:45
Gerry22-Mar-01 21:45 
GeneralMFC Design Question Pin
21-Mar-01 17:30
suss21-Mar-01 17:30 
GeneralRe: MFC Design Question Pin
Michael Dunn21-Mar-01 20:20
sitebuilderMichael Dunn21-Mar-01 20:20 
GeneralRe: MFC Design Question Pin
l a u r e n22-Mar-01 20:29
l a u r e n22-Mar-01 20:29 
GeneralLooking for Algorithm to match RGB values Pin
Wolfram Steinke21-Mar-01 13:42
Wolfram Steinke21-Mar-01 13:42 
GeneralRe: Looking for Algorithm to match RGB values Pin
22-Mar-01 0:01
suss22-Mar-01 0:01 
GeneralRe: Looking for Algorithm to match RGB values Pin
Christian Graus22-Mar-01 11:46
protectorChristian Graus22-Mar-01 11:46 
GeneralPlease help save my sanity... Pin
21-Mar-01 10:16
suss21-Mar-01 10:16 
I am writing a small program in C++ without MFC(call me a glutton for punishment, but I want to avoid the hassle of the dependancy). The premise of the program is that it will delete all of the files in a given directory if the file is older than a given number of days. 99% of the application works fine, except the code below:

FILETIME ft;
ULONGLONG qwResult;
ft = getTimeInFiletime();
//ULONGLONG localAge = (ULONGLONG)age;
// Copy the time into a quadword.
qwResult = (((ULONGLONG) ft.dwHighDateTime) << 32) + ft.dwLowDateTime;

// Subtract x days.
ULONGLONG lngDaysToSubtract;
lngDaysToSubtract = age* _DAY; //Note: _DAY is a ULONGLONG, a.k.a __int64

qwResult -= lngDaysToSubtract;

// Copy the result back into the FILETIME structure.
ft.dwLowDateTime = (DWORD) (qwResult & 0xFFFFFFFF );
ft.dwHighDateTime = (DWORD) (qwResult >> 32 );

This code is creating a FILETIME structure that will contain the "cuttof date", for example if someone calls the program with a parameter of 30 days, it will create a FILETIME structure containing the date of 30 days ago. The problem here is this line:

lngDaysToSubtract = age* _DAY;

"age" is an int parameter passed into this function. If I replace this variable with a hard-coded parameter, say 30, this code works fine. But it fails if I use the function parameter. If I throw in a "printf("Age is: %s\n",age);", it shows that the value is what I expect it to be.


I have been banging my head on this problem all morning. If anyone can help me solve it, I would be extremely grateful!!

Thanks
GeneralRe: Please help save my sanity... Pin
Michael Dunn21-Mar-01 16:52
sitebuilderMichael Dunn21-Mar-01 16:52 
GeneralReplacing ComboBox arrow-button Pin
21-Mar-01 9:41
suss21-Mar-01 9:41 
GeneralHelp me Please! Bitmap UI probs Pin
21-Mar-01 8:36
suss21-Mar-01 8:36 
GeneralRe: Help me Please! Bitmap UI probs Pin
Chris Losinger21-Mar-01 9:29
professionalChris Losinger21-Mar-01 9:29 
GeneralRe: Help me Please! Bitmap UI probs Pin
21-Mar-01 9:52
suss21-Mar-01 9:52 
GeneralRe: Help me Please! Bitmap UI probs Pin
Chris Losinger21-Mar-01 11:26
professionalChris Losinger21-Mar-01 11:26 
GeneralRe: Help me Please! Bitmap UI probs Pin
Michael Dunn21-Mar-01 16:58
sitebuilderMichael Dunn21-Mar-01 16:58 
GeneralRe: Help me Please! Bitmap UI probs Pin
22-Mar-01 12:03
suss22-Mar-01 12:03 
GeneralRe: Help me Please! Bitmap UI probs Pin
23-Mar-01 9:14
suss23-Mar-01 9:14 
QuestionHow to turn status bar, menu bar, tool bar, title bar off? Pin
Richard Cheng21-Mar-01 6:23
Richard Cheng21-Mar-01 6:23 
GeneralAccelerator Pin
confalonieri21-Mar-01 3:57
confalonieri21-Mar-01 3:57 
QuestionCComboBox - how to react to enter i editbox? Pin
21-Mar-01 2:19
suss21-Mar-01 2:19 
AnswerRe: CComboBox - how to react to enter i editbox? Pin
PJ Arends22-Mar-01 6:22
professionalPJ Arends22-Mar-01 6:22 
QuestionDundas Ultimate Grid -- enhanced Version? Pin
Uwe Keim20-Mar-01 19:21
sitebuilderUwe Keim20-Mar-01 19:21 
AnswerRe: Dundas Ultimate Grid -- enhanced Version? Pin
Holger Persch20-Mar-01 19:48
Holger Persch20-Mar-01 19:48 
GeneralWeb Accessories Pin
Marcelo Nogueira Magri20-Mar-01 14:50
Marcelo Nogueira Magri20-Mar-01 14:50 
GeneralRe: Web Accessories Pin
Erik Thompson21-Mar-01 7:48
sitebuilderErik Thompson21-Mar-01 7:48 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.