|
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.
|
|
|
|
|
Hi all,
Is it feasible/possible/desirable to call a .NET DLL from an unmanaged VC6 MFC application?
TIA.
|
|
|
|
|
VC6?
More difficult.
With any recent version (Compiler version 7.1 = VC2003 is much much better than the braindead VC6 one!), you could quite simply devise a Bridge-DLL containing managed C++-code.
In VC6, this doesn't work. You probably could produce the Bridge-DLL with VC2003 and use it from your VC6 project....
Let's think the unthinkable, let's do the undoable, let's prepare to grapple with the ineffable itself, and see if we may not eff it after all. Douglas Adams, "Dirk Gently's Holistic Detective Agency"
|
|
|
|
|
Thanks for the info. That's not so good (for me!). How about accessing a VC6 MFC DLL from C# .NET?
|
|
|
|
|
I must admit I never did so.
I don't think it works, as the DLL and the application would link to different versions of the same classes.
But maybe this[^] can help you?
[edit]
A COM-Wrapper to the .NET-Part is a way in which you can access the managed code from VC6.
[/edit]
I am by no means an expert, just a user of Bridges devised by others. Sorry.
Let's think the unthinkable, let's do the undoable, let's prepare to grapple with the ineffable itself, and see if we may not eff it after all. Douglas Adams, "Dirk Gently's Holistic Detective Agency"
|
|
|
|
|
I think that a bridge DLL is what I need. Thanks for the help.
|
|
|
|
|
Steve_Harris wrote: I think that a bridge DLL is what I need.
Not when you are tied to VC6.
Let's think the unthinkable, let's do the undoable, let's prepare to grapple with the ineffable itself, and see if we may not eff it after all. Douglas Adams, "Dirk Gently's Holistic Detective Agency"
|
|
|
|
|
This [^] looks promising on the road of Yes/Yes/Yes.
[added]
of course I missed,
Steve_Harris wrote: VC6
(I got only VS )in your request. Uhm, as already pointed out by jhwurmbach, the road seems much more difficult then
[/added]
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]
modified on Thursday, January 10, 2008 11:00:39 AM
|
|
|
|
|
A bridging COM dll is the way to go but you probably won't be able to write it in VC6. From the VC6 side tlaking to a COM Dll is fine and from the .NET side COM Interop works really well but somewhere along the line you've got to write the COM interop code with a newer Visual Studio.
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
Yeah, I gathered that. If I could find some code that largely reproduced CScrollView in .NET, and let me show pages on-screen whose dimensions were lifted from the current printer settings, then I could go about updating the MFC code, but I've yet to find something that does that. *Sigh*
|
|
|
|
|
Hello,
I'm very interested in using Richard Stringer's Printing Class Library ( http://www.codeproject.com/KB/printing/printlib.aspx )to generate simple financial paper reports (numbers in a grid, essentially). This library, while very advanced, appears to be incapable of displaying multiple pages, or wrapping data onto a new page.
Has anyone had any success in using these classes to print multiple pages? Could someone suggest a class for printing arbitrarily lengthed financial data, complete with print preview?
Thanks a lot,
Sternocera
|
|
|
|