Click here to Skip to main content
15,895,462 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionCOleDateTime Nonsense... more bizarre than I've seen before anyway... Pin
jsightler6-May-08 6:19
jsightler6-May-08 6:19 
AnswerRe: COleDateTime Nonsense... more bizarre than I've seen before anyway... Pin
jsightler6-May-08 6:25
jsightler6-May-08 6:25 
GeneralRe: COleDateTime Nonsense... more bizarre than I've seen before anyway... Pin
led mike6-May-08 6:33
led mike6-May-08 6:33 
AnswerRe: COleDateTime Nonsense... more bizarre than I've seen before anyway... Pin
Chris Meech6-May-08 7:14
Chris Meech6-May-08 7:14 
GeneralRe: COleDateTime Nonsense... more bizarre than I've seen before anyway... Pin
jsightler8-May-08 4:42
jsightler8-May-08 4:42 
QuestionAlternative for TIMERs in MFC?? Pin
Kiran Satish6-May-08 6:05
Kiran Satish6-May-08 6:05 
QuestionRe: Alternative for TIMERs in MFC?? Pin
CPallini6-May-08 6:18
mveCPallini6-May-08 6:18 
AnswerRe: Alternative for TIMERs in MFC?? Pin
Kiran Satish6-May-08 6:49
Kiran Satish6-May-08 6:49 
Yes... I know I haven't used threads in proper way in this particular application Poke tongue | ;-P .
Well I used them in more sumple way, once the user clicks on 'Close Loop' button on one of the dialog boxes, I start a thread that does all the necessary work, but I remember it giving errors when I send/post messages to dialog boxes (but I am not sure) and the interface doesnt respnd anymore to user inputs.
Coming to TIMERs, here is how we are using currently-
<br />
//This is the code for the close loop user interface button<br />
void CAnalysisDlg::OnCloseloop() <br />
{<br />
 CButton *ClButton;<br />
 HICON icn;<br />
 ClButton = (CButton *)GetDlgItem(IDB_CLOSELOOP);<br />
 icn = ClButton->GetIcon();<br />
 if(icn == AfxGetApp()->LoadIcon(IDI_CLOSELOOP))<br />
 {<br />
  ClButton->SendMessage(BM_SETIMAGE,IMAGE_ICON,(LPARAM)AfxGetApp()->LoadIcon(IDI_LOOPCLOSED));<br />
  if(parent->closeLoop() == FALSE)<br />
  {<br />
   ClButton->SendMessage(BM_SETIMAGE,IMAGE_ICON,(LPARAM)AfxGetApp()->LoadIcon(IDI_CLOSELOOP));<br />
  }<br />
 }<br />
 else<br />
 {<br />
  KillTimer(1);<br />
  parent->Uncheck_Closeloop();<br />
 }<br />
}<br />
//This code goes into parent(main) dialog box<br />
BOOL CMainDlg::closeLoop()<br />
{<br />
//do some intializations and calculations here<br />
 if(OnAutoMeasure()==FALSE)<br />
  return FALSE;<br />
}<br />
<br />
BOOL CMainDlg::OnAutoMeasure()<br />
{<br />
//calculate the frequency of closed loop<br />
//do closed loop functions and update other dialog boxes as necessary<br />
//if there is nay error it returns false<br />
 SetTimer(1,1,NULL);<br />
 return TRUE;<br />
}<br />
<br />
void CMainDlg::OnTimer(UINT nIDEvent) <br />
{<br />
 CButton *ClButton;<br />
 HICON icn;<br />
 KillTimer(1);<br />
 ClButton = (CButton *)tbdisp->GetDlgItem(IDB_CLOSELOOP);<br />
 icn = ClButton->GetIcon();<br />
 if(icn == AfxGetApp()->LoadIcon(IDI_LOOPCLOSED))<br />
 {<br />
  if(closeloopsafety <= NUM_FALSE_RETURN_AUTOMEASURE)<br />
  {<br />
   if(OnAutoMeasure()==FALSE)<br />
    Uncheck_Closeloop();<br />
  }<br />
  else<br />
   Uncheck_Closeloop();<br />
 }<br />
 CDialog::OnTimer(nIDEvent);<br />
}<br />


I hope the code wont be too much of confusion Smile | :) . But that how its basically works now.

PKNT

AnswerRe: Alternative for TIMERs in MFC?? Pin
toxcct6-May-08 6:25
toxcct6-May-08 6:25 
GeneralRe: Alternative for TIMERs in MFC?? Pin
Kiran Satish6-May-08 6:52
Kiran Satish6-May-08 6:52 
GeneralRe: Alternative for TIMERs in MFC?? Pin
toxcct6-May-08 6:54
toxcct6-May-08 6:54 
GeneralRe: Alternative for TIMERs in MFC?? Pin
Kiran Satish6-May-08 6:59
Kiran Satish6-May-08 6:59 
GeneralRe: Alternative for TIMERs in MFC?? Pin
JudyL_MD7-May-08 3:07
JudyL_MD7-May-08 3:07 
GeneralRe: Alternative for TIMERs in MFC?? Pin
Kiran Satish7-May-08 4:59
Kiran Satish7-May-08 4:59 
AnswerRe: Alternative for TIMERs in MFC?? Pin
Jeremy Thornton6-May-08 15:15
Jeremy Thornton6-May-08 15:15 
QuestionDetermining if an drang'n'drop event is active Pin
tibiz6-May-08 5:20
tibiz6-May-08 5:20 
QuestionCopy files with out using SHFileOperation Pin
itsh116-May-08 5:11
itsh116-May-08 5:11 
AnswerRe: Copy files with out using SHFileOperation Pin
Rajkumar R6-May-08 5:29
Rajkumar R6-May-08 5:29 
GeneralRe: Copy files with out using SHFileOperation Pin
itsh116-May-08 5:47
itsh116-May-08 5:47 
GeneralRe: Copy files with out using SHFileOperation Pin
David Crow6-May-08 6:01
David Crow6-May-08 6:01 
QuestionRe: Copy files with out using SHFileOperation Pin
David Crow6-May-08 6:00
David Crow6-May-08 6:00 
QuestionSetFilePointer Pin
john56326-May-08 3:16
john56326-May-08 3:16 
AnswerRe: SetFilePointer Pin
CPallini6-May-08 3:23
mveCPallini6-May-08 3:23 
QuestionCList::RemoveAt Pin
piul6-May-08 2:09
piul6-May-08 2:09 
AnswerRe: CList::RemoveAt Pin
Nelek6-May-08 2:17
protectorNelek6-May-08 2:17 

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.