Solved

MFC Active Window

Posted on 2004-10-11
11
419 Views
Last Modified: 2013-11-25
there are problems... two things
1- window-A is active window and is checking the port if Window-B is shown, is the previous still monitoring and updating the things on port .....or not?
2- if Port is close by some WM_MESSAGE call then how can i get it so that i can reinitate it?

Scnario is that i have open a Serial port session in Window-A main window which is recieving a huge amount of data at that momment if i active the window-B.
Is Window-A still recieving if window-B is active?
0
Comment
Question by:neutrongenious
[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
  • 6
  • 5
11 Comments
 
LVL 13

Expert Comment

by:SteH
ID: 12285615
Send a message from window A once per loop to window B. When window A stops its message loop window B won't receive the messages anymore. In Window B's message loop you handle that message as to setting a counter to a high value. And use a timer to decrement this counter and reinstantiate window A if the counter reaches 0.
0
 
LVL 1

Author Comment

by:neutrongenious
ID: 12285788
can you please clear it a bit more?
0
 
LVL 13

Expert Comment

by:SteH
ID: 12285860
This requires that you explain a bit what window-A and window-B is. Are those independent applications? Or threads belonging to the same application. From the first part of your Q I understood that A is checking B to be still doing something, whereas the second part clearly explains the opposite. What way is correct?

On windows since Win95 you have multitasking. That is every application gets its share from the CPU slices. On NT like OSses you can influence how much by setting either applications or threads priority and in addition by specifying that CPU slices should be given in preferences to the active application or to background services. If window-A and B are independent applications window-A should be in the background and preference could be given to background services. But transfer speed of the serial port is negliable compared to LAN or USB ports. Using a serial port with a FIFO should remove any problems from not receiving all characters under normal circumstances. If you have several dedicated high speed ports this changes a bit. But normally those are only on special cards with a driver handling that issue already for you.

0
MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

 
LVL 1

Author Comment

by:neutrongenious
ID: 12292759
window-A is a dialoug based window which is recieving data from serial port.
window-B is another dialog based window in same application
Now on some event e.g. datacall() window-A calls window-B.
now my question is that is window-A still handeling the data comming on serial-port......
0
 
LVL 13

Expert Comment

by:SteH
ID: 12295411
While window-A is doing datacall () it is not doing something else. So you need to assure that datacall last short enough that no data from the serial port will be lost. If datacall is not too lengthy and the hardware is almost up to date I see no problems.
0
 
LVL 1

Author Comment

by:neutrongenious
ID: 12295490
right! but there is always some data on serial port.................
hardware is ok but in this case data is always there...........in this case will it work?
0
 
LVL 13

Accepted Solution

by:
SteH earned 40 total points
ID: 12295541
Serial ports since something like 5 years have FIFO buffers integrated. That means there can be 8 to 64 bytes stored before it needs to be read.

Whether it will work depends now on the speed of the serial link, the FIFO size and the maximum delay between to read cycles on the port. With a single port I doubt that you will run into problems since the system driver might even store data in an internal buffer (kBytes) and do reads whenever there is a need.

If you want to be sure about your setup, you need to do a test to verify. Can you add checksums to the data which gets to your port?
0
 
LVL 1

Author Comment

by:neutrongenious
ID: 12307142
hun........ can you guide me how can i do this i don't know how to add the checksum?
0
 
LVL 13

Expert Comment

by:SteH
ID: 12307184
Have a look at
http://www.createwindow.com/programming/crc32/
crc32 is the most commonly used check, so it should be worth a try. Other possibilities are MD5 hash:
http://www.faqs.org/rfcs/rfc1321.html

HTH
0
 
LVL 1

Author Comment

by:neutrongenious
ID: 12332964
SteH how can i call a Modeless window window......?
0
 
LVL 13

Expert Comment

by:SteH
ID: 12336830
Create the window (CDialog derived?) and call xxx.Show ().
0

Featured Post

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!

Question has a verified solution.

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

Suggested Solutions

Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
For a while now I'v been searching for a circular progress control, much like the one you get when first starting your Silverlight application. I found a couple that were written in WPF and there were a few written in Silverlight, but all appeared o…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

710 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