tags:

views:

1146

answers:

2

i am getting confuse in SetTimer() Function.
SetTimer() Function takes three parameters

eg; 1) SetTimer(1,2000,Timerflow);

SetTimer() Function takes four parameters

eg; 2) SetTimer(NULL,1,2000,Timerflow);

What is the difference between these two functions.

i know SetTimer() Three parameters.but when i try the four parameter SetTimer() function. and i will get the error

error C2660: 'SetTimer' : function does not take 4 parameters
So what is the Main difference and why this error came.please any body give the solution.

+2  A: 

The only Windows API called SetTimer takes four parameters. Presumably the other one is part of MFC or some other framework, and the first parameter is implied by the object you call it on. For example:

CWnd * w = .... // get window somehow
w->SetTimer(1,2000,Timerflow);
anon
+3  A: 

The 4-arg version is the plain Win32 API version, and the first parameter is a window handle.

The 3-arg version is a member of MFC's CWnd class, and works with the window handle of the CWnd instance for which you call it.

If you need to call the 4-arg Win32 API from within a method of a CWnd-derived object, do this:

::SetTimer(NULL, 1, 2000, Timerflow);
RichieHindle