예제 #1
0
void plAgeDescInterface::ISaveCurAge( const plFileName &path, bool checkSeqNum )
{
    hsUNIXStream s;
    if( !s.Open( path, "wt" ) )
    {
        hsMessageBox("Unable to open the Age Description file for writing. Updates not saved.", "Error", hsMessageBoxNormal);
        return;
    }

    plAgeDescription aged;
    aged.SetAgeNameFromPath( path );

    // set the date and time
    HWND hDate = GetDlgItem(fhDlg, IDC_DATE);
    SYSTEMTIME dst = {0};
    DateTime_GetSystemtime(hDate, &dst);
    HWND hTime = GetDlgItem(fhDlg, IDC_TIME);
    SYSTEMTIME tst = {0};
    DateTime_GetSystemtime(hTime, &tst);
    aged.SetStart(dst.wYear,dst.wMonth,dst.wDay,tst.wHour,tst.wMinute,tst.wSecond);
    aged.SetDayLength(fSpin->GetFVal());
    aged.SetMaxCapacity(fCapSpin->GetIVal());
    if( checkSeqNum )
    {
        ICheckSequenceNumber( aged );
    }
    else if( IsDlgButtonChecked( fhDlg, IDC_RSVDCHECK ) )
    {
        // Store reserved sequence prefix
        aged.SetSequencePrefix( -fSeqPrefixSpin->GetIVal() );
    }
    else
    {
        aged.SetSequencePrefix( fSeqPrefixSpin->GetIVal() );
    }

    // gather pages
    HWND hPages = GetDlgItem(fhDlg, IDC_PAGE_LIST);
    int count = ListBox_GetCount(hPages);
    if (count != LB_ERR)
    {
        for (int i = 0; i < count; i++)
        {
            char pageName[256];
            ListBox_GetText(hPages, i, pageName);
            plAgePage *page = (plAgePage *)ListBox_GetItemData( hPages, i );
            aged.AppendPage( pageName, page->GetSeqSuffix(), page->GetFlags() );
        }
    }

    // write it all out
    aged.Write(&s);
    s.Close();
}
예제 #2
0
	bool GetTime ( HWND hTime, HWND hDate, SYSTEMTIME & tResult )
	{
		SYSTEMTIME tSystemTime;
		if ( DateTime_GetSystemtime ( hTime, &tSystemTime ) != GDT_VALID )
			return false;

		if ( DateTime_GetSystemtime ( hDate, &tResult ) != GDT_VALID )
			return false;

		tResult.wMilliseconds	= tSystemTime.wMilliseconds;
		tResult.wSecond			= tSystemTime.wSecond;
		tResult.wMinute			= tSystemTime.wMinute;
		tResult.wHour			= tSystemTime.wHour;
		
		return true;
	}
예제 #3
0
파일: dateandtime.c 프로젝트: GYGit/reactos
static VOID
SetLocalSystemTime(HWND hwnd)
{
    SYSTEMTIME Time;

    if (DateTime_GetSystemtime(GetDlgItem(hwnd,
                                          IDC_TIMEPICKER),
                               &Time) == GDT_VALID &&
        SendMessageW(GetDlgItem(hwnd,
                                IDC_MONTHCALENDAR),
                     MCCM_GETDATE,
                     (WPARAM)&Time,
                     0))
    {
        SystemSetLocalTime(&Time);

        SetWindowLongPtrW(hwnd,
                          DWL_MSGRESULT,
                          PSNRET_NOERROR);

        SendMessageW(GetDlgItem(hwnd,
                                IDC_MONTHCALENDAR),
                     MCCM_RESET,
                     (WPARAM)&Time,
                     0);

        /* Broadcast the time change message */
        SendMessageW(HWND_BROADCAST,
                     WM_TIMECHANGE,
                     0,
                     0);
    }
}
예제 #4
0
LRESULT CTimePickerDialog::OnOK(WORD /*wNotifyCode*/, WORD wID, HWND hwnd, BOOL& /*bHandled*/)
{
	SYSTEMTIME sysTime;
	DateTime_GetSystemtime (GetDlgItem(IDC_TIME_CTRL), &sysTime);
	m_returnTime = SystemTimeToUnixTime (&sysTime);

    EndDialog(wID);
    return 0;
}
예제 #5
0
BOOL CXUIDatePicker::isNone()
{
	SYSTEMTIME tm;
	if(DateTime_GetSystemtime(m_hWnd, &tm) != GDT_VALID)
	{
		return TRUE;
	}
	return FALSE;
}
예제 #6
0
wxDateTime wxDatePickerCtrl::MSWGetControlValue() const
{
    wxDateTime dt;
    SYSTEMTIME st;
    if ( DateTime_GetSystemtime(GetHwnd(), &st) == GDT_VALID )
    {
        dt.SetFromMSWSysDate(st);
    }

    return dt;
}
예제 #7
0
uint64 DateTimeFrame::getDate() const
{
  SYSTEMTIME st;
  if (DateTime_GetSystemtime(hWnd, &st) != GDT_VALID)
    return 0;
  FILETIME ft;
  SystemTimeToFileTime(&st, &ft);
  uint64 result = uint64(ft.dwLowDateTime) | (uint64(ft.dwHighDateTime) << 32);
  result = result / 10000000ULL - 11644473600ULL;
  return result;
}
예제 #8
0
파일: datectrl.cpp 프로젝트: Duion/Torsion
wxDateTime wxDatePickerCtrl::GetValue() const
{
    wxDateTime dt;
    SYSTEMTIME st;
    if ( DateTime_GetSystemtime(GetHwnd(), &st) == GDT_VALID )
    {
        wxFromSystemTime(&dt, st);
    }

    return dt;
}
예제 #9
0
LRESULT CDateTimePickerDialog::OnOK(WORD /*wNotifyCode*/, WORD wID, HWND hwnd, BOOL& /*bHandled*/)
{
	SYSTEMTIME sysTime;

	if (m_format == CDateTimeMessage::FORMAT_TIME)
	{
		DateTime_GetSystemtime (GetDlgItem(IDC_TIME_CTRL), &sysTime);
	} 
	else if (m_format == CDateTimeMessage::FORMAT_DATE)
	{
		DateTime_GetSystemtime (GetDlgItem(IDC_DATE_CTRL), &sysTime);
	} 
	else if (m_format == CDateTimeMessage::FORMAT_DATE_TIME)
	{
		SYSTEMTIME time, date;

		DateTime_GetSystemtime (GetDlgItem(IDC_TIME_CTRL), &time);
		DateTime_GetSystemtime (GetDlgItem(IDC_DATE_CTRL), &date);

		sysTime.wYear		= date.wYear; 
		sysTime.wMonth		= date.wMonth; 
		sysTime.wDayOfWeek	= date.wDayOfWeek; 
		sysTime.wDay		= date.wDay; 
		sysTime.wHour		= time.wHour; 
		sysTime.wMinute		= time.wMinute;
		sysTime.wSecond		= time.wSecond; 
	} 
	else
	{
		LOG(ERROR) + "invalid format";
		m_returnTime = 0;
	}

	m_returnTime = SystemTimeToUnixTime (&sysTime);

    EndDialog(wID);
    return 0;
}
예제 #10
0
// Convert the values from calendar to string
void
CalendarCtrl::ConvertCtrlValues()
{
    wyString    temp;
	m_date.Clear();
	SYSTEMTIME seltime;
	
	MonthCal_GetCurSel(GetDlgItem(m_hwnd,IDC_MONTHCALENDAR1), &seltime);
	m_date.AddSprintf("%04u-%02u-%02u",seltime.wYear,seltime.wMonth,seltime.wDay);
	
	if(!m_isDate)
	{
		DateTime_GetSystemtime(GetDlgItem(m_hwnd,IDC_DATETIMEPICKER1), &seltime);
		m_date.AddSprintf(" %02u:%02u:%02u",seltime.wHour,seltime.wMinute,seltime.wSecond);
	}
}
예제 #11
0
wxDateTime wxDatePickerCtrl::GetValue() const
{
#if wxDEBUG_LEVEL
    wxDateTime dt;
    SYSTEMTIME st;
    if ( DateTime_GetSystemtime(GetHwnd(), &st) == GDT_VALID )
    {
        dt.SetFromMSWSysTime(st);
    }

    wxASSERT_MSG( m_date.IsValid() == dt.IsValid() &&
                    (!dt.IsValid() || dt == m_date),
                  wxT("bug in wxDatePickerCtrl: m_date not in sync") );
#endif // wxDEBUG_LEVEL

    return m_date;
}
예제 #12
0
static INT_PTR CALLBACK SettingsDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM lParam)
{
	switch(msg) {
	case WM_INITDIALOG:
		{
			LCID locale;
			hwndSettingsDlg=hwndDlg;
			TranslateDialogDefault(hwndDlg);
			locale=CallService(MS_LANGPACK_GETLOCALE,0,0);
			SendDlgItemMessage(hwndDlg,IDC_ICON_HEADER,STM_SETIMAGE,IMAGE_ICON,(LPARAM)Skin_GetIcon("AutoShutdown_Header"));
			{
				HFONT hBoldFont;
				LOGFONT lf;
				if (GetObject((HFONT)SendDlgItemMessage(hwndDlg,IDC_TEXT_HEADER,WM_GETFONT,0,0),sizeof(lf),&lf)) {
					lf.lfWeight=FW_BOLD;
					hBoldFont=CreateFontIndirect(&lf);
				} else hBoldFont=NULL;
				SendDlgItemMessage(hwndDlg,IDC_TEXT_HEADER,WM_SETFONT,(WPARAM)hBoldFont,FALSE);
			}
			/* read-in watcher flags */
			{
				WORD watcherType=db_get_w(NULL,"AutoShutdown","WatcherFlags",SETTING_WATCHERFLAGS_DEFAULT);
				CheckRadioButton(hwndDlg,IDC_RADIO_STTIME,IDC_RADIO_STCOUNTDOWN,(watcherType&SDWTF_ST_TIME)?IDC_RADIO_STTIME:IDC_RADIO_STCOUNTDOWN);
				CheckDlgButton(hwndDlg,IDC_CHECK_SPECIFICTIME,(watcherType&SDWTF_SPECIFICTIME) != 0 ? BST_CHECKED : BST_UNCHECKED);
				CheckDlgButton(hwndDlg,IDC_CHECK_MESSAGE,(watcherType&SDWTF_MESSAGE) != 0 ? BST_CHECKED : BST_UNCHECKED);
				CheckDlgButton(hwndDlg,IDC_CHECK_FILETRANSFER,(watcherType&SDWTF_FILETRANSFER) != 0 ? BST_CHECKED : BST_UNCHECKED);
				CheckDlgButton(hwndDlg,IDC_CHECK_IDLE,(watcherType&SDWTF_IDLE) != 0 ? BST_CHECKED : BST_UNCHECKED);
				CheckDlgButton(hwndDlg,IDC_CHECK_STATUS,(watcherType&SDWTF_STATUS) != 0 ? BST_CHECKED : BST_UNCHECKED);
				CheckDlgButton(hwndDlg,IDC_CHECK_CPUUSAGE,(watcherType&SDWTF_CPUUSAGE) != 0 ? BST_CHECKED : BST_UNCHECKED);
			}
			/* read-in countdown val */
			{
				SYSTEMTIME st;
				if (!TimeStampToSystemTime((time_t)db_get_dw(NULL,"AutoShutdown","TimeStamp",SETTING_TIMESTAMP_DEFAULT),&st))
					GetLocalTime(&st);
				DateTime_SetSystemtime(GetDlgItem(hwndDlg,IDC_TIME_TIMESTAMP),GDT_VALID,&st);
				DateTime_SetSystemtime(GetDlgItem(hwndDlg,IDC_DATE_TIMESTAMP),GDT_VALID,&st);
				SendMessage(hwndDlg,M_CHECK_DATETIME,0,0);
			}
			{
				DWORD setting=db_get_dw(NULL,"AutoShutdown","Countdown",SETTING_COUNTDOWN_DEFAULT);
				if (setting<1) setting=SETTING_COUNTDOWN_DEFAULT;
				SendDlgItemMessage(hwndDlg,IDC_SPIN_COUNTDOWN,UDM_SETRANGE,0,MAKELPARAM(UD_MAXVAL,1));
				SendDlgItemMessage(hwndDlg,IDC_EDIT_COUNTDOWN,EM_SETLIMITTEXT,(WPARAM)10,0);
				SendDlgItemMessage(hwndDlg,IDC_SPIN_COUNTDOWN,UDM_SETPOS,0,MAKELPARAM(setting,0));
				SetDlgItemInt(hwndDlg,IDC_EDIT_COUNTDOWN,setting,FALSE);
			}
			{
				HWND hwndCombo=GetDlgItem(hwndDlg,IDC_COMBO_COUNTDOWNUNIT);
				DWORD lastUnit=db_get_dw(NULL,"AutoShutdown","CountdownUnit",SETTING_COUNTDOWNUNIT_DEFAULT);
				SendMessage(hwndCombo,CB_SETLOCALE,(WPARAM)locale,0); /* sort order */
				SendMessage(hwndCombo,CB_INITSTORAGE,SIZEOF(unitNames),SIZEOF(unitNames)*16); /* approx. */
				for(int i=0;i<SIZEOF(unitNames);++i) {
					int index=SendMessage(hwndCombo,CB_ADDSTRING,0,(LPARAM)TranslateTS(unitNames[i]));
					if (index != LB_ERR) {
						SendMessage(hwndCombo,CB_SETITEMDATA,index,(LPARAM)unitValues[i]);
						if (i==0 || unitValues[i]==lastUnit) SendMessage(hwndCombo,CB_SETCURSEL,index,0);
					}
				}
			}
			{
				DBVARIANT dbv;
				if (!db_get_ts(NULL,"AutoShutdown","Message",&dbv)) {
					SetDlgItemText(hwndDlg,IDC_EDIT_MESSAGE,dbv.ptszVal);
					mir_free(dbv.ptszVal);
				}
			}
			/* cpuusage threshold */
			{
				BYTE setting=DBGetContactSettingRangedByte(NULL,"AutoShutdown","CpuUsageThreshold",SETTING_CPUUSAGETHRESHOLD_DEFAULT,1,100);
				SendDlgItemMessage(hwndDlg,IDC_SPIN_CPUUSAGE,UDM_SETRANGE,0,MAKELPARAM(100,1));
				SendDlgItemMessage(hwndDlg,IDC_EDIT_CPUUSAGE,EM_SETLIMITTEXT,(WPARAM)3,0);
				SendDlgItemMessage(hwndDlg,IDC_SPIN_CPUUSAGE,UDM_SETPOS,0,MAKELPARAM(setting,0));
				SetDlgItemInt(hwndDlg,IDC_EDIT_CPUUSAGE,setting,FALSE);
			}
			/* shutdown types */
			{
				HWND hwndCombo=GetDlgItem(hwndDlg,IDC_COMBO_SHUTDOWNTYPE);
				BYTE lastShutdownType=db_get_b(NULL,"AutoShutdown","ShutdownType",SETTING_SHUTDOWNTYPE_DEFAULT);
				SendMessage(hwndCombo,CB_SETLOCALE,(WPARAM)locale,0); /* sort order */
				SendMessage(hwndCombo,CB_SETEXTENDEDUI,TRUE,0);
				SendMessage(hwndCombo,CB_INITSTORAGE,SDSDT_MAX,SDSDT_MAX*32);
				for(BYTE shutdownType=1;shutdownType<=SDSDT_MAX;++shutdownType)
					if (ServiceIsTypeEnabled(shutdownType,0)) {
						TCHAR *pszText=(TCHAR*)ServiceGetTypeDescription(shutdownType,GSTDF_TCHAR); /* never fails */
						int index=SendMessage(hwndCombo,CB_ADDSTRING,0,(LPARAM)pszText);
						if (index != LB_ERR) {
							SendMessage(hwndCombo,CB_SETITEMDATA,index,(LPARAM)shutdownType);
							if (shutdownType==1 || shutdownType==lastShutdownType) SendMessage(hwndCombo,CB_SETCURSEL,(WPARAM)index,0);
						}
					}
				SendMessage(hwndDlg,M_UPDATE_SHUTDOWNDESC,0,(LPARAM)hwndCombo);
			}
			/* check if proto is installed that supports instant messages and check if a message dialog plugin is installed */
			if (!AnyProtoHasCaps(PF1_IMRECV) || !ServiceExists(MS_MSG_SENDMESSAGE)) { /* no srmessage present? */
				CheckDlgButton(hwndDlg, IDC_CHECK_MESSAGE, BST_UNCHECKED);
				EnableWindow(GetDlgItem(hwndDlg,IDC_CHECK_MESSAGE),FALSE);
				EnableWindow(GetDlgItem(hwndDlg,IDC_EDIT_MESSAGE),FALSE);
			}
			/* check if proto is installed that supports file transfers and check if a file transfer dialog is available */
			if (!AnyProtoHasCaps(PF1_FILESEND) && !AnyProtoHasCaps(PF1_FILERECV)) {  /* no srfile present? */
				CheckDlgButton(hwndDlg, IDC_CHECK_FILETRANSFER, BST_UNCHECKED);
				EnableWindow(GetDlgItem(hwndDlg,IDC_CHECK_FILETRANSFER),FALSE);
			}
			/* check if cpu usage can be detected */
			if (!PollCpuUsage(DisplayCpuUsageProc,(LPARAM)GetDlgItem(hwndDlg,IDC_TEXT_CURRENTCPU),1800)) {
				CheckDlgButton(hwndDlg, IDC_CHECK_CPUUSAGE, BST_UNCHECKED);
				EnableWindow(GetDlgItem(hwndDlg,IDC_CHECK_CPUUSAGE),FALSE);
			}
			SendMessage(hwndDlg,M_ENABLE_SUBCTLS,0,0);
			Utils_RestoreWindowPositionNoSize(hwndDlg,NULL,"AutoShutdown","SettingsDlg_");
			return TRUE; /* default focus */
		}
	case WM_DESTROY:
		{
			Utils_SaveWindowPosition(hwndDlg,NULL,"AutoShutdown","SettingsDlg_");
			HICON hIcon=(HICON)SendDlgItemMessage(hwndDlg,IDC_ICON_HEADER,STM_SETIMAGE,IMAGE_ICON,0);
			HFONT hFont=(HFONT)SendDlgItemMessage(hwndDlg,IDC_TEXT_HEADER,WM_GETFONT,0,0);
			SendDlgItemMessage(hwndDlg,IDC_TEXT_HEADER,WM_SETFONT,0,FALSE); /* no return value */
			if (hFont != NULL) DeleteObject(hFont);
			hwndSettingsDlg=NULL;
		}
		return TRUE;

	case WM_CTLCOLORSTATIC:
		switch(GetDlgCtrlID((HWND)lParam)) {
		case IDC_ICON_HEADER:
			SetBkMode((HDC)wParam,TRANSPARENT);
		case IDC_RECT_HEADER:
			/* need to set COLOR_WINDOW manually for Win9x */
			SetBkColor((HDC)wParam,GetSysColor(COLOR_WINDOW));
			return (BOOL)GetSysColorBrush(COLOR_WINDOW);
		case IDC_TEXT_HEADER:
		case IDC_TEXT_HEADERDESC:
			SetBkMode((HDC)wParam,TRANSPARENT);
			return (BOOL)GetStockObject(NULL_BRUSH);
		}
		break;

	case M_ENABLE_SUBCTLS:
		{
			BOOL checked=IsDlgButtonChecked(hwndDlg,IDC_CHECK_MESSAGE) != 0;
			EnableDlgItem(hwndDlg,IDC_EDIT_MESSAGE,checked);
			checked=IsDlgButtonChecked(hwndDlg,IDC_CHECK_SPECIFICTIME) != 0;
			EnableDlgItem(hwndDlg,IDC_RADIO_STTIME,checked);
			EnableDlgItem(hwndDlg,IDC_RADIO_STCOUNTDOWN,checked);
			checked=(IsDlgButtonChecked(hwndDlg,IDC_CHECK_SPECIFICTIME) && IsDlgButtonChecked(hwndDlg,IDC_RADIO_STTIME));
			EnableDlgItem(hwndDlg,IDC_TIME_TIMESTAMP,checked);
			EnableDlgItem(hwndDlg,IDC_DATE_TIMESTAMP,checked);
			checked=(IsDlgButtonChecked(hwndDlg,IDC_CHECK_SPECIFICTIME) && IsDlgButtonChecked(hwndDlg,IDC_RADIO_STCOUNTDOWN));
			EnableDlgItem(hwndDlg,IDC_EDIT_COUNTDOWN,checked);
			EnableDlgItem(hwndDlg,IDC_SPIN_COUNTDOWN,checked);
			EnableDlgItem(hwndDlg,IDC_COMBO_COUNTDOWNUNIT,checked);
			checked=IsDlgButtonChecked(hwndDlg,IDC_CHECK_IDLE) != 0;
			EnableDlgItem(hwndDlg,IDC_URL_IDLE,checked);
			checked=IsDlgButtonChecked(hwndDlg,IDC_CHECK_CPUUSAGE) != 0;
			EnableDlgItem(hwndDlg,IDC_EDIT_CPUUSAGE,checked);
			EnableDlgItem(hwndDlg,IDC_SPIN_CPUUSAGE,checked);
			EnableDlgItem(hwndDlg,IDC_TEXT_PERCENT,checked);
			EnableDlgItem(hwndDlg,IDC_TEXT_CURRENTCPU,checked);
			checked=(IsDlgButtonChecked(hwndDlg,IDC_CHECK_SPECIFICTIME) || IsDlgButtonChecked(hwndDlg,IDC_CHECK_MESSAGE) ||
				IsDlgButtonChecked(hwndDlg,IDC_CHECK_IDLE) || IsDlgButtonChecked(hwndDlg,IDC_CHECK_STATUS) ||
				IsDlgButtonChecked(hwndDlg,IDC_CHECK_FILETRANSFER) || IsDlgButtonChecked(hwndDlg,IDC_CHECK_CPUUSAGE));
			EnableDlgItem(hwndDlg,IDOK,checked);
		}
		return TRUE;
	case M_UPDATE_SHUTDOWNDESC: /* lParam=(LPARAM)(HWND)hwndCombo */
		{
			BYTE shutdownType = (BYTE)SendMessage((HWND)lParam,CB_GETITEMDATA,SendMessage((HWND)lParam,CB_GETCURSEL,0,0),0);
			SetDlgItemText(hwndDlg,IDC_TEXT_SHUTDOWNTYPE,(TCHAR*)ServiceGetTypeDescription(shutdownType,GSTDF_LONGDESC|GSTDF_TCHAR));
		}
		return TRUE;

	case WM_TIMECHANGE: /* system time changed */
		SendMessage(hwndDlg,M_CHECK_DATETIME,0,0);
		return TRUE;

	case M_CHECK_DATETIME:
		{
			SYSTEMTIME st,stBuf;
			time_t timestamp;
			DateTime_GetSystemtime(GetDlgItem(hwndDlg,IDC_DATE_TIMESTAMP),&stBuf);
			DateTime_GetSystemtime(GetDlgItem(hwndDlg,IDC_TIME_TIMESTAMP),&st);
			st.wDay=stBuf.wDay;
			st.wDayOfWeek=stBuf.wDayOfWeek;
			st.wMonth=stBuf.wMonth;
			st.wYear=stBuf.wYear;
			GetLocalTime(&stBuf);
			if (SystemTimeToTimeStamp(&st,&timestamp)) {
				/* set to current date if earlier */
				if (timestamp<time(NULL)) {
					st.wDay=stBuf.wDay;
					st.wDayOfWeek=stBuf.wDayOfWeek;
					st.wMonth=stBuf.wMonth;
					st.wYear=stBuf.wYear;
					if (SystemTimeToTimeStamp(&st,&timestamp)) {
						/* step one day up if still earlier */
						if (timestamp<time(NULL)) {
							timestamp+=24*60*60;
							TimeStampToSystemTime(timestamp,&st);
						}
					}
				}
			}
			DateTime_SetRange(GetDlgItem(hwndDlg,IDC_DATE_TIMESTAMP),GDTR_MIN,&stBuf);
			DateTime_SetRange(GetDlgItem(hwndDlg,IDC_TIME_TIMESTAMP),GDTR_MIN,&stBuf);
			DateTime_SetSystemtime(GetDlgItem(hwndDlg,IDC_DATE_TIMESTAMP),GDT_VALID,&st);
			DateTime_SetSystemtime(GetDlgItem(hwndDlg,IDC_TIME_TIMESTAMP),GDT_VALID,&st);
			return TRUE;
		}
	case WM_NOTIFY:
		switch(((NMHDR*)lParam)->idFrom) {
		case IDC_TIME_TIMESTAMP:
		case IDC_DATE_TIMESTAMP:
			switch(((NMHDR*)lParam)->code) {
			case DTN_CLOSEUP:
			case NM_KILLFOCUS:
				PostMessage(hwndDlg,M_CHECK_DATETIME,0,0);
				return TRUE;
			}
		}
		break;

	case WM_COMMAND:
		switch(LOWORD(wParam)) {
		case IDC_CHECK_MESSAGE:
		case IDC_CHECK_FILETRANSFER:
		case IDC_CHECK_IDLE:
		case IDC_CHECK_CPUUSAGE:
		case IDC_CHECK_STATUS:
		case IDC_CHECK_SPECIFICTIME:
		case IDC_RADIO_STTIME:
		case IDC_RADIO_STCOUNTDOWN:
			SendMessage(hwndDlg,M_ENABLE_SUBCTLS,0,0);
			return TRUE;

		case IDC_EDIT_COUNTDOWN:
			if (HIWORD(wParam)==EN_KILLFOCUS) {
				if ((int)GetDlgItemInt(hwndDlg,IDC_EDIT_COUNTDOWN,NULL,TRUE)<1) {
					SendDlgItemMessage(hwndDlg,IDC_SPIN_COUNTDOWN,UDM_SETPOS,0,MAKELPARAM(1,0));
					SetDlgItemInt(hwndDlg,IDC_EDIT_COUNTDOWN,1,FALSE);
				}
				return TRUE;
			}
			break;

		case IDC_EDIT_CPUUSAGE:
			if (HIWORD(wParam)==EN_KILLFOCUS) {
				WORD val=(WORD)GetDlgItemInt(hwndDlg,IDC_EDIT_CPUUSAGE,NULL,FALSE);
				if (val<1) val=1;
				else if (val>100) val=100;
				SendDlgItemMessage(hwndDlg,IDC_SPIN_CPUUSAGE,UDM_SETPOS,0,MAKELPARAM(val,0));
				SetDlgItemInt(hwndDlg,IDC_EDIT_CPUUSAGE,val,FALSE);
				return TRUE;
			}
			break;

		case IDC_URL_IDLE:
			{	
				OPENOPTIONSDIALOG ood;
				ood.cbSize = sizeof(ood);
				ood.pszGroup = "Status"; /* autotranslated */
				ood.pszPage = "Idle"; /* autotranslated */
				ood.pszTab = NULL;
				Options_Open(&ood);
				return TRUE;
			}

		case IDC_COMBO_SHUTDOWNTYPE:
			if (HIWORD(wParam)==CBN_SELCHANGE)
				SendMessage(hwndDlg,M_UPDATE_SHUTDOWNDESC,0,lParam);
			return TRUE;

		case IDOK: /* save settings and start watcher */
			ShowWindow(hwndDlg,SW_HIDE);
			/* message text */
			{
				HWND hwndEdit=GetDlgItem(hwndDlg,IDC_EDIT_MESSAGE);
				int len=GetWindowTextLength(hwndEdit)+1;
				TCHAR *pszText=(TCHAR*)mir_alloc(len*sizeof(TCHAR));
				if (pszText != NULL && GetWindowText(hwndEdit,pszText,len+1)) {
					TrimString(pszText);
					db_set_ts(NULL,"AutoShutdown","Message",pszText);
				}
				mir_free(pszText); /* does NULL check */
			}
			/* timestamp */
			{
				SYSTEMTIME st;
				time_t timestamp;
				DateTime_GetSystemtime(GetDlgItem(hwndDlg,IDC_TIME_TIMESTAMP),&st); /* time gets synchronized */
				if (!SystemTimeToTimeStamp(&st,&timestamp))
					timestamp=time(NULL);
				db_set_dw(NULL,"AutoShutdown","TimeStamp",(DWORD)timestamp);
			}
			/* shutdown type */
			{
				int index = SendDlgItemMessage(hwndDlg,IDC_COMBO_SHUTDOWNTYPE,CB_GETCURSEL,0,0);
				if (index != LB_ERR) db_set_b(NULL,"AutoShutdown","ShutdownType",(BYTE)SendDlgItemMessage(hwndDlg,IDC_COMBO_SHUTDOWNTYPE,CB_GETITEMDATA,(WPARAM)index,0));
				index=SendDlgItemMessage(hwndDlg,IDC_COMBO_COUNTDOWNUNIT,CB_GETCURSEL,0,0);
				if (index != LB_ERR) db_set_dw(NULL,"AutoShutdown","CountdownUnit",(DWORD)SendDlgItemMessage(hwndDlg,IDC_COMBO_COUNTDOWNUNIT,CB_GETITEMDATA,(WPARAM)index,0));
				db_set_dw(NULL,"AutoShutdown","Countdown",(DWORD)GetDlgItemInt(hwndDlg,IDC_EDIT_COUNTDOWN,NULL,FALSE));
				db_set_b(NULL,"AutoShutdown","CpuUsageThreshold",(BYTE)GetDlgItemInt(hwndDlg,IDC_EDIT_CPUUSAGE,NULL,FALSE));
			}
			/* watcher type */
			{
				WORD watcherType = (WORD)(IsDlgButtonChecked(hwndDlg,IDC_RADIO_STTIME)?SDWTF_ST_TIME:SDWTF_ST_COUNTDOWN);
				if (IsDlgButtonChecked(hwndDlg,IDC_CHECK_SPECIFICTIME)) watcherType|=SDWTF_SPECIFICTIME;
				if (IsDlgButtonChecked(hwndDlg,IDC_CHECK_MESSAGE)) watcherType|=SDWTF_MESSAGE;
				if (IsDlgButtonChecked(hwndDlg,IDC_CHECK_FILETRANSFER)) watcherType|=SDWTF_FILETRANSFER;
				if (IsDlgButtonChecked(hwndDlg,IDC_CHECK_IDLE)) watcherType|=SDWTF_IDLE;
				if (IsDlgButtonChecked(hwndDlg,IDC_CHECK_STATUS)) watcherType|=SDWTF_STATUS;
				if (IsDlgButtonChecked(hwndDlg,IDC_CHECK_CPUUSAGE)) watcherType|=SDWTF_CPUUSAGE;
				db_set_w(NULL,"AutoShutdown","WatcherFlags",watcherType);
				ServiceStartWatcher(0,watcherType);
			}
			DestroyWindow(hwndDlg);
			return TRUE;
			/* fall through */
		case IDCANCEL: /* WM_CLOSE */
			DestroyWindow(hwndDlg);
			SetShutdownToolbarButton(false);
			SetShutdownMenuItem(false);
			return TRUE;
		}
		break;
	}
	return FALSE;
}
예제 #13
0
bool DateTimeFrame::isDateSet() const
{
  SYSTEMTIME st;
  return (DateTime_GetSystemtime(hWnd, &st) == GDT_VALID);
}
예제 #14
0
INT_PTR CALLBACK MirandaAdvOptionsPageProc(HWND hdlg,UINT message,WPARAM wParam,LPARAM lParam)
{
	switch(message) {
	case WM_INITDIALOG:
		TranslateDialogDefault(hdlg);
		{
			struct tm *TM = NULL;
			struct _SYSTEMTIME ST = {0};

			dwSinceDate = db_get_dw(NULL,IMPORT_MODULE,"ImportSinceTS",time(NULL));

			TM = localtime(&dwSinceDate);

			ST.wYear = TM->tm_year + 1900;
			ST.wMonth = TM->tm_mon + 1;
			ST.wDay = TM->tm_mday;

    		DateTime_SetSystemtime(GetDlgItem(hdlg,IDC_DATETIMEPICKER),GDT_VALID,&ST);
		}
		return TRUE;

	case WM_COMMAND:
		switch(LOWORD(wParam)) {
		case IDC_BACK:
			PostMessage(GetParent(hdlg),WIZM_GOTOPAGE,IDD_OPTIONS,(LPARAM)MirandaOptionsPageProc);
			break;

		case IDOK:
			DoImport = MirandaImport;
			nImportOption = IMPORT_CUSTOM;
			nCustomOptions = 0;

			if (IsDlgButtonChecked(hdlg,IDC_CONTACTS))
				nCustomOptions |= IOPT_CONTACTS | IOPT_GROUPS;
			if (IsDlgButtonChecked(hdlg,IDC_SYSTEM))
				nCustomOptions |= IOPT_SYSTEM;

			// incoming
			if (IsDlgButtonChecked(hdlg,IDC_IN_MSG))
				nCustomOptions |= IOPT_MSGRECV;
			if (IsDlgButtonChecked(hdlg,IDC_IN_URL))
				nCustomOptions |= IOPT_URLRECV;
			if (IsDlgButtonChecked(hdlg,IDC_IN_FT))
				nCustomOptions |= IOPT_FILERECV;
			if (IsDlgButtonChecked(hdlg,IDC_IN_OTHER))
				nCustomOptions |= IOPT_OTHERRECV;

			// outgoing
			if (IsDlgButtonChecked(hdlg,IDC_OUT_MSG))
				nCustomOptions |= IOPT_MSGSENT;
			if (IsDlgButtonChecked(hdlg,IDC_OUT_URL))
				nCustomOptions |= IOPT_URLSENT;
			if (IsDlgButtonChecked(hdlg,IDC_OUT_FT))
				nCustomOptions |= IOPT_FILESENT;
			if (IsDlgButtonChecked(hdlg,IDC_OUT_OTHER))
				nCustomOptions |= IOPT_OTHERSENT;

			// since date
			dwSinceDate = 0;

			if ( IsDlgButtonChecked( hdlg, IDC_SINCE )) {
				struct _SYSTEMTIME ST = {0};

				if (DateTime_GetSystemtime(GetDlgItem(hdlg,IDC_DATETIMEPICKER), &ST) == GDT_VALID) {
					struct tm TM = {0};

					TM.tm_mday = ST.wDay;
					TM.tm_mon = ST.wMonth - 1;
					TM.tm_year = ST.wYear - 1900;

					dwSinceDate = mktime(&TM);

					db_set_dw(NULL,IMPORT_MODULE,"ImportSinceTS",dwSinceDate);
  			}	}

			if (nCustomOptions)
				PostMessage(GetParent(hdlg),WIZM_GOTOPAGE,IDD_PROGRESS,(LPARAM)ProgressPageProc);
			break;

		case IDCANCEL:
			PostMessage(GetParent(hdlg), WM_CLOSE, 0, 0);
			break;

		case IDC_SINCE:
			EnableWindow(GetDlgItem(hdlg, IDC_DATETIMEPICKER), IsDlgButtonChecked(hdlg, IDC_SINCE));
			break;

		if (HIWORD(wParam) != STN_CLICKED)
			break;

		case IDC_ALL:
		case IDC_INCOMING:
		case IDC_OUTGOING:
			if (LOWORD(wParam) == IDC_ALL)
				for (int i = 0; i < sizeof(SysControls)/sizeof(SysControls[0]); i++)
					CheckDlgButton(hdlg,SysControls[i], !IsDlgButtonChecked(hdlg,SysControls[i]));

			if (LOWORD(wParam) != IDC_OUTGOING)
				for (int i = 0; i < sizeof(InControls)/sizeof(InControls[0]); i++)
					CheckDlgButton(hdlg,InControls[i], !IsDlgButtonChecked(hdlg,InControls[i]));

			if (LOWORD(wParam) != IDC_INCOMING)
				for (int i = 0; i < sizeof(OutControls)/sizeof(OutControls[0]); i++)
					CheckDlgButton(hdlg,OutControls[i], !IsDlgButtonChecked(hdlg,OutControls[i]));
			break;

		case IDC_MSG:
			CheckDlgButton(hdlg,IDC_IN_MSG, !IsDlgButtonChecked(hdlg,IDC_IN_MSG));
			CheckDlgButton(hdlg,IDC_OUT_MSG, !IsDlgButtonChecked(hdlg,IDC_OUT_MSG));
			break;

		case IDC_URL:
			CheckDlgButton(hdlg,IDC_IN_URL, !IsDlgButtonChecked(hdlg,IDC_IN_URL));
			CheckDlgButton(hdlg,IDC_OUT_URL, !IsDlgButtonChecked(hdlg,IDC_OUT_URL));
			break;

		case IDC_FT:
			CheckDlgButton(hdlg,IDC_IN_FT, !IsDlgButtonChecked(hdlg,IDC_IN_FT));
			CheckDlgButton(hdlg,IDC_OUT_FT, !IsDlgButtonChecked(hdlg,IDC_OUT_FT));
			break;

		case IDC_OTHER:
			CheckDlgButton(hdlg,IDC_IN_OTHER, !IsDlgButtonChecked(hdlg,IDC_IN_OTHER));
			CheckDlgButton(hdlg,IDC_OUT_OTHER, !IsDlgButtonChecked(hdlg,IDC_OUT_OTHER));
			break;
		}
		break;
	}
	return FALSE;
}
예제 #15
0
//Record movie dialog
static INT_PTR CALLBACK RecordDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
	static struct CreateMovieParameters* p = NULL;
	std::wstring author = L"";
	std::string fname;
	SYSTEMTIME systime;
	switch(uMsg)
	{
		case WM_INITDIALOG: {
			CheckDlgButton(hwndDlg, IDC_START_FROM_SRAM, ((flag == 1) ? BST_CHECKED : BST_UNCHECKED));
			SetFocus(GetDlgItem(hwndDlg, IDC_EDIT_FILENAME));

			DateTime t = FCEUI_MovieGetRTCDefault();
			ZeroMemory(&systime, sizeof(SYSTEMTIME));
			systime.wYear = t.get_Year();
			systime.wMonth = t.get_Month();
			systime.wDay = t.get_Day();
			systime.wDayOfWeek = t.get_DayOfWeek();
			systime.wHour = t.get_Hour();
			systime.wMinute = t.get_Minute();
			systime.wSecond = t.get_Second();
			systime.wMilliseconds = t.get_Millisecond();
			DateTime_SetSystemtime(GetDlgItem(hwndDlg, IDC_DTP_DATE), GDT_VALID, &systime);
			DateTime_SetSystemtime(GetDlgItem(hwndDlg, IDC_DTP_TIME), GDT_VALID, &systime);

			union {
				struct { SYSTEMTIME rtcMin, rtcMax; };
				SYSTEMTIME rtcMinMax[2];
			};
			ZeroMemory(&rtcMin, sizeof(SYSTEMTIME));
			ZeroMemory(&rtcMax, sizeof(SYSTEMTIME));
			rtcMin.wYear = 2000;
			rtcMin.wMonth = 1;
			rtcMin.wDay = 1;
			rtcMin.wDayOfWeek = 6;
			rtcMax.wYear = 2099;
			rtcMax.wMonth = 12;
			rtcMax.wDay = 31;
			rtcMax.wDayOfWeek = 4;
			DateTime_SetRange(GetDlgItem(hwndDlg, IDC_DTP_DATE), GDTR_MIN, &rtcMinMax);
			DateTime_SetRange(GetDlgItem(hwndDlg, IDC_DTP_DATE), GDTR_MAX, &rtcMinMax);
			return false;
		}

		case WM_COMMAND:
			switch(LOWORD(wParam))
			{
			case IDOK: {
				author = GetDlgItemTextW<500>(hwndDlg,IDC_EDIT_AUTHOR);
				fname = GetDlgItemText<MAX_PATH>(hwndDlg,IDC_EDIT_FILENAME);
				std::string sramfname = GetDlgItemText<MAX_PATH>(hwndDlg,IDC_EDIT_SRAMFILENAME);
				if (fname.length())
				{
					struct tm t;

					DateTime_GetSystemtime(GetDlgItem(hwndDlg, IDC_DTP_DATE), &systime);
					t.tm_year = systime.wYear;
					t.tm_mon  = systime.wMonth;
					t.tm_mday = systime.wDay;
					t.tm_wday = systime.wDayOfWeek;
					DateTime_GetSystemtime(GetDlgItem(hwndDlg, IDC_DTP_TIME), &systime);
					t.tm_hour = systime.wHour;
					t.tm_min  = systime.wMinute;
					t.tm_sec  = systime.wSecond;
					DateTime rtcstart(t.tm_year,t.tm_mon,t.tm_mday,t.tm_hour,t.tm_min,t.tm_sec);

					FCEUI_SaveMovie(fname.c_str(), author, flag, sramfname, rtcstart);
					EndDialog(hwndDlg, 0);
				}
				return true;
			}

			case IDCANCEL:
				EndDialog(hwndDlg, 0);
				return true;
	
			case IDC_BUTTON_BROWSEFILE:
			{
				OPENFILENAME ofn;
				char szChoice[MAX_PATH]={0};
				GetDlgItemText(hwndDlg,IDC_EDIT_FILENAME,szChoice,MAX_PATH);

				// browse button
				ZeroMemory(&ofn, sizeof(ofn));
				ofn.lStructSize = sizeof(ofn);
				ofn.hwndOwner = hwndDlg;
				ofn.lpstrFilter = "Desmume Movie File (*.dsm)\0*.dsm\0All files(*.*)\0*.*\0\0";
				ofn.lpstrFile = szChoice;
				ofn.lpstrTitle = "Record a new movie";
				ofn.lpstrDefExt = "dsm";
				ofn.nMaxFile = MAX_PATH;
				ofn.Flags = OFN_OVERWRITEPROMPT | OFN_NOREADONLYRETURN | OFN_PATHMUSTEXIST;
				if(GetSaveFileName(&ofn))
				{
					fname = szChoice;
/* // windows does this automatically, since lpstrDefExt is set
					//If user did not specify an extension, add .dsm for them
					x = fname.find_last_of(".");
					if (x < 0)
						fname.append(".dsm");
*/
					SetDlgItemText(hwndDlg, IDC_EDIT_FILENAME, fname.c_str());
				}
				//if(GetSaveFileName(&ofn))
				//	UpdateRecordDialogPath(hwndDlg,szChoice);

				return true;
			}
			case IDC_BUTTON_BROWSESRAM:
			{
				OPENFILENAME ofn;
				char szChoice[MAX_PATH]={0};

				// browse button
				ZeroMemory(&ofn, sizeof(ofn));
				ofn.lStructSize = sizeof(ofn);
				ofn.hwndOwner = hwndDlg;
				ofn.lpstrFilter = "Desmume SRAM File (*.dsv)\0*.dsv\0All files(*.*)\0*.*\0\0";
				ofn.lpstrFile = szChoice;
				ofn.lpstrTitle = "Choose SRAM";
				ofn.lpstrDefExt = "dsv";
				ofn.nMaxFile = MAX_PATH;
				ofn.Flags = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT;
				if(GetOpenFileName(&ofn))
				{
					fname = szChoice;
/* // windows does this automatically, since lpstrDefExt is set
				//If user did not specify an extension, add .dsv for them
				x = fname.find_last_of(".");
				if (x < 0)
					fname.append(".dsv");
*/
					SetDlgItemText(hwndDlg, IDC_EDIT_SRAMFILENAME, fname.c_str());
				}
				//if(GetSaveFileName(&ofn))
				//	UpdateRecordDialogPath(hwndDlg,szChoice);

				return true;
			}

			case IDC_EDIT_FILENAME:
				switch(HIWORD(wParam))
				{
					case EN_CHANGE:
					{
						FixRelativeMovieFilename(hwndDlg, IDC_EDIT_FILENAME);

						// disable the OK button if we can't write to the file
						char filename [MAX_PATH];
						GetDlgItemText(hwndDlg,IDC_EDIT_FILENAME,filename,MAX_PATH);
						EnableWindow(GetDlgItem(hwndDlg, IDOK), IsFileWritable(filename));
					}
					break;
				}
				break;
		}
	}

	HWND cur = GetDlgItem(hwndDlg, IDC_EDIT_SRAMFILENAME);
	
	IsDlgButtonChecked(hwndDlg, IDC_START_FROM_SRAM) ? flag=1 : flag=0;
	IsDlgButtonChecked(hwndDlg, IDC_START_FROM_SRAM) ? EnableWindow(cur, TRUE) : EnableWindow(cur, FALSE);

	cur = GetDlgItem(hwndDlg, IDC_BUTTON_BROWSESRAM);
	IsDlgButtonChecked(hwndDlg, IDC_START_FROM_SRAM) ? EnableWindow(cur, TRUE) : EnableWindow(cur, FALSE);

	return false;
}
예제 #16
0
void CXUIDatePicker::getDate( LPSYSTEMTIME pTm )
{
	DateTime_GetSystemtime(m_hWnd, pTm);
}
예제 #17
0
BOOL CALLBACK wlmAdvOptionPageProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) {
	BOOL result = FALSE;

	switch(message) {
		// Message to initialize dialog
		case WM_INITDIALOG:
			TranslateDialogDefault(hdlg);
			result = TRUE;
			break;
		// Message when a button is pressed
		case WM_COMMAND:
			switch(LOWORD(wParam)) {
				case IDC_MSG:
					CheckDlgButton(hdlg, IDC_IN_MSG, !IsDlgButtonChecked(hdlg,IDC_IN_MSG));
					CheckDlgButton(hdlg, IDC_OUT_MSG, !IsDlgButtonChecked(hdlg,IDC_OUT_MSG));
					break;
				case IDC_SINCE:
					EnableWindow(GetDlgItem(hdlg, IDC_DATETIMEPICKER), IsDlgButtonChecked(hdlg, IDC_SINCE));
					break;
				case IDC_BACK:
					PostMessage(GetParent(hdlg), WIZM_GOTOPAGE, IDD_OPTIONS, (LPARAM)wlmOptionsPageProc);
					break;
				case IDOK:
					nImportOptions = 0;
					if(IsDlgButtonChecked(hdlg, IDC_IN_MSG)) {
						nImportOptions = nImportOptions | IOPT_IN_MSG;
					}
					if(IsDlgButtonChecked(hdlg, IDC_OUT_MSG)) {
						nImportOptions = nImportOptions | IOPT_OUT_MSG;
					}
					if(IsDlgButtonChecked(hdlg, IDC_SINCE)) {
						struct _SYSTEMTIME stSelectedDate = {0};

						if(DateTime_GetSystemtime(GetDlgItem(hdlg,IDC_DATETIMEPICKER), &stSelectedDate) == GDT_VALID) {
							struct tm tmSelectedDate = {0};

							tmSelectedDate.tm_mday = stSelectedDate.wDay;
							tmSelectedDate.tm_mon = stSelectedDate.wMonth - 1;
							tmSelectedDate.tm_year = stSelectedDate.wYear - 1900;
							dwSinceDate = mktime(&tmSelectedDate);
						}
						else {
							break;
						}
					}
					else {
						dwSinceDate = NULL;
					}
					if(confirmImport(hdlg)) {
						importFunction = wlmImport;
						PostMessage(GetParent(hdlg), WIZM_GOTOPAGE, IDD_PROGRESS, (LPARAM)progressPageProc);
					}
					break;
				case IDCANCEL:
					PostMessage(GetParent(hdlg), WM_CLOSE, 0, 0);
					break;
			}
			break;
	}
	return result;
}
예제 #18
0
//---------------------------------------------------------------------------
LRESULT CALLBACK DlgProc(HWND hWndDlg, UINT Msg,
	WPARAM wParam, LPARAM lParam)
{
	HDC hdc;

	HWND hWndDateTimePicker, hWndOK;

	LONG ptrStyles = GetWindowLong(hWndDlg, GWL_STYLE);
	// This will represent the dimensions of the whole screen
	RECT rctClient;

	// Create a black brush
	HBRUSH BlackBrush;
	// Select the black brush
	HBRUSH oldBrush =(HBRUSH) GetSysColor(COLOR_BACKGROUND);

	hWndDateTimePicker = GetDlgItem(hWndDlg, IDC_TIMETOWAKEUP);
	hWndOK = GetDlgItem(hWndDlg, IDOK);

	SYSTEMTIME tmeCurrent;


	switch (Msg)
	{
	case WM_INITDIALOG:
		return TRUE;

	case WM_COMMAND:
		switch (wParam)
		{
		case IDCANCEL:
			EndDialog(hWndDlg, 0);
			return TRUE;
		case IDC_SET_BTN:
			// Get the time that the user had set and store it
			// in the tmeSet variable
			DateTime_GetSystemtime(hWndDateTimePicker, &tmeSet);
			
			TCHAR str[20];
			GetTimeFormat(
				MAKELCID(LANG_USER_DEFAULT, SORT_DEFAULT),
				0,
				&tmeSet,
				NULL,
				str,
				20);
			MessageBox(hWndDlg, str, _T("System Time"), MB_OK);

			hdc = GetDC(hWndDlg);
			BlackBrush = CreateSolidBrush(RGB(0, 0, 0));

			SelectObject(hdc, BlackBrush);
			// TODO: Add your control notification handler code here
			// Get the screen dimensions
			DialogWidth = GetSystemMetrics(SM_CXSCREEN);
			DialogHeight = GetSystemMetrics(SM_CYSCREEN);

			// When sets the clock wave sound, remove the title bar and the borders

			ptrStyles &= ~WS_TILEDWINDOW;
			SetWindowLong(hWndDlg, GWL_STYLE, ptrStyles);

			// Occupy the whole screen
			SetWindowPos(hWndDlg, HWND_TOPMOST, 0, 0, DialogWidth, DialogHeight, SWP_SHOWWINDOW);

			// Get the dimension of the current dialog box
			GetWindowRect(hWndDlg, &rctClient);

			// Paint the dialog box in black
			Rectangle(hdc, rctClient.left, rctClient.top, rctClient.right, rctClient.bottom);

			// Restore the original brush
			//SelectObject(hdc, oldBrush);
			// Start the timer control

			SetTimer(hWndDlg, IDC_CHECKTIME, 2000, 0);
			// We don't need to see the cursor
			ShowCursor(FALSE);
			ReleaseDC(hWndDlg, hdc);


			return TRUE;
		}
		break;

	case WM_TIMER:
		// Get the current time on the computer
		GetLocalTime(&tmeCurrent);

		// Compare the current time with the time the user had set
		// If they are the same, then start playing the CD
		if ((tmeCurrent.wYear == tmeSet.wYear) &&
			(tmeCurrent.wMonth == tmeSet.wMonth) &&
			//(tmeCurrent.wDayOfWeek == tmeSet.wDayOfWeek) &&
			(tmeCurrent.wDay == tmeSet.wDay) &&
			(tmeCurrent.wHour == tmeSet.wHour) &&
			(tmeCurrent.wMinute == tmeSet.wMinute) /* &&
												   (tmeCurrent.wSecond == tmeSet.wSecond) &&
												   (tmeCurrent.wMilliseconds == tmeSet.wMilliseconds) */)
		{
			//mciSendString(_T("play waveaudio!Audio/click.wav"), NULL, 0, NULL);
			PlaySound(MAKEINTRESOURCE(IDR_SOUND), hInst, SND_RESOURCE | SND_ASYNC);
		}
		break;

	case WM_CLOSE:
		PostQuitMessage(WM_QUIT);
		break;

	case WM_DESTROY:
		// However the user decides to close the dialog box,
		// stop playing the audio file
		//mciSendString(_T("stop waveaudio"), NULL, 0, NULL);
		PlaySound(NULL, 0, 0);
		KillTimer(hWndDlg, IDC_CHECKTIME);
		break;

	}

	return FALSE;
}