01-19-2006 09:51 AM
01-19-2006 10:25 AM
01-20-2006 03:22 AM
01-20-2006 04:05 AM
Hello, smoken
as of CVI5.5 (I cannot go back more than this) GetFileDate and GetFileTime functions give result in handy manner. As JR told you, you can use FileSelectPopup to navigate and choose the file you want, retrieve its name in a string and pass it to these functions to obtain file date and time:
char file[MAX_PATHNAME_LEN];
FileSelectPopup ("", "*.*", "", "", VAL_SELECT_BUTTON, 0, 0, 1, 0, file);
GetFileDate (file, &year, &month, &day);
GetFileTime (file, &hour, &minute, &second);
01-22-2006 02:54 AM
01-22-2006 11:23 PM
01-23-2006 07:16 PM
Hello Roberto,
Thank you for answering my query, here's the details, I want to put the date of the file when it was created. Say the creation date and time of the file is 1/26/2006 7:00:00 AM, then the textbox in the uir will display "The file was created: 1/26/2006 7:00:00 AM".
Again, thank you!!!
Regards,
Leo
01-24-2006 02:28 AM
Leo, copying these lines in the Interactive execution window and adjusting the filename you'll get the file time and date displayed in a popup message. Just substitute the last MessagePopup with a ResetTextBox on the textbox gives you a solution. You may want to customize the output message to your desires. Here's the simple parte of the answer.
The problem is that these lines give you the date / time of last modification on the file, NOT the creation date and time! If you reallt need these you'll have to deal with SDK functions.
#include <userint.h>
#include <ansi_c.h>
#include <utility.h>
static int mm, dd, yy;
static int hh, mn, ss;
static int err = 0;
static char msg[512], file[MAX_PATHNAME_LEN];
strcpy (file, "C:\\MyFile.txt");
if (err = GetFileDate (file, &mm, &dd, &yy)) {
MessagePopup ("Error", "Error in GetFileDate.");
goto Error;
}
if (err = GetFileTime (file, &hh, &mn, &ss)) {
MessagePopup ("Error", "Error in GetFileTime.");
goto Error;
}
sprintf (msg, "File: %s\n\nDate: %d/%d/%d\nTime: %02d:%02d:%02d", file, mm, dd, yy, hh, mn, ss);
MessagePopup ("Details", msg);
Error:
;
01-25-2006 12:34 AM
Thank you jr and roberto,
I finally figured it out!!!Thank you very much for helping me!!!
Regards,
07-30-2019 12:32 PM
Hello Roberto,
I have labwindows cvi application running. I want a message box pop up and say "Sorry your time has expired to use this application" on particular date. (Calculated using getsystemdate)
And then when they hit ok to that message box close the CVI app. Can you please help me with the same.