473,378 Members | 1,671 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

User defined messages to the Document

This is probably a simple/stupid question, but...

I have an MDI application which has a socket receiving data. When the
data is received it is displayed in some way. Sometimes the data that
is received is new and sometimes it is just an update. If something
in the document hasn't been updated in awhile it needs to be removed
and the view updated to reflect this. I decided to have a timer
thread. A worker thread that sits there and every second checks all
the data and any thing that has been there ahile it discards. Easy.
But Now after it has discarded it it needs to update the view
(Actually call UpdateAllviews() ). Of course a worker thread just
can't call UpdateAllViews(). So I need the thread to post a message.
The books I have require that the way this is done is to call
::PostMessage(hWnd, WM_USERMESSAGE, wParam, lParam) and the examples
all have the message handler in the CView class to which the hWnd
refers to an instance of. So now I am just doing that and having the
handler in the View class call the UpdateAllViews() which works,
but.... Isn't there a better way?? Can't I post a message directly
to the Documentclass and have a handler there take care of it??

raphtee
Nov 17 '05 #1
3 898
>but.... Isn't there a better way?? Can't I post a message directly
to the Documentclass and have a handler there take care of it??


Only WM_COMMAND messages get routed to the document. See the topic
titled "Message Categories" in MSDN.

Dave
--
MVP VC++ FAQ: http://www.mvps.org/vcfaq
Nov 17 '05 #2
David Lowndes <da****@example.invalid> wrote in message news:<aq********************************@4ax.com>. ..
but.... Isn't there a better way?? Can't I post a message directly
to the Documentclass and have a handler there take care of it??


Only WM_COMMAND messages get routed to the document. See the topic
titled "Message Categories" in MSDN.

Dave


Thanks for the help. I was using a WM_COMMAND message. But I was
using ::PostMessage() in the Timer Thread (which is just a worker
thread) to post the message and this function requires a window handle
to know where the message should go. I was using the window handle of
one of the views to which the document was attached. Can I use the
window handle of the main frame instead??

raphtee
Nov 17 '05 #3
>Thanks for the help. I was using a WM_COMMAND message. But I was
using ::PostMessage() in the Timer Thread (which is just a worker
thread) to post the message and this function requires a window handle
to know where the message should go. I was using the window handle of
one of the views to which the document was attached. Can I use the
window handle of the main frame instead??


Give it a try!

Dave
--
MVP VC++ FAQ: http://www.mvps.org/vcfaq
Nov 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Mr X | last post by:
I'm a few weeks new to JS, and am having a problem. I have a simple INTERNAL style in a web page and I know that style is working. The problem arises when I try to run a script that changes one of...
7
by: grandeandy | last post by:
I have been racking my brain out trying to get this to work... (I am new to javascript)... Below is what I am trying to accomplish. I want to have the areas with +txt+ to have the user defined...
1
by: torbs | last post by:
I have an defined an object with a method called loadMovie that use a method - SetUrl- in an embedded quicktime object. It is embedded using the object tag, but I have also tried the embed tag. ...
26
by: Nospam | last post by:
I am trying to open a link in a new template window : <a onclick="windowopen('example.html','example');return false;" href="http://www.example.com" target="_blank"example link</a> such that...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.