Solved

Clock

Posted on 1998-06-01
6
293 Views
Last Modified: 2010-04-01
I have made a clock activeX control  for displaying current time.
It is placed together with other controls in a form.
But it has a major weakness.
The clock stop running whenever my application is reading. a file. It resume after that.
I believe it is due to the two cannot run at the same time.
What to do to allow the clock to continue running while doing something else?
Thanks.
0
Comment
Question by:Cruiser
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 3

Expert Comment

by:tma050898
ID: 1165106
An application like is *definitely* a candidate for mutli-threading. You need to provide more details, however, in order for me (or someone) else to help you in that area. For example, if you're using VC, your options are different than if you are using straight SDK.

Tom

0
 

Author Comment

by:Cruiser
ID: 1165107
The clock control I built is written in Visual C++.
The application form used is in Visual Basic.
0
 
LVL 32

Accepted Solution

by:
jhance earned 100 total points
ID: 1165108
While the file is being read, Windows doesn't process the message loop for your application.  I assume that your clock control is settings up a timer and responding to timer events to keep itself updated.  Probably the easiest solution is to run either the clock or the file input function as a separate thread.  This way, each will have it own message loop and the long processing in the file input won't block the clock.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:Cruiser
ID: 1165109
How to make the threads?

0
 
LVL 32

Expert Comment

by:jhance
ID: 1165110
In C++ under Win32 you use the CreateThread() API call.  I don't know a lot about VB, but I do know that it's possible to create threads in VB 5.0.
0
 

Author Comment

by:Cruiser
ID: 1165111
The thread is created in the clock control right?
If so, then it is in VC++.
I'm not sure about creating thread, maybe u can give an example?
I will give u 100 more pts if u can help me solve this.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

691 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question