How do I post a message to CDocument?

At the moment all ON_MESSAGE are handled in CMainFrame. 
I want to handle a message in CDocument but I can't get it to work. 

How is it done?


Steve
-- 
EasyNN-plus. The easy way to build neural networks.
http://www.easynn.com
0
steve (110)
12/4/2004 11:56:59 AM
vc.mfc 33608 articles. 0 followers. Follow

9 Replies
706 Views

Similar Articles

[PageSpeed] 37

Steve,

> At the moment all ON_MESSAGE are handled in CMainFrame. 
> I want to handle a message in CDocument but I can't get it to work. 
> 
> How is it done?
I don't know if this will help you, but you can recieve the message in 
CMainFrame then call a CDocument function to do whatever you want to do. You 
can access a CDocument object from within a CMainFrame by calling 
CMainFrame::GetActiveDocument().

Hope this helps,

Geo
0
Geo (129)
12/4/2004 1:59:04 PM
steve@tropheus.demon.co.uk wrote:
> At the moment all ON_MESSAGE are handled in CMainFrame. 
> I want to handle a message in CDocument but I can't get it to work. 
> 
> How is it done?
> 
> 
> Steve

It doesn't work.  The MFC framework only routes one message to 
CDocument: the WM_COMMAND message.  You could consider using this 
message, with unique ID and notification parameters.  But this does not 
give you the freedom to put anything you want into wParam and lParam.

-- 
Scott McPhillips [VC++ MVP]

0
Scott
12/4/2004 2:01:01 PM
Can you get a pointer to the CDocument class?  Where do you want to send the 
message from?

    Rail
-- 
      Recording Engineer/Software Developer
      Rail Jon Rogut Software
      http://www.railjonrogut.com
      mailto:rail@railjonrogut.com

<steve@tropheus.demon.co.uk> wrote in message 
news:5793r09k7c4tc7i2si6f0g9maebdq7lhn6@4ax.com...
> At the moment all ON_MESSAGE are handled in CMainFrame.
> I want to handle a message in CDocument but I can't get it to work.
>
> How is it done?
>
>
> Steve
> -- 
> EasyNN-plus. The easy way to build neural networks.
> http://www.easynn.com 


0
railro (128)
12/4/2004 4:37:57 PM
On Sat, 04 Dec 2004 09:01:01 -0500, "Scott McPhillips [MVP]"
<org-dot-mvps-at-scottmcp> wrote:

>steve@tropheus.demon.co.uk wrote:
>> At the moment all ON_MESSAGE are handled in CMainFrame. 
>> I want to handle a message in CDocument but I can't get it to work. 
>> 
>> How is it done?
>> 
>> 
>> Steve
>
>It doesn't work.  The MFC framework only routes one message to 
>CDocument: the WM_COMMAND message.  You could consider using this 
>message, with unique ID and notification parameters.  But this does not 
>give you the freedom to put anything you want into wParam and lParam.

That's the way the message is handled at the moment it's not working.
The complication is that it needs a document first. My idea was to
create a new document from the application with CWinApp::OnFileNew and
then use that document. I couldn't find a way to get at the document
so I was trying a different approach. So far both methods have
defeated me!


Steve
-- 
EasyNN-plus. The easy way to build neural networks.
http://www.easynn.com
0
steve (110)
12/4/2004 5:03:14 PM
On Sat, 04 Dec 2004 16:37:57 GMT, "Rail Jon Rogut"
<railro@earthlink.net> wrote:

>Can you get a pointer to the CDocument class?  Where do you want to send the 
>message from?
>
>    Rail

That's a problem. How do I get a pointer to CDocument from CApp?


Steve
-- 
EasyNN-plus. The easy way to build neural networks.
http://www.easynn.com
0
steve (110)
12/4/2004 6:16:10 PM
On Sat, 04 Dec 2004 16:37:57 GMT, "Rail Jon Rogut"
<railro@earthlink.net> wrote:

>Can you get a pointer to the CDocument class?  Where do you want to send the 
>message from?
>
>    Rail

That's a problem. How do I get a pointer to CDocument from CWinApp?


Steve
-- 
EasyNN-plus. The easy way to build neural networks.
http://www.easynn.com
0
steve (110)
12/4/2004 6:19:52 PM
steve@tropheus.demon.co.uk wrote:
> That's a problem. How do I get a pointer to CDocument from CWinApp?
> 
> 
> Steve

CWinApp contains a list of document templates, and each of them contains 
a list of CDocuments, and each of them contains a list of CViews.

Start with GetFirstDocTemplatePosition and GetNextDocTemplate.

-- 
Scott McPhillips [VC++ MVP]

0
Scott
12/4/2004 6:39:53 PM
<steve@tropheus.demon.co.uk> schrieb im Newsbeitrag =
news:5793r09k7c4tc7i2si6f0g9maebdq7lhn6@4ax.com...
> At the moment all ON_MESSAGE are handled in CMainFrame.=20
> I want to handle a message in CDocument but I can't get it to work.=20

If you want to handle other messages than WM_COMMAND o a document, you =
should consider to handle them in a view. The view has direct access to =
the document it belongs to.

HTH
    Heinz
0
hozwirk.SPAM (112)
12/4/2004 7:13:03 PM
See the CDocEnumerator class here:
http://msdn.microsoft.com/msdnmag/issues/04/05/CQA/

--
Ajay Kalra [MVP - VC++]
ajaykalra@yahoo.com


<steve@tropheus.demon.co.uk> wrote in message
news:glv3r0la39nnprg13h1s14ljlmfj7ppio8@4ax.com...
> On Sat, 04 Dec 2004 16:37:57 GMT, "Rail Jon Rogut"
> <railro@earthlink.net> wrote:
>
> >Can you get a pointer to the CDocument class?  Where do you want to send
the
> >message from?
> >
> >    Rail
>
> That's a problem. How do I get a pointer to CDocument from CApp?
>
>
> Steve
> --
> EasyNN-plus. The easy way to build neural networks.
> http://www.easynn.com


0
ajaykalra (6841)
12/5/2004 2:56:34 AM
Reply:

Similar Artilces:

counting email messages being sent out
I am new to exchange 2003 administration. Is there a tool within MS Exchange 2003 that can bring up a count of how many emails were sent out for a particular time frame? Or is there a utility to download that can be used? Performance Monitor has lots of exchange counters. Try there. Vince -- Vince "Rob" wrote: > I am new to exchange 2003 administration. Is there a tool within MS Exchange > 2003 that can bring up a count of how many emails were sent out for a > particular time frame? Or is there a utility to download that can be used? Vince, Thanks for the heads up...

item stock inquiry error message
when I try to do an item stock inquiry, the following message pops up "An open operation on table 'tcsSYSTB00000_WindowsParams' failed accessing SQL data." when I clink to show more info, this is shown "[Microsoft][SQL Native Client][SQL Server]CREATE TABLE permission denied in database 'DAI'." Any idea how to fix this issue? Thanks - That sounds like a Trinity Computer Services table - have you asked them about this? -- Victoria Yudin Dynamics GP MVP Want to use Crystal Reports with GP? http://www.flex-solutions.com/gpreports.html blog: http://ww...

Posting old bills
I am setting up Money 2006 to tract income and expenses for a rental property, but I need to back date it to 1/1/2007. How do I enter bills and deposits made in the past? Thanks Go to the account register and enter the manually. Just click on the next blank transaction and go to town. You may want to make sure you are using Advanced Register. If there are subsequent transactions already in these accounts and you have balanced the accounts to statements--as though these transactions were already entered--then you will have to adjust account beginning balances and/or Account Adjustment...

* OWA... (Third Post)
Microsoft? If you're concerned about security then you should respond to this question. We cannot make this OWA server available on the Internet without applying the latest SP and critical updates. =========================== Our OWA Exchange 5.5 server (Windows NT Server) recently died and we replaced it with a Windows 2000 Server. We installed Exchange 5.5 OWA then applied Exchange SP4. Everything was working until we apply Windows 2000 SP4. Everytime we logon we get "OWA was unable to get to your inbox" error. As soon as we un-installed Windows 2000 SP4, OWA wo...

To the sender of the MI5 posts
I am not sure if you read responses or (like most other spammers) just see the web as a place where you are free to say whatever you want without fear of contradiction. Who knows? Either way - this section of this site is site is specifically here so that anyone with a comment, question, point to rise, etc regarding access databases can post with the knowledge that other likeminded people may read their post. It is not here as a general forum to discuss other matters. I have no doubt that if you are blocked from posting you will see this as yet another indication that MI5 is after yo...

OL07 keyboard "short"cuts in the Message Window?
In OL03, I was able to change the account to send a message with Alt+N followed by the number. Now, it seems, the shortcut is Alt+H,Y,1 followed by the number. Similarly, to send a message, I would use Alt+S. Now I have the choice of Alt+H,S or Alt+F,E. (Or Ctl-ENTER, I suppose.) Is there anything I can do to make OL07 use shorter shortcuts? Alt+S should still work... -- Diane Poremsky [MVP - Outlook] Author, Teach Yourself Outlook 2003 in 24 Hours Coauthor, OneNote 2003 for Windows (Visual QuickStart Guide) Need Help with Common Tasks? http://www.outlook-tips.net/beginner/ Outlook ...

Outlook Message Inline Text
I have Outlook 2002 and need to know if I can change my received message format to inline text. Right now I have e-mails that have been forwarded multiple times as attachments instead of inline text but I can't synchronize it with my Pocket PC because of this. Any Suggestions? Thanks, Benny ...

What's the difference between Cross-posting and Multi-posting
And thanks for the discussion earlier... although the rudeness was unneeded. Sign me, A New User (and learning from you all) rochgal, you wrote on Thu, 22 Sep 2005 14:53:03 -0700: > What's the difference between Cross-posting and Multi-posting Cross-posting = You send one posting to several newsgroups. Multi-posting = You send several postings (with the same content) to several newsgroups. -- Best Regards Christian Goeller Some misspellings, grammatical or linguistical mistakes found? All corrections would be appreciated! ...

Post to GL
Hello I am having a problem with a setting within Great Plains 8.0 service pack 2. I have posting setup to only allow posting from the batch level for Inventory. But when you go into Inventory Batches the check box for post to gl is not marked. If I have it setup in posting to post to the gl shouldn't this check box be marked in inventory batches? -- Thanks, Brian Apples and oranges. The post to GL checkbox on the inventory batch window tells the system whether an IV transaction will post at all. The posting settings in tools --> setup --> posting tell the system w...

Intrastat posting issue
We are a UK company using intrastat. At the moment we cannot post invoices directly (thru) to the General ledger because we are getting an error saying that the 'intratsat information is missing'. When we click on an invoice that won't post in the Sales Transaction Entry screen, and click on the blue EC flag box, all the intrastat data is there and correct. Then when we post it goes through to the GL correctly. It seems that it will only post to the GL if every single line is checked (via the Blue EC flag) on the sales invoice regardless of the fact that all the date is alr...

Access 2002 bug: "dynamic" forms problem
There was no respond to my original post in microsoft.public.access.forms (May 5th 2007) about a fortnight so I try it here... ��������������������������������� A while ago we had a discussion about A2002 (sub)form which changes dynamically from code (hide/unhide controls, change subfom's width, etc.). There's a problem if I make some changes in code when the form is open: if I save changes, A2002 saves controls positions & subform's size as well. This is a BIG A2002 BUG and it's really annoying. Why Access forms don't behave as Visual Basic forms? I don't want Acc...

where is my post??
twice now I have typed up my post & sent it. So where is it? On Wed, 18 Jul 2007 08:41:36 -0700, Stapes <steve.staple@gmail.com> wrote: >twice now I have typed up my post & sent it. So where is it? On Google Groups: 1184773041.958329.270430@e16g2000pri.googlegroups.com Google's been having some problems lately, maybe it's temporarily unavailable. John W. Vinson [MVP] You mean the multiple posts with subject "Cancel = true"? I see 3 of them, and Allen Browne's already provided an answer. -- Doug Steele, Microsoft Access MVP http://I...

Is there a way I can only print the reply instead of the entire email message
I wonder if there is a way I can only print the reply to an email message, instead of printing the entire message? My choice for selection only seem to be gone with Outlook 2003 printing options. Any help is appreciated.............Peter ...

Duplicate messages when filtering
I have created a rule to MOVE messages from one address to a subfolder, but every time these messages arrive, Outlook puts a copy of the message on the Inbox AND ALSO on the subfolder I specified on the rule. I checked the rule and the action ONLY says to MOVE the e-mail to the specified subfolder, not to leave a copy on the mais Inbox folder. I'm very annoyed by this, because I always have to go to the Inbox and delete the message copy. Any ideas? ...

My post not posted!
A couple of times when I've posted a reply to a recent post (same day), and later tried to view it, I found the header with a line drawn through it, and the following in the message body view pane: Message is no longer available on the server Windows Live Mail is unable to retrieve the requested message because the server no longer has the message available. -------------------------------------------------------------------------------- News servers regularly expire articles as they get older to make space available for newer articles. IMAP servers can be accessed by multip...

Sending message 1 of ....
In general, sending is fine but I get a "Sending message 1 of X" message in the status bar which does not correspond to anything. It started with "Sending Message 1 out of 2" a few months ago. It has recently grew up to 11. The only message I get is "503 bad sequence of command". All my fellow workers, connecting to the same server with the same Outlook 2003 version do not have this issue Any idea ? ...

Can't view Messages
I cannot view any newsgroup messages in the preview pane. The only way i can view it is to "reply" then i see the message below my reply. I have Win XP Pro, and Outlook 2003. Any help is appreciated. (My outlook / email works fine). -Matt nutshell222@hotmail.com Hi Matt, please use Outlook Express as Newsreader -- Ich habe nichts gemacht, gestern gings noch! Bitte in den Newsgroup antworten damit jeder etwas davon hat. Bravestar@Datenschutzministerium.de "Matt" <nutshell222@hotmail.com> schrieb im Newsbeitrag news:ZqadneKI2qQ5RZvcRVn-uw@warpdrive.net... > ...

Cannot send newsgroup post with an attachment
I can send and receive posts using Outlook Express 6 newsgroups. I do not use html. When I send a post that has an attachment, e.g. a 160kB jpg that post never shows up as having been sent. How can I fix this? regards, "nobody" I can't speak for others, but msnews has a 100KB limit. If I have a need to post a graphic, I upload it to TinyPic and post the link to it. TinyPic: http://tinypic.com/ -- Bruce Hagen MS-MVP [Mail] Imperial Beach, CA "news.microsoft.com" <nobody@nowhere.com> wrote in message ...

Fixed Assets Error Message
I've just installed GP10 SP 1 945412 on a test server. Originally I only installed SmartList builder. I've just finished adding Fixed Assets, Analytical Accounting (and Grant Management) and Project Accounting. When I launch GP Utilities I get the following error message: Fixed Assets Product 309 does not support upgrading from version 6.0.0 or prior Does anyone know what this means? Thanks! Maatthias, If you run the following query against your DYNAMICS database, what is the result? select db_name, db_verMajor, db_verMinor, db_verBuild from DB_Upgrade wher PRODID = 309 B...

Message Recall #2
Hello, I'm using Outlook 2002 with an Exchange 5.5 server. When I attempt to recall a message sent to a local mailbox or to an external recipient, it fails with the "Your message could not be recalled" error message whether or not the message has been read and the message has not been deleted. Any resolution would be appreciated. Thank you. It's not very reliable to begin with and it should always fail to the external recipient. Does everyone internally use the same version of outlook? Does it work if they open the recall message? -- Diane Poremsky [MVP - Outloo...

New rules error message
I suddenly started receiving a "Rules in error" message "cannot remove messages from the folder". Rules seem OK. Any ideas ...

can't print outlook 2000 message
I have outlook 2000 When I print a message I get the error: an error has occurred in your program. To keep working anyway click ignore an save your work in a new file... and then the outlook is closed. what can I do print a message from outlook? I've seen this problem when printing an HTML message and trying to print to a different printer than the default printer. As long as I print to the default it works. Plain Text and RTF emails, I can print to any printer. Other option, Uninstall printer and reinstall it. "amc2" <amc2@013.net.il> wrote in message news:8b4b01...

FYI
FYI to anyone who has Ex2003 SP1. I came across this problem on my server and the hotfix resolved it. Note: I didn't have the exact problem described because my messages were getting stuck in the "Local delivery" queue, not the "Messages pending submission" queue and I never got any error events, but nonetheless the hotfix corrected it. http://support.microsoft.com/?kbid=843545 Digitally signed messages remain in the Messages pending submission queue and are not delivered in Exchange Server 2003 SP1 -- Sincerely, Martin MCSA: M I ran into the same problem, t...

Editing Sales Rep in a Posted Transaction
Does anyone know if there is a way to recall a transacrion just to change the associated sales rep? Hello Scarpa, You cannot change a transaction that has happened via the system's interface. You could modify the database using SQL or Access or a number of other tools... however that may not be the right thing to do. One of my clients was having this happen quite often... for example John sold it but it was rung up under Peter... so we created a return reason code for wrong sales rep... the cashier basically recalls the transaction for return.... picks the reason code and then eit...

can not read message text
Hi all, I just upgrade from Outlook 2000 to Outlook 2003 on a Win XP. Using Outlook 2003, when I click on a message, I am unable to read the message text for some reason. The reading pane never display any text. I tried reading my old emails that I know have a lot of message text, but now they are all blank. On the other hand, when I receive a new email and a notification is displayed at the bottom right hand corner, I can see a hint box that shows some of the message content. But when I actually go to open that message, again the reading pane is blank, I can't see any content....