Solved

MFC Active Window

Posted on 2004-10-11
11
410 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
  • 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
 
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
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

What my article will show is if you ever had to do processing to a listbox without being able to just select all the items in it. My software Visual Studio 2008 crystal report v11 My issue was I wanted to add crystal report to a form and show…
For most people, the WrapPanel seems like a magic when they switch from WinForms to WPF. Most of us will think that the code that is used to write a control like that would be difficult. However, most of the work is done by the WPF engine, and the W…
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…

744 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now