Message with MFC in custom class #2

Hi

How can I catch messages in an other class than the view? I have a
MFC-SDI-Application which draws with OpenGL.
I'd like to have a class, which handels the keyboard input, and another
which handels the OpenGL drawing. Can i derive the new class from
CCmdTarget? Does that work, and how would an example look like?

Thank you
John



0
bla7217 (2)
9/9/2004 11:34:12 AM
vc.mfc 33608 articles. 0 followers. Follow

1 Replies
611 Views

Similar Articles

[PageSpeed] 4

John wrote:
> Hi
> 
> How can I catch messages in an other class than the view? I have a
> MFC-SDI-Application which draws with OpenGL.
> I'd like to have a class, which handels the keyboard input, and another
> which handels the OpenGL drawing. Can i derive the new class from
> CCmdTarget? Does that work, and how would an example look like?
> 
> Thank you
> John
> 
> 
> 

Deriving from CCmdTarget is necessary but not sufficient to make a class 
capable of receiving messages.  Messages are sent only to windows, and 
CCmdTarget is the window's message routing code.  But it has to be 
associated with a window.  (Except MFC creates an exception by rerouting 
WM_COMMAND to CDocuments.)

The neatest solution to doing what you want is to consider the view 
class to be a message routing class (because that's where the messages 
come in).  In turn, the view could contain members that it calls for 
keys and for drawing.

If you have to do something else (I don't know what constraints OpenGL 
creates) you could look into catching all keys in 
CMainFrame::PreTranslateMessage().

-- 
Scott McPhillips [VC++ MVP]

0
Scott
9/10/2004 12:02:37 AM
Reply:

Similar Artilces:

VBA Customization History
Hi, Please let me know if there a way we can determine the customized VBA package import history in GP 10. Regards Sandeep, Not sure what you mean by "customized VBA package import history". However, this is what I interpret from your post: if you are looking to maintain a history of the changes done for a particular VBA customization, you may setup a project in say Visual SourceSafe and export a package file with the customization. You may version each file in Visual SourceSafe and add information as to the last time it was imported into GP. Best regards, -...

Excel Not Responding #2
Windows 2000 Professional running Office XP. When opening a file over the network from Windows 2000 Server, it takes a long time and in the task manager it shows "not responding" Then suddenly it opens. When copying the file locally, it opens immediately. The environment is 10/100 Switched network. This is happening on machines with 100Mb network cards and the server has a 100Mb card as well. Any ideas would be appreciated..... ...

2 separate worrkbooks
On Mar 5, 7:05 pm, ranjan.k...@comcast.net wrote: > Hi, > I would appreciate any VBA code for the following: > I need to extract data from say ColumnA, ColumnB, ColumnE and ColumnG > from "workbook1" > and placed this data in the corresponding columns (ColumnD, ColumnF, > ColumnH, and ColumnK) in "workbook2". Hi, I had posted the following on March 3rd I had gotten a response, but unfortunately it not the totally correct. Can someone help out? > Can you help? > Thanks Ranjan Sub CopyWbk Dim src, dest i=1 Set src=Workbooks("Workbook1")...

How do I count the number of time 2 columns meet my criteria
Can anyone tell me what is wrong with this formula? I am trying to say if the text in column B = this, and the text from column C = this, and then count the returned values: =IF(b4:b118,"Consistent Support Staff",IF(C4:C118,"Positive"),"1","0")) -- mrswhit try =sumproduct((b4:b118="Consistent Support Staff")*(c4:C118="Positive")) -- Don Guillett Microsoft MVP Excel SalesAid Software dguillett1@austin.rr.com "Mrswhit9" <Mrswhit9@discussions.microsoft.com> wrote in message news:B9F52CA3-53...

charting # Training classes
I am trying to do a column chart with the training that people attended below. I would like to find which people took "AT LEAST ONE CLass", AT Least TWO classes, and AT LEAST 3 Classes and that's it. I would like to put it by Department. I have done a pivot table and did IF function to create the "the AT Least One Class, etc. but now I want to chart the info - not sure how to do the "count "- It seems like it should be easier than this. Any ideas or quick ways to summarize on charts TRaining taken info???? Thanks, BArb Department First Last Location L...

Convert Lotus Notes to Outlook #2
Need to convert my lotus notes mail and contacts to Outlook. Pls advise A Google search will find you many ways to do it. They tend to involve the purchase of some software. Judy Gleeson MVP Outlook Trainer and Consultant read my articles here: www.judygleeson.com Canberra, Australia how to post questions: http://support.microsoft.com/?id=555375 "Ritesh" <Ritesh@discussions.microsoft.com> wrote in message news:C60F0827-BB59-492A-ABE6-0BED60DF4F37@microsoft.com... > Need to convert my lotus notes mail and contacts to Outlook. Pls advise ...

Tasks, calendar and e-mail on the same window #2
I'd like to find an add-on template to Outlook 2003 that combines the 3 components of: Calendar, e-mail and tasks in the same window. I tried the FranklinCovey PlanPlus for Outlook which includes e-mail, notes and calendar, but not tasks. This add-on is getting close to what I'd consider as a good compromise, but with the addition of the Tasks it will allow me to be more productive. Any suggestions where I can find one like that will be very appriciated. ...

messages on server
Where can I find a good explanation of "leaving messages on the server"? How do I access them? How do they show up on my outlook? how do I delete them? Normally Outlook will delete the messages from your POP3 (incoming) mail server after it downloads them. With that setting enabled, the messages won't be deleted. You normally access them via Outlook which has downloaded them or via a web mail client. You can delete them from the web mail client also "ajb" <al@thebehrs.net> wrote in message news:D6A0E327-3461-4F66-8A44-CF154749E0F4@microsoft.com... >...

Saving graph when using =(RAND) #2
Aha, the goal of this is to see on the same chart, all of the different iterations from pressing F9. Ultimately, I'd like to see something like 500 different lines on the same chart. Is there a less manual way to accomplish this? :) -- deacs ------------------------------------------------------------------------ deacs's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=2321 View this thread: http://www.excelforum.com/showthread.php?threadid=271282 ...

220 Volt (NOT USA COMPLIANT) Severin Breadmaker 2.2 lbs Cool Touch
List Price:$166.69 Image: http://bestdeallocator.info/image.php?id=B00008WVGI Best price found: http://bestdeallocator.info/index.php?id=B00008WVGI WILL NOT WORK IN USA ...

error #2
Hi, I had a vc++6 project. I had developed another project in vc++ NET 2003. I wanted some functionality from the new project in the old project. SO I converted the old project to .sln. I then took files from the new project and then added to the created solution. I get these errors though afxcwd.lib(afxmem.obj) : error LNK2005: "void * __cdecl operator new[](unsigned int)" (??_U@YAPAXI@Z) already defined in MSVCRTD.lib(MSVCR71D.dll) nafxcwd.lib(afxmem.obj) : error LNK2005: "void __cdecl operator delete[](void *)" (??_V@YAXPAX@Z) already defined in MSVCRTD.lib(MSV...

How do I prevent Outlook from deleting my online inbox messages?
I know there is a check-box for this somewhere... Outlook automatically deletes my inbox messages from my email server when downloading them. I need to have these remain because I use multiple computers and cannot have the only copy on my hard drive. I fixed this once before with a simple check option but can't find it!! If you post your version you will get an answer. Right now, there are = several methods but they all end up on the advanced tab of your email = account properties - check the box to leave a copy on the server. --=81 Milly Staples [MVP - Outlook] Post all replies t...

COMBOBOX #2
Ihave two combos and it has like 10 items .I am using control toobbox combo and I want values to come in second combo as I select infirst combo. all values are different for example If i select Green fruit in first combo then In second lemon and lime comes and then when i select lime it takes me to different worksheet which tells me the details of lime and so on. See http://www.xldynamic.com/source/xld.Dropdowns.html -- HTH Bob Phillips "smiley" <smiley@discussions.microsoft.com> wrote in message news:FF8A349D-62A2-4637-8C25-7910EBDACC06@microsoft.com... > Ihave tw...

XML Serialization of the Exception Class
I am attempting the following: XmlSerializer ser = new XmlSerializer(typeof(Exception)); I receive the following error: Message: There was an error reflecting type 'System.Exception'. Message: The property 'TargetSite' on type 'System.Exception' cannot be serialized because it is decorated with declarative security permission attributes. Consider using imperative asserts or demands in the property accessors. If I had ANY IDEA in the WORLD what this message is trying to tell me I would try to do something about this. Can anyone help me? Thanks In Advance d...

Customization Microsoft CRM 3.0 Beta
Hi, In Microsoft CRM 3.0 Beta is an entity "Opportunity relationship" We want to customize this entity. The Type shows this entity is customizable but it's NOT. We have a few questions: 1 Is it possible in the final release Microsoft CRM 3.0 to customize it with the possibilities other 'regular' entyties have ( Forms and Views, Changing and adding attributes, Changing and adding Relationships)? 2 If NOT! Is is possible and advisable with the SDK Microsoft CRM. Greetings Maarten Questions related to the Beta should be placed in the private Beta newgroup. You can ...

messages stuck in "awaiting directory lookup" status
Experts, Running Windows Server 2003 SP1. Exchange SP2. No mail has been sent out of my server for the last few hours. While troubleshooting, I have discovered they are all awaiting Directory Lookup (figured this out by drilling down into Queues on the server object in ESM. Right-clicking on "messages awaiting directory lookup" and selecting "force connection" did nothing. The Exchange server is co-located on the same server as the DC/GC for testing purposes (small home network). -- Spin Hi Have you tried running DCDiag to test availability/health of this...

Find distinct records of the last order from a customer
Hi I am trying to find a list of customers that have not bought anything for the last xx months. I have a salesorder table which holds an orderdate and customer account code, other customer details are held in the customers table. i have a table called soitemsdespatch thats holds the parts that have been sold to that customer. salesorder and soitemsdespatch are linked by sonumber. I was hoping that would show me the last orderdate for all customers and list them in order but it repeats customer orders but not all of them. What i would really like is one query that would show m...

Check box questions (2)
Hi, sorry if this has already been answered somewhere before but trawled through and couldn't find anything. I am using check boxes to perform calculations based on TRUE or FALSE 1. How can I get the cell link in the Format Control to update if copy and paste several rows with several check boxes further down th sheet? Ie. one check box links to C3 but I want to copy that whole row dow one and have the check box autoupdate its link to C4. 2. How can I get a sum of multiple IF results from my check boxes? For example: =(IF(A1=TRUE,50,0))+(IF(B1=TRUE,50,0)) So that if both check boxes ...

How Do I insert the keystrokes SHIFTF3 into a cell? #2
I am trying paste data from excel into another software program, In order to speed up data entry. In orde for it to work correctly I was wondering how I would tpye/insert the keystrokes ShiftF3 into a cell so that we I copy it over to the other software program it performs the function clear field(ShiftF3 performs the clear field command in the other software program). Or does anyone have any ideas how I would get around this issue? ...

Two "Personal folders" #2
Dear all; When opening outlook 2003, I see two personal folders. One with the "Home" icon and the other one with a sort of "directories" icon. They both have the same contents. Can I, and if so how, get rid of one of them ? Mark. If you right click on the duplicate "personal folders" (not the one that has Outlook Today next to it) and select Close, do you get an error? If yes, you most likely will have to create a new mail profile via the mail applet in the control panel (don't copy the existing one) and delete the old one. -- Russ Valentine [MVP-Out...

gridlines #2
I am adding gridelines to my chart but for some reason the top row of my chart (axis) doesnt show the gridline across yet the other lines do? How do I get all the lines to go across?? You can show grid lines by following two ways 1.You can change the weight of the grid lines. so in the top grid line can be distinguished from plot area border. or 2.You can set plot area border to nothing so that top grid line can be shown -- mvengu ------------------------------------------------------------------------ mvengu's Profile: http://www.excelforum.com/member.php?action=getinfo&userid...

Publisher 2007 Mail Merge #2
I'm trying to use an Excel file for a mail merge in Publisher (mailing labels). There are 50 addresses and I can only get Publisher to print each address across an entire sheet of labels so I end up with 30 labels with the same address. How do I set this up to print one address per label so I end up with 50 labels? thanks! larry ...

Using files from lotus 1-2-3
I am using Office 2003 with Microsoft XP Home Edition. I open files previously saved in Lotus 1-2-3 as *.XLS. I am able to edit and add data to the file, but when I print the file it has a dense, large, black overlay of the first characters in the file name, obliterating much of the data. This shows in the print preview and in the final printed copy. How do I eliminate this overlay? Hi Alpan, as far as I have learned during the past years the Lotus 1-2-3 converter to MS Excel is not quite good and has several issues. Have you ever tried to leave the Lotus1-2-3 file as it is and l...

downloading transactions #2
I have a strange problem. I don't believe that I've done anything to my laptop but my transactions to be downloaded don't appear even though it says "import completed" (being done on a floppy disk so I can have it on the laptop) --I also reinstalled the program and it's still doing the same thing. I went back to the reg computer and downloaded the transactions into the MM2004 program there, and then exported that file back onto the floppy disk, went back to the laptop and imported that file. Worked beautifully but this is a whole pile of extra work. One s...

Major Short Squeeze Likely / FDA Drug Approval #2
Major Short Squeeze Likely / FDA Drug Approval There was a short attack on AVNR based on a report by a less than reputable publication. It opposed the analysis of Avanir's Neurodex drug up for FDA priority review & approval by Oct. 30th at the latest. If approved, it will have orphan status giving it a virtual monopoly on the market. The drug, with all indications approved could become a multi-billion dollar drug. Avanir just aquired Alamo Pharmaceuticals in a very slick deal which gives them access to a professional, fully train in-house pharmaceutical sales force and adds yet anothe...