Hello: When using Date Time Picker, it defaults to Dec 31, 1969. If I select a date before that, once I do a UpdateData(TRUE), I get an error Debug Assert Error - timecore.cpp line 40. ----> ASSERT(m_time != -1); How can I limit the dates that can be selected? How can I make it default to today's date? Thank you CTime::CTime(int nYear, int nMonth, int nDay, int nHour, int nMin, int nSec, int nDST) { struct tm atm; atm.tm_sec = nSec; atm.tm_min = nMin; atm.tm_hour = nHour; ASSERT(nDay >= 1 && nDay <= 31); atm.tm_mday = nDay; ASSERT(nMonth >= 1 && nMonth <= 12); atm.tm_mon = nMonth - 1; // tm_mon is 0 based ASSERT(nYear >= 1900); atm.tm_year = nYear - 1900; // tm_year is 1900 based atm.tm_isdst = nDST; m_time = mktime(&atm); ----> ASSERT(m_time != -1); // indicates an illegal input time }
JoeMass
Posts
-
Date Time Picker -
VC++ Date/Time calculationI have very little VC++ experience. Could you give me more details on how to do this? thank you
-
VC++ Date/Time calculationI am using the VC++ date/time picker control. I want to select a date and then calculate the total seconds from 01-Jan-1980 until the selected date. Also I want to store this as an unsigned long int. Do you know of a simply way to do this?
-
ERROR:cannot open file "nafxcwd.lib"--------------------Configuration: Wyse2 - Win32 Debug-------------------- Here is the only error I get when building my app: Any ideas? I am using VC++ 6.0 Compiling resources... Compiling... stdafx.cpp Wyse160.cpp Linking... LINK : fatal error LNK1104: cannot open file "nafxcwd.lib" Error executing link.exe. Souce code: // Wyse160.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include "Wyse160.h" #ifdef _DEBUG #define new DEBUG_NEW #endif #undef mc //#define mc // The one and only application object CWinApp theApp; using namespace std; int _tmain(int argc, TCHAR* argv[], TCHAR* envp[]) { int nRetCode = 0; DCB dcb; int fSuccess; DWORD dwResult; DWORD BaudRate; BYTE ByteSize; BYTE Parity; BYTE StopBits; CString csErrMsg; CString csTitle; CString csComm; char inBuffer[512]; char outBuffer[512]; int Read1COMM(char * inBuffer, DWORD nBytesToRead); int Write1COMM(char * outBuffer,DWORD nBytesToWrite); // Fill in the default com port and values for DCB: 9600 bps, 8 data bits, no parity and 2 stop bits char *pcCommPort = "COM2"; BaudRate = CBR_9600; // set the baud rate ByteSize = 8; // data size Parity = NOPARITY; // set parity StopBits = TWOSTOPBITS; // two stop bits csTitle.Format("Data Station Wyse Terminal %.2f", version); SetConsoleTitle(csTitle); m_hMainWait = CreateEvent( NULL, FALSE, FALSE, NULL); pcCommPort = "COM1"; BaudRate = CBR_9600; Parity = NOPARITY; ByteSize = 8; StopBits = ONESTOPBIT; /*Parity = EVENPARITY; Parity = ODDPARITY; Parity = NOPARITY; Parity = MARKPARITY; StopBits = ONESTOPBIT; StopBits = ONE5STOPBITS; StopBits = TWOSTOPBITS; */ csTitle.Format("Data Station Wyse Terminal %.2f %s", version, pcCommPort); SetConsoleTitle(csTitle); CommTimeouts = new _COMMTIMEOUTS; /* m_PKeybrdThread = 0; m_PScreenThread = 0;*/ m_bLine = false; // initialize MFC and print and error on failure if (!AfxWinInit(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), 0)) { // TODO: change error code to suit your needs _tprintf(_T("Fatal Error: MFC initialization failed\n")); nRetCode = 1; } else { // TODO: code your application's behavior here. m_hCom = CreateFile (pcCommPort, GENERIC_READ | GENERIC_WRITE, 0, // open as exclusive access NULL, // no security OPEN_EXISTING, 0, // not overlapped I/O NULL // comm device ); if (m_hCom == INVALID_HANDLE_VALUE) {
-
Basic Serial I/O in VC++I have limited VC++ experience. I have used C and other languages a lot. I need to communicate with a serial device from a VC++ Dialog application, which I am developing. How do I do this? Thank you, Joe Massarelli