Running into issue of managed and unmanaged code
-
Hi, I'm using VC ++ , Visual studio 2010 express edition. And trying to create simple form application, and a thread and some control classes in my application. 1) But whenever I try to crate a thread class which is derived from "CbaseThread" class, I always get an error .. " Unmanaged class can't derive from a managed Class " 2) If I try to make my thread class as managed, then I can't derived from "CbaseThread", since the class becomes sealed . 3) In one of the control class I need a reference to "FORM1", which is created inside Application.Run (gcnew Form1()).. Even getting this reference is also not possible. Can anyone please help me.. I can completely manage with "Unmanaged Code.." How can I have just unmanaged code throughout my application. If having only unmanaged code is not at all possible, how can i solve above mentioned problem. ie working with both managed and unmanaged code together. Thanks in advance. Regards, Vijay.
-
Hi, I'm using VC ++ , Visual studio 2010 express edition. And trying to create simple form application, and a thread and some control classes in my application. 1) But whenever I try to crate a thread class which is derived from "CbaseThread" class, I always get an error .. " Unmanaged class can't derive from a managed Class " 2) If I try to make my thread class as managed, then I can't derived from "CbaseThread", since the class becomes sealed . 3) In one of the control class I need a reference to "FORM1", which is created inside Application.Run (gcnew Form1()).. Even getting this reference is also not possible. Can anyone please help me.. I can completely manage with "Unmanaged Code.." How can I have just unmanaged code throughout my application. If having only unmanaged code is not at all possible, how can i solve above mentioned problem. ie working with both managed and unmanaged code together. Thanks in advance. Regards, Vijay.
What is CBaseThread?
Vijay Sringeri wrote:
In one of the control class I need a reference to "FORM1", which is created inside Application.Run (gcnew Form1())..
Move the definition from the Run method to a place where you have access to it.
Vijay Sringeri wrote:
How can I have just unmanaged code throughout my application.
Don't use Windows Forms and make your project an unmanaged c++ project. Windows Forms is part of the .Net framework so has to use managed code.
Mark Salsbery :java: