Click here to Skip to main content
15,908,013 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: c++ SQL Server Rowset Column Buffer Pin
jkirkerx9-Dec-11 15:02
professionaljkirkerx9-Dec-11 15:02 
GeneralRe: c++ SQL Server Rowset Column Buffer Pin
jkirkerx9-Dec-11 16:48
professionaljkirkerx9-Dec-11 16:48 
QuestionUsing a member from the view class of an mfc program in a dialog box Pin
AndrewG123130-Nov-11 6:54
AndrewG123130-Nov-11 6:54 
AnswerRe: Using a member from the view class of an mfc program in a dialog box Pin
Jonathan Davies30-Nov-11 7:06
Jonathan Davies30-Nov-11 7:06 
GeneralRe: Using a member from the view class of an mfc program in a dialog box Pin
Albert Holguin30-Nov-11 7:30
professionalAlbert Holguin30-Nov-11 7:30 
GeneralRe: Using a member from the view class of an mfc program in a dialog box Pin
AndrewG123130-Nov-11 7:58
AndrewG123130-Nov-11 7:58 
GeneralRe: Using a member from the view class of an mfc program in a dialog box Pin
Albert Holguin30-Nov-11 8:24
professionalAlbert Holguin30-Nov-11 8:24 
GeneralRe: Using a member from the view class of an mfc program in a dialog box Pin
AndrewG123130-Nov-11 8:27
AndrewG123130-Nov-11 8:27 
GeneralRe: Using a member from the view class of an mfc program in a dialog box Pin
Albert Holguin30-Nov-11 8:28
professionalAlbert Holguin30-Nov-11 8:28 
AnswerRe: Using a member from the view class of an mfc program in a dialog box Pin
Albert Holguin30-Nov-11 8:27
professionalAlbert Holguin30-Nov-11 8:27 
AnswerRe: Using a member from the view class of an mfc program in a dialog box Pin
Richard MacCutchan30-Nov-11 7:24
mveRichard MacCutchan30-Nov-11 7:24 
GeneralRe: Using a member from the view class of an mfc program in a dialog box Pin
AndrewG123130-Nov-11 7:54
AndrewG123130-Nov-11 7:54 
GeneralRe: Using a member from the view class of an mfc program in a dialog box Pin
Richard MacCutchan30-Nov-11 8:40
mveRichard MacCutchan30-Nov-11 8:40 
AnswerRe: Using a member from the view class of an mfc program in a dialog box Pin
Chuck O'Toole30-Nov-11 8:27
Chuck O'Toole30-Nov-11 8:27 
GeneralRe: Using a member from the view class of an mfc program in a dialog box Pin
AndrewG123130-Nov-11 8:53
AndrewG123130-Nov-11 8:53 
QuestionRe: Using a member from the view class of an mfc program in a dialog box Pin
David Crow30-Nov-11 8:47
David Crow30-Nov-11 8:47 
AnswerRe: Using a member from the view class of an mfc program in a dialog box Pin
AndrewG123130-Nov-11 9:00
AndrewG123130-Nov-11 9:00 
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;

}

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.