Solved

unable to add message handler

Posted on 1998-11-30
6
531 Views
Last Modified: 2013-11-20
well i am relatively new to visual C++ 5.0. i have made a menu option "clear all" for which command id is ID_CLEAR_ALL. for this id i want to define the message handler which handles the "clear all" command. the message handlers r added from the wizard bar but i dont get the option of adding the message handler.
but if i change the class to "CAbout" i get this option of "adding the message handler". same holds for "adding virtual functions".
please tell the soln as i have been stuck for 3 days.
thanks in advance
my mail id is : aarya@cdotd.ernet.in
0
Comment
Question by:aarya
  • 3
  • 2
6 Comments
 
LVL 3

Expert Comment

by:plaroche
Comment Utility
Ok so you've added a menu command with ID_CLEAR_ALL.  Now you want to clear something with this command.

1) If you want to clear the view then handle the command in the view
2) If you want to clear all views, then handle the command in the document and do a UpdateAllViews with the proper hint.
3) If you want to clear all mdi childs, handle the command in the MDIFrameWnd and send the clear command to all MDI child.

This all depends on what is to clear as you can see.

To add the handler:

Pop up the classwizard dialog, select the class in which you want to add the handler. Then select ID_CLEAR_ALL in the left listbox. Then double-click on ON_COMMAND (or something like that) in the right listbox.
When you close that dialog with OK a command handler will be added to the class you chose.
Go in classview, select that class and double-click on the newly added command-handler.
You're now in the source file read to add some code.
0
 
LVL 3

Expert Comment

by:GGRUNDY
Comment Utility
Look at the name of your dialogs as shown on the resources tab of the developer studio workspace pane. You will probably notice that one of dialogs has a language shown after it  in parenthesis. Use the right mouse button on the dialog you are having problems with and select PROPERTIES. Now change the language to be the same as the language of your About Dialog. (Probably standard Yank)

Then magically you will be able to see ID_CLEAR_ALL. in the wizard.

This is standard practice and in  keeping with Microsofts company policy of ensuring that everying you do has unforseeable, unintended, annoying consequences.

Cheers Greg

0
 

Author Comment

by:aarya
Comment Utility
hi plaroche
nice of u to answer my query. plaroche like u said the criteria for adding the message handler in the particular class, i want to add it in the "CScrribleDoc" (document class).
i think what u have suggested should happen ideally. but if i choose the class in the leftmost listbox then the option of "all class members" appear in the middle list box and the list of all the members of the class are listed in the extreme last list box
but i don't see the command id "ID_EDIT_CLEAR" anywhere.

But i have noticed one thing that if "CChildFrame" is selected in extreme left list box then the list of all command ids are displayed in the middle list box (this includes "ID_EDIT_CLEAR_ALL" and other ids like "ID_EDIT_CUT",etc) and in the extreme right list box members are displayed if "all class members" is selected in the middle list box but if particular command id is chosen like 'ID_EDIT_CLEAR_ALL" then the option of "COMMAND" and "UPDATE_COMMAND_UI" appears. Well this is what i want to do with the "CScribbleDoc ;-)".

plaroche, is there any chance that if one command id is present in the CChildFrame class that's why i am unable to access it from CScribbleDoc.
 anyway i am still stuck as the option of adding message handler in CScribbleDoc is still not there.
waiting desperately for ur reply.
if u can reply on : aarya@cdotd.ernet.in , i will be grateful.
thanks in advance.

0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

Author Comment

by:aarya
Comment Utility
FOR GGRUNDY
well ggrundy i had checked the language thing its English (US) every where. ggrundy i feel there is some trivial thing that i am missing (like language thing) but still i am stuck . well i have explained the problem to plaroche in detail. please go through it and if possible reply me at
aarya@cdotd.ernet.in
****************************
For PLAROCHE
hi plaroche
nice of u to answer my query. plaroche like u said the criteria for adding the message handler in the particular class, i want to add it in the "CScrribleDoc" (document class).
i think what u have suggested should happen ideally. but if i choose the class in the leftmost listbox then the option of "all class members" appear in the middle list box and the list of all the members of the class are listed in the extreme last list box
but i don't see the command id "ID_EDIT_CLEAR" anywhere.

But i have noticed one thing that if "CChildFrame" is selected in extreme left list box then the list of all command ids are displayed in the middle list box (this includes "ID_EDIT_CLEAR_ALL" and other ids like "ID_EDIT_CUT",etc) and in the extreme right list box members are displayed if "all class members" is selected in the middle list box but if particular command id is chosen like 'ID_EDIT_CLEAR_ALL" then the option of "COMMAND" and "UPDATE_COMMAND_UI" appears. Well this is what i want to do with the "CScribbleDoc ;-)".

plaroche, is there any chance that if one command id is present in the CChildFrame class that's why i am unable to access it from CScribbleDoc.
 anyway i am still stuck as the option of adding message handler in CScribbleDoc is still not there.
waiting desperately for ur reply.
if u can reply on : aarya@cdotd.ernet.in , i will be grateful.
thanks in advance.



0
 
LVL 3

Accepted Solution

by:
plaroche earned 100 total points
Comment Utility
1)There is a combobox labeled "Class Name", in that one select CScribbleDoc.

2) There is a listbox, at the left labeled "Object IDS", in this one you should see ID_EDIT_CLEAR_ALL (or the id you want to find). Select it.

3) Then add the ON_COMMAND handler.

If you don't see that ID for CScribbleDoc but do for CChilFrame then something is wrong with your classwizard. Try the following steps:
1) Close devstudio
2) Erase the CLW file located in your project's main directory.
3) Restart devstudio and load your project.
4) Access classwizard. Devstudio will complain, tell it to regen the missing file. Click OK on the next dialog.
5) Re-try the above solution.

0
 

Author Comment

by:aarya
Comment Utility
Adjusted points to 100
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
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.
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

728 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

9 Experts available now in Live!

Get 1:1 Help Now