Using the designer to create the main form for an application generated the following code in the .cpp file:
int APIENTRY _tWinMain(HINSTANCE hInstance,
System::Threading::Thread::CurrentThread->ApartmentState = System::Threading::ApartmentState::STA;
The DataForm class has a button which generates a new form:
linkedForm = new LinkedForm() ;
The LinkedForm class exists in the same namespace as the DataForm class.
What needs to be done to allow this child form to see public methods in it's parent, since a DataForm ptr cannot be declared globally? Are there any examples of parent/child form communications of this nature?
See the MVC (Model-View-Controller) design pattern. It is on Wikipedia. Forms are Views and should not be coupled. Views (Forms) should access a "Controller" to initiate action based on UI (User) events. Views subscribe to events exposed from the "Model" to be notified of data and/or "state" changes. Views then obtain the latest data to display from the "Model".
Mainly because so many things which I know about C++ don't seem to apply in the .Net environment. I'm doing Managed Devlopment in C++ because I wasn't allowed to choose the development environment. I would have chosen Java, which is much more straightforward. But since you're now getting snide, I guess you've helped me enough--thanks for your time.
Not at all. So many times in message based communications people leave out reasons for things that create gaps in understanding. I was just trying to understand how you arrived in your situation to see if a different view might help. It does not appear so.
I would have chosen Java, which is much more straightforward.
Much more straight forward than Managed C++ but very similar to C#. Perhaps you could use C# Research apps as a way of learning the .NET libraries you need and then translate your own C# code into managed C++. That would also allow you to apply samples you can find to the C# research application. It's not real pretty but after time you probably won't need the C# step as you would be able to translate the samples directly to C++.
Also on the MSDN2 web site many of the .NET Framework Documentation contains short samples in C++.
I've got a rather strange question that I've been trying to figure out. Perhaps some of you can give me some hints.
I'd like to call a java method from C++ (or any other language for that matter). The java method is compiled into a java bean which is contained in an applet. I've got no control over the applet and I have full control over the bean which contains a callback method to the applet. This is the method i'd like to call, is it possible?
hi everybody.I am newbie in managed c++.I have few questions for you.how do i send data to serial port with using event handler. Before sending the data, do I need to create an object class for serial port or is it already in windows library.I mean in .NET 2005 with framework 2.0 there is a namespace System::IO::Port but I use framework 1.1 with .net 2003 and i haven`t find something like that.
I post what I write below without comments sorry about it
Moreover when the mouse cursor is in the panel coordinates cpu usage rises 100% what should i do to decrease that usage
thanks a lot for your help
Note: Sorry about my pour english
public __gc class Form1 : public System::Windows::Forms::Form
panel1->MouseUp += newMouseEventHandler(this,Joystick_MouseUp);
panel1->MouseMove += new MouseEventHandler(this,Joystick_MouseMove);
panel1->MouseDown += new MouseEventHandler(this,Joystick_MouseDown);
this->g = e->Graphics;
GraphicsPath* serge = new GraphicsPath();
SolidBrush *sb = new SolidBrush(Color::Cornsilk);
SolidBrush *sb2= new SolidBrush(Color::Blue);
this->panel1->Region = new System::Drawing::Region(serge);
// in order to solve flickering i have to use double buffering
this->SetStyle( ControlStyles::AllPaintingInWmPaint, true);
this->SetStyle( ControlStyles::UserPaint, true);
this->SetStyle( ControlStyles::DoubleBuffer, true );
I have a project where by I define a pre-processor variable entitled PROEDITION. In the project where I define this variable some .cpp files seem to understand that the variable PROEDITION has been defined. Unfortunately one of the most important .cpp files does not seem to pick up this pre-processor variable. Is there a reason why this would happen? It's not just this pre-processor variable, it could be any of them that I define at project scope. It just seems that one of my .cpp files does not understand the pre-processor variables at all.
Is the last separator a ":" or a ";"? I am asking because there is a smiley there and I am not sure if this forum uses (thats a test - Semicolon P) as a smiley or :P (another test - Colon P) or maybe both.
Yeah, it's the wierdest thing. I mean it uses precompiled headers via stdafx.h
I am not sure why this is not working. The other thing that is sort of unique is that the MIDL compiler has a preprocessor variable as well. I don't think that should matter though, but I am pretty sure that is rare.
The IDL is compiling correctly though with the preprocessor doing what it should.
Can anyone tell me how can I overcome the following error:
Error 39 error C2440: '=' : cannot convert from 'void *' to 'System::Data::DataColumn ^'
Here is the code which is generating error:
CPtrList* MYpclFields; // this is working fine
POSITION MYposField; // is having the right value
DataColumn^ pColumnInfo; // System::Data::DataColumn object
pColumnInfo = MYpclFields->GetNext (MYposField); // error lies here
actually GetNext() fn. returns a (void *) and I want to convert that into (DataColumn^).