I want to have a live clock in the statusbar.
When I put SetWindowText before the switch in the callback, like this:
BOOL CALLBACK MainDlgProc(HWND hDlg, UINT wMsg, WPARAM wParam, LPARAM lParam) {
time_t rawtime;
struct tm *timeinfo;
time(&rawtime);
timeinfo = localtime(&rawtime);
strftime(thetimeis,79,"Current Date and Time: %A, %B %d, %Y %I:%M:%S",timeinfo);
SetWindowText(GetDlgItem(hDlg,IDC_STATUSBAR),thetimeis);
switch(wMsg) {
case WM_INITDIALOG:
//other stuff, continues...
it makes it look like this:
but if I just remove the SetWindowText, i.e.
BOOL CALLBACK MainDlgProc(HWND hDlg, UINT wMsg, WPARAM wParam, LPARAM lParam) {
time_t rawtime;
struct tm *timeinfo;
time(&rawtime);
timeinfo = localtime(&rawtime);
strftime(thetimeis,79,"Current Date and Time: %A, %B %d, %Y %I:%M:%S",timeinfo);
// SetWindowText(GetDlgItem(hDlg,IDC_STATUSBAR),thetimeis);
switch(wMsg) {
case WM_INITDIALOG:
//other stuff, continues...
it makes it look like this, which is how I want it to look:
except I want the time in the statusbar. thetimeis is a global variable:
char thetimeis[80];
What is causing this, and how can I fix it?
I'm using dev-c++ 4.9.9.2 on a windows 7.