Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

MFC Active Window

Posted on 2004-10-11
11
Medium Priority
?
423 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
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 120 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
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…

926 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