[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 426
  • Last Modified:

MFC Active Window

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
neutrongenious
Asked:
neutrongenious
  • 6
  • 5
1 Solution
 
SteHCommented:
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
 
neutrongeniousAuthor Commented:
can you please clear it a bit more?
0
 
SteHCommented:
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
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 
neutrongeniousAuthor Commented:
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
 
SteHCommented:
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
 
neutrongeniousAuthor Commented:
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
 
SteHCommented:
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
 
neutrongeniousAuthor Commented:
hun........ can you guide me how can i do this i don't know how to add the checksum?
0
 
SteHCommented:
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
 
neutrongeniousAuthor Commented:
SteH how can i call a Modeless window window......?
0
 
SteHCommented:
Create the window (CDialog derived?) and call xxx.Show ().
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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.

  • 6
  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now