I currently have a COM component (and source) that talks to a printer and also a hardware port through a Vendor supplied DLL that makes fairly low level calls, and was wondering if there is a reference for displaying how to create a Managed Assembly in C++ that can performed the unmanaged calls, but present a nice .Net interface for the other developers. It does lots of GetProcAddress and
I would prefer not to interop to my existing COM Component, because I am trying to get a clean project.
I could possibly do it in C#, but wondering if it would be better in managed C++?
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 );