|
|
I know that, but I didn't find the wrapper (command-handler member function) for these messages in the CMenu class, e.g the command-handler member function for WM_CREATE is OnCreate etc. My idea is to inherit a class from CMenu and add the message handler-functions for these messages, is that correct?
|
|
|
|
|
Have you tried via ClassWizard (Ctrl+W)?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
What do you mean with "via ClassWizard"? Creating a class inherited from CMenu?
When I tried to adding an event handler to the menu resource via the Event Handler Wizard I only found the messages COMMAND and UPDATE_COMMAND_UI
|
|
|
|
|
blackbondi wrote:
What do you mean with "via ClassWizard"?
Via means by way of.
blackbondi wrote: Creating a class inherited from CMenu?
Among other things, like adding member/control variables, and creating event handlers.
blackbondi wrote: When I tried to adding an event handler to the menu resource via the Event Handler Wizard I only found the messages COMMAND and UPDATE_COMMAND_UI
The list of messages will depend on what object you currently have selected. For you to only be seeing COMMAND and UPDATE_COMMAND_UI, you probably have a menu item selected.
What version of Visual Studio are you using?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Yes but like so I can't add the event handler for the two messages I want. The version is Visual Studio 2008.
|
|
|
|
|
I even can't inherit a class from CMenu via ClassWizard, because it isn't listed in the "Base class" combobox
|
|
|
|
|
It depends to your work,what do you need?
|
|
|
|
|
I want to implement the messages.
WM_MENURBUTTONUP
WM_MENUDRAG
thx
|
|
|
|
|
|
Hi,
For static menus built during compile time we have to use this macro to map a contiguous range of command IDs to a single message handler function:
ON_COMMAND_RANGE(id1, id2, memberFxn)
But I have a dynamic menu based on database, I use for the item's ID the primary key of the corresponding record. The problem is: I don't know the range of these command IDs, because it's dynamic as I said. Please help me.
Thx
bondi
|
|
|
|
|
I need help with following problem:
I created new project with two Windows Forms called Form1 and Form2. Now, I put on each Form one Button and one Text Box.
The main Form is Form1 which I start the program. When I click Button1, Form2 shows and into Textbox1 in Form2 it puts some text. To do this in Form1 I added code:
#include "Form2.h"
...
private: Form2^ form2;
...
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e)
{
form2 = gcnew Form2();
forma2->textBox1->Text="sometext";
forma2->Show();
}
Everything works fine, but..... Now I want do the same in opposite direction. I want to click on Button1 on Form2 and put some text into textbox1 on Form1. How to do this????
I cannot add in Form2 #include "Form1" because it will not compile(There are some errors)
Please help me with this "simple" problem.
Best regards
Szymon
|
|
|
|
|
szymon79 wrote: I cannot add in Form2 #include "Form1" because it will not compile(There are some errors)
Please help me with this "simple" problem.
Your problem is not specific to forms or buttons. You simply do not understand how to include files and design code for inter operation of classes. You should refer to some beginner tutorials or books as a means of learning about fundamental issues such as this. Using text messaging will prove extremely inefficient for this purpose.
In the future, if you have questions about C++ .NET development use the Managed C++/CLI forum
Also take the time to read posting guidelines for CodeProject
|
|
|
|
|
What book for beginner would you propose?
I took this kind of operation using #include and gcnew from "Beginning Visual C++ 2005, WROX, Ivor Hortons".
It works only in one direction between Forms. There was nothing how to comunicate with two directions. I used to programming using Borland C++ Bulider. It was much easier to comunicate, because there was one main cpp file. I included only header files in this one file.
Using Visual C++ all code for each Form is wrote in seperate headers files. So it makes me confused after all...
Thanks
Szymon
|
|
|
|
|
szymon79 wrote: What book for beginner would you propose?
That's a good question. Unfortunately since I have not read any beginner books for many years I have no current knowledge of them. Use the CodeProject Site menu ( on the left of the page) and look under "General Reading" you will see "Book Reviews". If you don't find anything useful in there I suggest you post a new question about beginner book recommendations. Keep in you have some basic C++ fundamental hurdles you need to cross before heading into C++ .NET development. I say this because I imagine most C++ .NET material will not address basic C++ fundamentals rather they will assume a working knowledge of basic C++ concepts.
|
|
|
|
|
|
Hey Mark, congrats on your MVP Well done.
Now get the hell out of my thread!
|
|
|
|
|
|
Mark Salsbery wrote: In my defense....you weren't here in the thread when I was typing
I knew that of course because I saw the time difference, see I'm not as dumb as you think, pretty close though.
Mark Salsbery wrote: Right back at ya
Yeah that was unexpected, I always figured last year was a fluke. I guess I need to increase my level of sarcasm
|
|
|
|
|
led mike wrote: I knew that of course because I saw the time difference
I knew you knew that....I thought you'd wonder how
it took me two minutes to post two links LOL
Cheers,
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
led mike wrote: I guess I need to increase my level of sarcasm
Please, no dark sarcasm in the classroom.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
[my articles]
|
|
|
|
|
Leave those kids alone!
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
...Ooops, ...Sorry!
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
[my articles]
|
|
|
|
|
Hi friends, I want to play some MP3 files in my application, plz tell me how can I do that.
Apurv
|
|
|
|
|
Good option is MCI functions and you can find good articles about it on the codeproject.
|
|
|
|