• C

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?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

jkrCommented:
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C

From novice to tech pro — start learning today.