Reminder

How do you get a 'C' program to periodically display a message.
Which you click to close. I can currently get it to display a message in a certain time interval by using difftime(). I would like to display it in a specail window,  in something like the reminder format in netscape and explorer. It should also keep running and re-display in the specified time interval. I am using visual C++.
hsmith061297Asked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
jkrConnect With a Mentor Commented:
You could simple use a loop like this

void DisplayMessage(int nInterval)
{
int nRC;
while ( TRUE)
{
  Sleep ( nInterval);

  nRC = MessageBox ( ...);

  if (IDCANCEL == nRC) break;  
}
}

Feel free to ask if you need more information!
0
 
hsmith061297Author Commented:
When do a include of winbase.h for the sleep function I get 74 error in the include file. What am I doing wrong?
0
 
jkrCommented:
You don't have to explicitly '#include <winbase.h>', because it's already '#include'd by 'windows.h' (so it's not necessary)...
0
Live webcast with Pinal Dave

Pinal Dave will teach you tricks to help identify the real root cause of database problems rather than red herrings. Attendees will learn scripts that they can use in their environment to immediately figure out their performance Blame Shifters and fix them quickly.

 
hsmith061297Author Commented:
Thanks
0
 
hsmith061297Author Commented:
THE MESSAGE BOX DOES WORK!! Could you answer one more question? How do you suppress on minimize the display of the output box?
0
 
jkrCommented:
Hmm, I'm not sure if I got you right, but were you thinking about

void DisplayMessage(HWND hWnd, int nInterval)
{
int nRC;
while ( TRUE)
{
  Sleep ( nInterval);

  if ( IsIconic ( hWnd)) continue;

  nRC = MessageBox ( ...);

  if (IDCANCEL == nRC) break;  
}
}

?
0
 
hsmith061297Author Commented:
After looking up IsIconic I saw a referal to CloseWindow() which actually minmizes the window. This is what I need.  Now I will just have to read up on hWnd. Forgive me for lack of knowledge, but I am a "C" programmer trying to lean  Visual C++. Thanks for all your help.
0
 
jkrCommented:
No problem ;-)
0
All Courses

From novice to tech pro — start learning today.