Click here to Skip to main content
16,005,316 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: cFormView controls - font, size, etc. Pin
Michael P Butler3-Apr-04 8:11
Michael P Butler3-Apr-04 8:11 
GeneralRe: cFormView controls - font, size, etc. Pin
gUrM33T3-Apr-04 15:15
gUrM33T3-Apr-04 15:15 
GeneralDetermint String Language Pin
Anonymous3-Apr-04 3:48
Anonymous3-Apr-04 3:48 
GeneralRe: Determint String Language Pin
Alexander M.,4-Apr-04 1:06
Alexander M.,4-Apr-04 1:06 
GeneralHIDE FIRST DIALOG Pin
andresfecas3-Apr-04 3:34
andresfecas3-Apr-04 3:34 
GeneralRe: HIDE FIRST DIALOG Pin
Prakash Nadar3-Apr-04 3:51
Prakash Nadar3-Apr-04 3:51 
GeneralUrgent: Having problem with while loop Pin
dreamerzz3-Apr-04 2:16
dreamerzz3-Apr-04 2:16 
GeneralRe: Urgent: Having problem with while loop Pin
avenger_sb255-Apr-04 7:46
avenger_sb255-Apr-04 7:46 
The solution is very simple: THREADS (it's easy too Wink | ;) )

I give the sample code in Windows API. I m sure u can port it to MFC. I have given MFC portions that i can predict(lol, i dont know much MFC).
//First of all this is the thread which will continiously update ur value when update button is clicked.
<small>//------global data------</small><br />
HANDLE hthread; <small>// this is thread handle</small><br />
int idThread;   <small>// this is threaed id</small><br />
//---The thread function------------------------<br />
DWORD WINAPI UpdateThread(LPVOID lpParameter)<br />
{<br />
while(1) <small>//keep looping</small><br />
{<br />
<small>//WRITE YOUR UPDATING CODE HERE THAT WILL CONTINIOUSLY UPDATE THE VALUES<br />
//Make the values to be updated GLOBAL as there is no way to return values from a thread.</small><br />
}<br />
}
//
This function is called when Update Button is clicked(name it according to ur program)
OnUpdateButtonClick()<br />
{<br />
<small>//when update button is clicked, start the update thread should be started</small><br />
hThread=CreateThread(NULL,0,UpdateThread,0,0,&idThread);<br />
<small>//dont bother about the parameters that are NULL or 0, u ll never need them</small><br />
}
Now thread executes repeatedly irrespective of ur main program code.

We want to stop the thread when STOP button is clicked. So we write the following code:
OnStopButtonClick()<br />
{<br />
 <small>//We sud stop the thread now (i.e. stop the updating loop inside the thread)</small><br />
 TerminateThread(hThread,0)<br />
 <small>//WRITE HERE "UR CODE TO WRITE UPDATED VALUES INTO THE DATABASE"</small>}<br />
}

I think, this will solve ur problem, ask if u have any doubts.


Remember... testing & debugging are always part of programming ...so exterminate those stinking bugs
GeneralRe: Urgent: Having problem with while loop Pin
dreamerzz5-Apr-04 21:56
dreamerzz5-Apr-04 21:56 
GeneralRe: Urgent: Having problem with while loop Pin
avenger_sb256-Apr-04 5:30
avenger_sb256-Apr-04 5:30 
GeneralRe: Urgent: Having problem with while loop Pin
dreamerzz9-Apr-04 6:04
dreamerzz9-Apr-04 6:04 
GeneralRe: Urgent: Having problem with while loop Pin
avenger_sb259-Apr-04 7:57
avenger_sb259-Apr-04 7:57 
GeneralRe: Urgent: Having problem with while loop Pin
dreamerzz20-Apr-04 2:20
dreamerzz20-Apr-04 2:20 
Questionplease help me have a look at below &quot;onInitDialog()&quot;,why return true at the end? Pin
vividtang3-Apr-04 2:16
vividtang3-Apr-04 2:16 
AnswerRe: please help me have a look at below &quot;onInitDialog()&quot;,why return true at the end? Pin
Gary R. Wheeler3-Apr-04 2:49
Gary R. Wheeler3-Apr-04 2:49 
GeneralGetNetworkParams &amp; GetAdaptersInfo Pin
Anonymous3-Apr-04 2:06
Anonymous3-Apr-04 2:06 
GeneralScolling of BIG document Pin
Still learning how to code3-Apr-04 1:08
Still learning how to code3-Apr-04 1:08 
GeneralRe: Scolling of BIG document Pin
Gary R. Wheeler3-Apr-04 2:12
Gary R. Wheeler3-Apr-04 2:12 
GeneralRe: Scolling of BIG document Pin
Still learning how to code3-Apr-04 7:47
Still learning how to code3-Apr-04 7:47 
Generalmap container Pin
MatthewP3-Apr-04 0:57
MatthewP3-Apr-04 0:57 
GeneralRe: map container Pin
MatthewP3-Apr-04 4:06
MatthewP3-Apr-04 4:06 
Questionhow to make button control colorful . Pin
vividtang2-Apr-04 23:08
vividtang2-Apr-04 23:08 
AnswerRe: how to make button control colorful . Pin
gUrM33T3-Apr-04 0:31
gUrM33T3-Apr-04 0:31 
AnswerRe: how to make button control colorful . Pin
Monty23-Apr-04 0:38
Monty23-Apr-04 0:38 
GeneralHWND TO string and string to HWND conversion Pin
Atif Mushtaq2-Apr-04 21:46
Atif Mushtaq2-Apr-04 21:46 

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.