Click here to Skip to main content
15,885,985 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Using a member from the view class of an mfc program in a dialog box Pin
David Crow30-Nov-11 9:35
David Crow30-Nov-11 9:35 
AnswerRe: Using a member from the view class of an mfc program in a dialog box Pin
AndrewG12311-Dec-11 9:25
AndrewG12311-Dec-11 9:25 
GeneralRe: Using a member from the view class of an mfc program in a dialog box Pin
JackDingler5-Dec-11 9:38
JackDingler5-Dec-11 9:38 
QuestionRe: Using a member from the view class of an mfc program in a dialog box Pin
AndrewG12316-Dec-11 11:49
AndrewG12316-Dec-11 11:49 
AnswerRe: Using a member from the view class of an mfc program in a dialog box Pin
JackDingler6-Dec-11 13:16
JackDingler6-Dec-11 13:16 
AnswerRe: Using a member from the view class of an mfc program in a dialog box Pin
JackDingler6-Dec-11 13:41
JackDingler6-Dec-11 13:41 
QuestionHow to use SYSTEM function for specified time Pin
MKC00230-Nov-11 6:37
MKC00230-Nov-11 6:37 
AnswerRe: How to use SYSTEM function for specified time Pin
Software_Developer30-Nov-11 7:20
Software_Developer30-Nov-11 7:20 
The API function [SetTimer ] executes a function every x milliseconds or any given time.

MFC version [here].

Console example:
The following console program works like this: It sets a timer using SetTimer
then loops in a message loop. The message loop receives and processes WM_TIMER messages
and the timer callback also is called for each time interval.
Simply put the stuff you want done in the TimerProc() function.


C#
#define STRICT 1 
#include <windows.h>
#include <iostream.h>
 
VOID CALLBACK TimerProc(HWND hWnd, UINT nMsg, UINT nIDEvent, DWORD dwTime) 
{
   //put the stuff you want done in here

  cout << "Doing stuff Time: " << dwTime << '\n';
  cout << "--------------------------------------------------\n" ;
  cout.flush();
}
 
int main(int argc, char *argv[], char *envp[]) 
{
    int Counter=0;
    int usage_Time_millisec=500;
    MSG Msg;
 
    UINT TimerId = SetTimer(NULL, 0, usage_Time_millisec, &TimerProc); //bind TimerProc() to SetTimer() 
 
    cout << "TimerId: " << TimerId << '\n';

   if (!TimerId) return 16;
    
   while (GetMessage(&Msg, NULL, 0, 0)) 
   {
    	++Counter;
    	if (Msg.message == WM_TIMER)
		cout << "Doing stuff Counter: " << Counter << "; timer message\n";
    	else
		cout << "Doing stuff Counter: " << Counter << "; message: " << Msg.message << '\n';
    	DispatchMessage(&Msg);
   }
    
   KillTimer(NULL, TimerId);

return 0;

}

QuestionRe: How to use SYSTEM function for specified time Pin
Richard MacCutchan30-Nov-11 7:29
mveRichard MacCutchan30-Nov-11 7:29 
AnswerRe: How to use SYSTEM function for specified time Pin
MKC00230-Nov-11 17:28
MKC00230-Nov-11 17:28 
GeneralRe: How to use SYSTEM function for specified time Pin
Richard MacCutchan30-Nov-11 22:06
mveRichard MacCutchan30-Nov-11 22:06 
GeneralRe: How to use SYSTEM function for specified time Pin
MKC0021-Dec-11 18:17
MKC0021-Dec-11 18:17 
GeneralRe: How to use SYSTEM function for specified time Pin
Richard MacCutchan1-Dec-11 22:49
mveRichard MacCutchan1-Dec-11 22:49 
Questiontrying to find the status of contacts from Office Communicator Pin
tasumisra30-Nov-11 4:33
tasumisra30-Nov-11 4:33 
Questiondisabling ctrl+scrolllock in my application Pin
VCProgrammer29-Nov-11 22:39
VCProgrammer29-Nov-11 22:39 
AnswerRe: disabling ctrl+scrolllock in my application Pin
Software_Developer29-Nov-11 23:27
Software_Developer29-Nov-11 23:27 
GeneralRe: disabling ctrl+scrolllock in my application Pin
David Crow30-Nov-11 2:50
David Crow30-Nov-11 2:50 
AnswerRe: disabling ctrl+scrolllock in my application Pin
VCProgrammer30-Nov-11 21:18
VCProgrammer30-Nov-11 21:18 
GeneralRe: disabling ctrl+scrolllock in my application Pin
David Crow1-Dec-11 4:06
David Crow1-Dec-11 4:06 
QuestionResize Split Window Pin
Manula Thantriwatte29-Nov-11 18:29
Manula Thantriwatte29-Nov-11 18:29 
QuestionRe: Resize Split Window Pin
Richard MacCutchan29-Nov-11 21:30
mveRichard MacCutchan29-Nov-11 21:30 
AnswerRe: Resize Split Window Pin
Software_Developer30-Nov-11 3:47
Software_Developer30-Nov-11 3:47 
QuestionI c++ win32 version of vb string.contain Pin
jkirkerx28-Nov-11 6:54
professionaljkirkerx28-Nov-11 6:54 
AnswerRe: c++ win32 version of vb string.contain Pin
Chris Losinger28-Nov-11 7:14
professionalChris Losinger28-Nov-11 7:14 
GeneralRe: c++ win32 version of vb string.contain Pin
jkirkerx28-Nov-11 7:28
professionaljkirkerx28-Nov-11 7:28 

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.