Waitable Timer Question Please help!

I am trying to use the waitable timer in a MFC project and using MsgWaitForMultipleObjectsEx() to wai
on the timer handle. But my timer callback doesnot get executed. Below is the source code with al
the error checking removed. Please help me to fix this problem

int wLoopCount= 0

void CTimerTestDlg::OnStartTimer()

  HANDLE hTimer[1]
  int breakLoop = 0
  int retVal = 0

  // Create waitable time
  hTimer[0] = CreateWaitableTimer(NULL, TRUE, "WaitableTimer")
  // start the timer 5 sec from now and tick every 2 se
  liDueTime.QuadPart = -50000000
  SetWaitableTimer(hTimer[0], &liDueTime, 2000, TimerProc, NULL, 0)
  wLoopCount = 0
  while (breakLoop == 0) 
   retVal = MsgWaitForMultipleObjectsEx(1, hTimer, INFINITE, QS_ALLEVENTS, MWMO_ALERTABLE )
   switch (retVal) 
    case WAIT_OBJECT_0
      if (wLoopCount == 100) 
        breakLoop = 1
  CloseHandle (hTimer[0])

VOID CALLBACK TimerProc(LPVOID lpArg, DWORD dwTimerLowValue, DWORD dwTimerHighValue


anonymous (74722)
2/12/2004 9:01:12 PM
vc.mfc 33608 articles. 0 followers. Follow

1 Replies

Similar Articles

[PageSpeed] 34

Here you are creating a manual-reset timer, istead of Auto reset.So use
hTimer[0] = CreateWaitableTimer(NULL, FALSE /*instead of TRUE*/,

This shud solve the problem.


"msrajan" <anonymous@discussions.microsoft.com> wrote in message
> Hello,
> I am trying to use the waitable timer in a MFC project and using
MsgWaitForMultipleObjectsEx() to wait
> on the timer handle. But my timer callback doesnot get executed. Below is
the source code with all
> the error checking removed. Please help me to fix this problem.
> //Globals
> int wLoopCount= 0;
> void CTimerTestDlg::OnStartTimer()
> {
>   HANDLE hTimer[1];
>   LARGE_INTEGER liDueTime;
>   int breakLoop = 0;
>   int retVal = 0;
>   // Create waitable timer
>   hTimer[0] = CreateWaitableTimer(NULL, TRUE, "WaitableTimer");
>   // start the timer 5 sec from now and tick every 2 sec
>   liDueTime.QuadPart = -50000000;
>   SetWaitableTimer(hTimer[0], &liDueTime, 2000, TimerProc, NULL, 0);
>   wLoopCount = 0;
>   while (breakLoop == 0) {
>    retVal = MsgWaitForMultipleObjectsEx(1, hTimer, INFINITE, QS_ALLEVENTS,
>    switch (retVal) {
>     case WAIT_OBJECT_0:
>       if (wLoopCount == 100) {
>         CancelWaitableTimer(hTimer[0]);
>         breakLoop = 1;
>       }
>       break;
>     }
>   }
>   CloseHandle (hTimer[0]);
>   return;
> }
> VOID CALLBACK TimerProc(LPVOID lpArg, DWORD dwTimerLowValue, DWORD
> {
>   wLoopCount++;
> }

jagadeeshvn (256)
2/13/2004 11:06:41 AM

Similar Artilces:

Creating a group of cells. Need Help Please.
Havn't used excel in a while and I need to create a group of cell corresponding to an input of a min and a max. Here are the details. On one sheet I have a box where you enter th min and a box where you enter the max. In another sheet I want column starting at A2 to output (MIN,A2+1000,A3+1000,....MAX) ho would I do this -- Thundersix ----------------------------------------------------------------------- Thundersixx's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=3055 View this thread: http://www.excelforum.com/showthread.php?threadid=50207 Name the...

Baseball Stats question: How can I get the RBI's?
I have a data table that looks like this: Code ------------------- STR-S SNK-S STR-K STR-F SNK-S STR-3 STR-2 STR-F SNK-S SNK-4 SNK-S STR-3 SNK-F STR-4 STR-O ------------------- "STR", etc at the beginning are pitch types, SNK is Sinker for example The end character is the result of the pitch, a 4 would be a home run, 3 a triple, and so forth. O is out, F is foul, S is strike --- you ge it. How can I figure the amount of RBI's? I know that it's 5, but I can' think of any automated way to calculate this, anyone got any ideas? THANK YOU!! :confused -- AVER...

Please help..with a formula. I don't know code.
I have a long list of numbers - values in a file X, and I want to fin and replace those values in a even larger list in a file Z an highlight those values in Z -- Message posted from http://www.ExcelForum.com Hi not really sure what you're trying to achieve. What do you want to replace, etc. You may give an example (plain text - no attachment please) >-----Original Message----- >I have a long list of numbers - values in a file X, and I want to find >and replace those values in a even larger list in a file Z and >highlight those values in Z. > > >--- >Message...

When launching Outlook I recieve the following error... please he
When launching Outlook 2003 I recieve the following error: The add-in "C:\PROGRAM~1\SPAMBL~1\Bin\461~1.0\SBOLExt.dll" could not be installed or loaded. This problem may be resolved by using Detect and Repair on the Help menu. I ran the Detect and Repair and that didn't work. I ran the repair option from Add and Remove Program in Control Panel and that didn't work. I also un-installed and then re-installed Outlook 2003 and that didn't work. I'm running Windows 2000. Any ideals...? Did you have something possibly called SpamBlocker installed at some point?...

Need a default email account for all users, need help.
I have a tablet PC running WinXP Tablet with Outlook 2003. This tablet will connect to our exchange server via VPN. How can I set it up so that everyone that logs onto their account can access one (the same) email account. The problem is that I dont know at this point all of the users however anyone using the tablet will use one generic email account. So how can I set Outlook to default to this account so that no matter who logs on they will use this account? Thanks! Shane ...

Need help with formula 01-13-10
I am trying to adapt a formula in I2 from another spreadsheet that works well, but won't in mine. I've traced the error, but I would need help to understand the help it gives! My formula is this: =IF(J2="0-Jan-00","To be advised",WORKDAY(J2,1,NWD)). I have a worksheet in the same workbook with a list of non-workdays, and defined the column of dates with the name "NWD". What I expect the formula to do is this: If J2 is Feb. 4, it would give Feb. 5 in cell I2 because Feb. 5 is NOT a non-workday in NWD. But if J2 is Feb. 5, and Feb. 6 and...

AD/Network design question
Hello all I have a 2 sites which users come and go from. These sites have 2 different network ip domains (192.168.1.x and 192.168.2.x). Users need to be authenticated using the same user id and password at both sites. DC/GC is at 192.168.1.x and is a SBS 2003. Server at 192.168.2.x is Server 2003. When the server at 192.168.2.x is connected via vpn to 192.168.1.x all is well. How do I get the server at 192.168.2.x to act as a AD/DC when it’s not connected to 192.168.1.x ? Thank you Hal I think you will run here into the limitations of SBS :-( @ SBS experts : ...

DEADLINE... PLEASE HELP! Stacked Bar chart?
I'm not even sure how to ask the question so here's what I have... 2003 2004 2005 Actual/Goal Actual/Goal Actual/Goal Me 1009/1061 591/866 658/897 Comp. A 966/1012 633/811 624/808 Comp. B 699/744 450/593 480/607 Comp. C 957/1005 642/821 665/838 I wanto to show a bar for each competitor, for each year, so there will be 4 bars for each year. Each bar showing Actual performance & Performance Goal...

please help with this query
Ost Ocity Dstate Dcity Carrier Price Rank Diff A B C D X 1200 1 100 A B C D Y 1300 2 100 A B C D Z 1350 3 100 A B C D W 1789 4 100 A1 B1 C1 D1 X1 785 1 A1 B1 C1 D1 Y1 789 2 The rank for every carrier is based on the price . If rank1 carrier is not a pariticular carrier(say if it is not X1 or Y1 or Z1), then i want to calculate the difference be...

Office 2010 Buying Question Assistance Needed
I've been looking through the MS Office 2010 web site to try to determine what my new small company would require, but I can't find the information I need. We for sure would need Office Pro Plus, but other than that I'm not sure. We want to run it on our own server. We will initially have 3-5 people using it and perhaps more later on. Would we need to purchase site licensing? Unfortunately, our programmers are MS haters (I'm not) and I can't get any assistance from them on this, but I have power of the pen. I would appreciate any assistance I can get. Th...

Question About Missing Data
So, this is probably really easy, but I just want to ask and see if I may be missing something here. Some data on vendor numbers changed. Let’s say IBM used to have a vendor number 12345 and now it’s vendor number is 56789. I can identify IBM as IBM, but I really want to use the number, not the name. Should I set up a table that ties the numbers together, so that Access knows 12345 = 56789? Or, should I do some kind of Update Query and change all incidences of 12345 to be 56789? Or, is there some other, method, like a ‘best practices for missing data’? Thanks! Ryan--- ...

Custom CRect Question
I have a custom rectangle class that inherits from CRect: class CCustomRect : public CRect { private: CPoint m_maxPt; COLORREF m_color; TCHAR text[50]; public: CCustomRect(RECT* source, CPoint pt, COLORREF rgb); RECT* RectBase(); void Update(RECT* r); } Inheritance has worked well until I found myself needing to create the RectBase function (above) to return the rectangle dimensions. CRect does not seem to have any methods that can be called to return the base class's RECT value. I could take CRect::Size and construct a rectangle to return, but this seems a bit much. My...

VS 2005 beta question
All, I need to complie some code. I am going from 16bit to 64 bit. The job do not want to spend the money on VS 2005.net. If I compile the code with the beta version or trial version of VS 2005.NET will it time bomb on me? Thanks in advance The code won't, but eventually the compiler will stop working. Don't know if the trial will support 64 bit though. I guess you get what you pay for. Tom "karibbean" <sharp_mind@REMOVE.this.email.msn.dotcom> wrote in message news:%23OyZFNUFGHA.1124@TK2MSFTNGP10.phx.gbl... > All, > > I need to complie some cod...

Hyperlink File Help
I am needing some major help. I have a file with hyperlinks in column F that link to a file on our server. I am needing to test to see if the file exists and if it does, copy the file to a folder in my documents called (CapturedFiles) and if it doesn't format the cell color to red. Can VBA do this and if so how? Any help would be greatly appreciated. Thanks in advance. Fileserver or webserver ? Tim On Nov 23, 7:20=A0am, Aaron <Aa...@discussions.microsoft.com> wrote: > I am needing some major help. =A0I have a file with hyperlinks in column = F that > l...

Help please user not showing in 5.5 GAL but is in exchange 2003 GA
Up until today I have been bable to add users fine and their address would appear in both the 5.5 GAL and the exchange 2003 GAL. Is a single site with 2 5.5 servers and 1 exchange 2003 server. When I add a new user now through users and computers and put the mailbox on the new exchange 2003 server the user gets his email addresses and appears in the GAL on the 2003 server but people connected the the old 5.5 servers cannot see it. When I open the 5.5 exchange admin tool again if connected to one of the old 5.5 server I cannot see the person I just created but when connected the the 20...

Why do my questions get deleted sometimes?
Apologies, I have posted this on the worksheet functions group too... I love the feedback I get from these groups, but every now and then, my messages get deleted. I'd like to know what I'm doing wrong. Many of my messages ARE posted and answered, and I'm grateful for that, but one or two get removed - regardless of how often I post them. I don't swear or say anything bad about Excel - I love it. So why don't they get posted are there some words or subjects that I should avoid? Will this one get deleted - it's a bit off subject? But I'd love to have an ans...

Named ranges
Excel 2003 I have a total sheet that gets data from three different shift sheets (all in the same workbook) for a monthly report. I have named ranges on each shift sheet for each month's production data (S1M1, S1M2, S1M3, S2M1...) where S1M1 =A2:AC147, S1M2 = A148:AC329, etc. The old formula was:=SUMIF('SHIFT 1'!$L$1:$L$147,"BB",'SHIFT 1'!$T$1:$T$147). I'm stumped as to what the new formula would be - how would I direct Excel to column L of S1M1 to search for "BB", then add the contents of column T? The range changes each month, and I tho...

help with a sub
Hi, can anybody tell me why the following code fails at FormatConditions.Add Private Sub CommandButton1_Click() Dim Sh As Worksheet Dim lngLastRow As Long Set Sh = ActiveWorkbook.ActiveSheet lngLastRow = Sh.Cells(Cells.Rows.Count, "A").End(xlUp).Row Range("A4:E" & lngLastRow).Activate Selection.FormatConditions.Add Type:=xlExpression, Formula1:="=(MOD(ROW(),2)=0" Selection.FormatConditions(1).Interior.ColorIndex = 24 End Sub Thanks -- Traa Dy Liooar Jock You have an extra open paren just before MOD: &qu...

cdrom.sys corrupt in Win7
Yesterday Win7 decided to no longer show my 2 LiteOn DVDRW drives. I've tried to re-install/repair the driver (6.1.7600.16385) and everytime I get the same response = my current driver is good. BUT, then when I check with Device Manager, it shows that the drives are not working. Can anyone help me get a new cdrom.sys installed into the system32/drivers folder? Booting up with the Win7 DVD will work. But I can't find the cdrom.sys on the disk. No other repair options are there to get this fixed. Help would certainly be appreciated. I don't want to have to start all o...

VLookup #VALUE! error help needed to resolve
The following is the funcation I have: =VLOOKUP(B10,'FA CC Summary Report 1141'!F$9:G$92,2,0) I have all the columns formatted the same; as in the column that the function is using to lookup is text and so is the column for this figure in order to pull back the appropriate answer. I have keyed the data instead of having links. I have replaced the final '0' with TRUE & FALSE then put it back. I have formatted the columns for text and for numbers. But I am getting the #VALUE! error in SOME of the cells NOT all of the cells. I don't know what else to d...

Exchange 2003 SMTP QUIT
= = = = = = = = = = = = = = = = = = = = = = = = = = = PROBLEM: Problem is that OUR SERVER is sending QUIT-, instead of sending MAIL FROM: MY Server open a SMTP connection REMOTE Server says 220 .. MY Server says EHLO to REMOTE Server REMOTE Server says 250 ... MY Server then say QUIT ! (instead of MAIL FROM ....) We have::Exchange 2003 , cu SP1, pe Windows 2003.. Exchange has also IMF (spam filter from Microsoft) and Symantec Mail Security for Exchange 4.5. all PTR is installed and working OK. The SMTP Server is workin OK a while, then it start opening a lot of connections (7-10 /sec) t...

A question about CToolTipCtrl.
Hi All: Chinese English following! I add a CToolTipCtrl member in my dialog, and create it in OnInitDialog function, at last, I add a CEdit control to CToolTipCtrl member.When the CEdit control is enabled, tool tip can pop up normally, but when the CEdit control is disabled, tool tip can't pop up. How can I solve this problem? Thanks. Fiveight Take a look at http://www.codeguru.com/forum/showthread.php?t=309050&highlight=CToolTipCtrl+disable -- If the message was helpful to you, click Yes next to Was this post helpful to you? Regards, Goldbach "fiveight" wrot...

I need help
Here is my problem. A couple of years ago I began playing around with money. But I have come to the conclusion that I really do like the services, but I now have a bunch of acct. info that should have been input in a better manner. I want to know how do I delete all of the old info so that I can start fresh. I deleted that money program once and reloaded it but it retrieved all of the old garbage that I did not want. Your help is greatly appreciated. Sincerly, Matt On Tue, 19 Aug 2003 20:58:14 -0700, "Matt" <mrisher4@hotmail.com> wrote: >Here is my problem. A c...

Help styles
With great difficulty I am now creating documents with some styles.and outline numbering Now when I copy a table from another document into this document I get and similar numbering all over the table. How do I accomplish the copy without the numbering inside the table? afd Try this: Select the table cells and press Ctrl+Shift+N. This (re-)applies the Normal style to text. -- Stefan Blom Microsoft Word MVP "afdmello" <afdmello@hotmail.com> wrote in message news:%23R7DwkCdKHA.4952@TK2MSFTNGP06.phx.gbl... > With great difficulty I a...

Need help with cursor
Hello, I have a small GUI monitor application that doesn't have any controls on it. Basically its a frame with a title, menu bar, and client area. I dynamically size the frame for the contents of the client. The client window contains some status information about a service. I've noticed that the cursor gets changed to inappropriate values when the cursor is moved into the client area. For instance, moving the cursor in from the side may leave the cursor looking like the sideways-resize cursor. My application is written in MS VC++ v6.0. What events do I need to hook in...