Click here to Skip to main content
15,912,021 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: MFC - SetDlgItemText() Pin
Carlos Antollini14-Dec-01 11:32
Carlos Antollini14-Dec-01 11:32 
GeneralRe: MFC - SetDlgItemText() Pin
Michael Dunn14-Dec-01 13:30
sitebuilderMichael Dunn14-Dec-01 13:30 
QuestionHow to get a pointer to an instance of a class... Pin
Sprudling14-Dec-01 11:15
Sprudling14-Dec-01 11:15 
AnswerRe: How to get a pointer to an instance of a class... Pin
Prem Kumar14-Dec-01 13:41
Prem Kumar14-Dec-01 13:41 
AnswerRe: How to get a pointer to an instance of a class... Pin
Erik Funkenbusch15-Dec-01 5:00
Erik Funkenbusch15-Dec-01 5:00 
GeneralTimer stuff Pin
Rickard Andersson2014-Dec-01 9:46
Rickard Andersson2014-Dec-01 9:46 
GeneralRe: Timer stuff Pin
Christian Graus14-Dec-01 10:26
protectorChristian Graus14-Dec-01 10:26 
GeneralRe: Timer stuff Pin
Rickard Andersson2014-Dec-01 10:59
Rickard Andersson2014-Dec-01 10:59 
Ok, here is the OnTimer function:
All comments are writen in SWEDISH...
The problem was that when I try to launch open the dialog in timer 1 the KillTimer func doesn't seems to be called or something? The dialog boxs appears, and appears, and appears.... but when next minut comes then it can be called and timer 1 is killed... Hope I could explain it! And this happens when I have to timers in use at the same time

the reg vaiables are CHKLM objects, the registry class here from code project... is there anything else you want? PLEASE TELL ME!! IF YOU CAN TELL ME HOW TO AVOID THIS YOU'RE BEST!

void CReminderSEDlg::OnTimer(UINT nIDEvent)
{
reg.SetRegistryKey(_T("CodeCracker"));



switch(nIDEvent)
{
case 2:
{
// Hämta aktuell tid
CTime CurTime;
CurTime = CTime::GetCurrentTime();

// Spara den aktuella tiden i ett CString objekt
CString szCurTime;
szCurTime.Format("%d:%d", CurTime.GetHour(), CurTime.GetMinute());

//AfxMessageBox(szCurTime);
if( m_szKomIhagTid == szCurTime )
{
int ret = KillTimer(2);
CString str;
str.Format("%d",ret);
AfxMessageBox(str);

sndPlaySound("STANDARD2.WAV", SND_ASYNC);

CAlertDlg dlg;
dlg.DoModal();

reg.WriteProfileInt(_T("CMeddelandeDlg"), _T("Aktivate"), 0);

m_sPamin.SetBitmap(::LoadBitmap(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDB_BITMAP1)));
m_KiTid = "";

Invalidate();
UpdateData(FALSE);
}
}
case 1:
{
// Hämta aktuell tid
CTime CurTime;
CurTime = CTime::GetCurrentTime();

// Spara den aktuella tiden i ett CString objekt
CString szCurTime;
szCurTime.Format("%d:%d", CurTime.GetHour(), CurTime.GetMinute());

// Hämta alarm tiden från registret
int nHour = reg.GetProfileInt(_T("CConfigDlg"), _T("Hours"), NULL);
int nMinute = reg.GetProfileInt(_T("CConfigDlg"), _T("Minutes"), NULL);

// Spara alarm tiden i ett CString objekt
CString szAlarmTime;
szAlarmTime.Format("%s:%s", Minutes(nHour), Minutes(nMinute));


if( szAlarmTime == szCurTime )
{
// Döda timer nu så vi inte får problem
KillTimer(1);

reg.WriteProfileInt(_T("CConfigDlg"), _T("Aktivate"), 0);
m_MorgonAlarm.SetBitmap(::LoadBitmap(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDB_BITMAP1)));
GetDlgItem(IDC_BUTTON3)->EnableWindow(TRUE);
m_VackTid = "";

Invalidate();
UpdateData(FALSE);

// Kolla om användaren harvalt en MP3 eller en WAV som alarm ljud
int Mp3OrWav = reg.GetProfileInt(_T("CLjudDlg"), _T("Mp3OrWav"), NULL);
if( Mp3OrWav == 1 ) // Det är en mp3
{
// Spela ljudet
PlayMp3(FALSE);

//AfxMessageBox("Mp3");

// Skapa fönstret som välkomnar di på morgonen
CWakeUpDlg dlg;

int i = dlg.DoModal(); // Visa det
if( i == IDOK ) // Fånga upp vad användaren tryckte på
{
//MCIWndStop(m_WndPlay);
PlayMp3(TRUE);
}
else if( i == IDCANCEL )
{
reg.SetRegistryKey(_T("CodeCracker"));

CString str;
str = reg.GetProfileString(_T("Main"), _T("MailPath"), NULL);

if( str.IsEmpty() == TRUE )
{
PlayMp3(TRUE);
CSystemTray::MaximiseFromTray(this);
}
else
{
PlayMp3(TRUE);
WinExec(str,SW_SHOW);
}
}
}
else
{
// Skapa fönstret som välkomnar dig på morgonen
CWakeUpDlg dlg;

// Spela ljudet
PlayWav(FALSE);

int i = dlg.DoModal();
if( i == IDOK )
{
PlayWav(TRUE);
CSystemTray::MaximiseFromTray(this);
}
else if( i == IDCANCEL )
{
reg.SetRegistryKey(_T("CodeCracker"));

CString str;
str = reg.GetProfileString(_T("Main"), _T("MailPath"), NULL);

if( str.IsEmpty() == TRUE )
{
PlayWav(TRUE);
CSystemTray::MaximiseFromTray(this);
}
else
{
PlayWav(TRUE);
WinExec(str, SW_SHOW);
}
}
}

}
}break;

default:
break;
}

CBitmapDialog::OnTimer(nIDEvent);
}

------------------------------
©0d3 ©®4©k3® - That's me! Smile | :)
------------------------------
GeneralRe: Timer stuff Pin
Christian Graus14-Dec-01 11:28
protectorChristian Graus14-Dec-01 11:28 
GeneralRe: Timer stuff Pin
Rickard Andersson2015-Dec-01 1:10
Rickard Andersson2015-Dec-01 1:10 
GeneralPotentially silly question about CWinThread Pin
nay14-Dec-01 8:45
nay14-Dec-01 8:45 
GeneralRe: Potentially silly question about CWinThread Pin
Alvaro Mendez14-Dec-01 10:52
Alvaro Mendez14-Dec-01 10:52 
GeneralRe: Potentially silly question about CWinThread Pin
nay14-Dec-01 12:09
nay14-Dec-01 12:09 
QuestionWhat am I missing here? Pin
clintsinger14-Dec-01 7:25
clintsinger14-Dec-01 7:25 
AnswerRe: What am I missing here? Pin
Joaquín M López Muñoz14-Dec-01 10:33
Joaquín M López Muñoz14-Dec-01 10:33 
Generalaccessing an ADO recordset pointer from another window Pin
14-Dec-01 7:13
suss14-Dec-01 7:13 
GeneralRe: accessing an ADO recordset pointer from another window Pin
Carlos Antollini14-Dec-01 7:28
Carlos Antollini14-Dec-01 7:28 
QuestionHow to find out unwanted DLL in a System? Pin
14-Dec-01 6:38
suss14-Dec-01 6:38 
AnswerRe: How to find out unwanted DLL in a System? Pin
Alvaro Mendez14-Dec-01 7:16
Alvaro Mendez14-Dec-01 7:16 
GeneralTrying to manipulate CStdioFile Pin
Stevieslu14-Dec-01 6:37
Stevieslu14-Dec-01 6:37 
GeneralRe: Trying to manipulate CStdioFile Pin
Alvaro Mendez14-Dec-01 7:19
Alvaro Mendez14-Dec-01 7:19 
Generalimplementing powerpoint presentation slide show Pin
Kuniva14-Dec-01 5:37
Kuniva14-Dec-01 5:37 
GeneralEmail Pin
SuperGeek14-Dec-01 5:31
SuperGeek14-Dec-01 5:31 
GeneralRe: Email Pin
Andrew Peace15-Dec-01 4:14
Andrew Peace15-Dec-01 4:14 
Generalswitching Media player active-x control to full screen Pin
Kuniva14-Dec-01 5:13
Kuniva14-Dec-01 5:13 

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.