TheSwamp

Code Red => ARX Programming => Topic started by: It's Alive! on November 01, 2006, 12:29:11 PM

Title: .NET mix managed code support
Post by: It's Alive! on November 01, 2006, 12:29:11 PM
When setting up a new ObjectARX project and using the wizards there is an option for  .NET mix managed code support. I see this on both VS2002 and VS2005. What is this used for? Why would one choose this option?  I am just doing research on ObjectARX so any information would be helpful. 

Thanks a Ton
Daniel
Title: Re: .NET mix managed code support
Post by: LE on November 01, 2006, 01:09:37 PM
Yes;

I have seen it, but not used that option, I guess you need to do a search about this, into the adesk ARX and find out what Cyrille Fauvel has posted about it (.net mixed managed code support).

HTH
Title: Re: .NET mix managed code support
Post by: Draftek on November 01, 2006, 01:15:40 PM
You can wrap your object (or code) so it's exposed to .net basically making it a managed class.

I suspect that's exactly how the objectarx .net managed classes were created.
Title: Re: .NET mix managed code support
Post by: MickD on November 01, 2006, 02:38:21 PM
basically what Draftek said above, you can wrap existing classes or functions into managed classes for use with .net.
You can also call native code from your managed classes (this is how you wrap them after all), say you want to use winforms in mc++, you can call native functions from event handlers say all in the same module.
If you want to study up more on this have a search in the help doc's for 'It Just Works', this was done for this very reason, to integrate and help port existing native code into managed code.
There should also be a sample mixed arx project in the help I think, maybe if you include the necessary file you can do a 'go to definition/declaration' and see how some marshaling is being handled.
hth.
Title: Re: .NET mix managed code support
Post by: It's Alive! on November 04, 2006, 12:34:19 PM
Thanks for the replies. It does seem the main purpose is for porting applications. I just wanted to know if could have the best of both worlds As Mick touched on using winforms.

Thanks
Title: Re: .NET mix managed code support
Post by: Nikolay Poleshchuk on November 08, 2006, 12:58:15 AM
Here is an example of .NET mixed mode support for using Windows Forms in C++ (ARX): http://poleshchuk.spb.ru/cad/2006/TrSplashe.htm
You can download sample projects from http://poleshchuk.spb.ru/cad/Downloade.htm
The sample application creates temporary splash screen window.
Title: Re: .NET mix managed code support
Post by: Chuck Gabriel on November 08, 2006, 07:54:51 AM
Welcome to the swamp Nikolay.
Title: Re: .NET mix managed code support
Post by: LE on November 08, 2006, 09:13:17 AM
Welcome to the swamp Nikolay.

Ditto ^^ x 2
Title: Re: .NET mix managed code support
Post by: It's Alive! on November 08, 2006, 12:23:04 PM
Hey thatís fantastic. I will have to study the samples :)
Welcome to the Swamp Nikolay! Hey youíre the author!
Where can I buy your books? I canít read Russian but I can learn from the examples 

Daniel

Edit I need to learn to spell too /edit
Title: Re: .NET mix managed code support
Post by: Nikolay Poleshchuk on November 08, 2006, 12:52:37 PM
Hey thatís fantastic. I will have to study the samples :)
Welcome to the Swamp Nikolay! Hey youíre the author!
Where can I by your books? I canít read Russian I can learn from the examples 

Daniel
Hi friends! Thank you.
Daniel, you can buy my books in the Russian Internet shop: http://www.ozon.ru/english
Title: Re: .NET mix managed code support
Post by: mjguzik on November 20, 2006, 08:18:46 PM
One thing that I haven't been able to overcome with .net is using winforms from a network share.  Everything from the autocad command prompt works fine from a share, yet introduce a winform and you get prompted for security.  Therefore it will have to be a local or on a trusted share.  Otherwise it seems much more powerful than lisp and VBA.  Just my two cents.
Title: Re: .NET mix managed code support
Post by: Nikolay Poleshchuk on November 21, 2006, 02:16:20 AM
Everything from the autocad command prompt works fine from a share, yet introduce a winform and you get prompted for security. 

Yes, I found this problem too.
Title: Re: .NET mix managed code support
Post by: Chuck Gabriel on November 21, 2006, 08:02:45 AM
One thing that I haven't been able to overcome with .net is using winforms from a network share.  Everything from the autocad command prompt works fine from a share, yet introduce a winform and you get prompted for security.  Therefore it will have to be a local or on a trusted share.  Otherwise it seems much more powerful than lisp and VBA.  Just my two cents.

Look in Control Panel -> Administrative Tools.  There should be a .NET Framework Configuration control panel in there.  Open it and browse down to "Runtime Security Policy."  Click on "Adjust Zone Security."  Select whether you want your changes to apply to the local machine or the current user.  In the next dialog, select "Local Intranet," and set the trust level to "Full Trust."

Now any assembly loaded from a share on the LAN (or a web page on your Intranet) will have the same security privileges as if it were located on your local machine.

[edit]
Now that I've written all that out and re-read your original post, I think I probably haven't told you anything you didn't already know.
[/edit]
Title: Re: .NET mix managed code support
Post by: Aerdvark on June 01, 2010, 07:52:20 AM
Here is an example of .NET mixed mode support for using Windows Forms in C++ (ARX): http://poleshchuk.spb.ru/cad/2006/TrSplashe.htm
You can download sample projects from http://poleshchuk.spb.ru/cad/Downloade.htm
The sample application creates temporary splash screen window.

I know this is an old topic, but since it appears on top of the list, when I reply to it, and it is all new to me I guessed it would be no problem to post...

The link (above to Nikolays code) got my attention. I like the idea of creating a splash screen of my own. Leave AutoCAD's splas screen as it is but once the program is loaded, it would be nice to show a custom splash screen "Aerdvark" for I made a lot of menu's in AutoCAD. This would give a nice personal touch for me.

But anyway, there is so much that I do not get, the real basic stuff on C# / C++ / VB.NET etc.

Is somebody interested in helping me to understand the code or maybe to help me create what I need? My goal in the end would be as I said: a personal splash screen. Not too Difficult.... like the transparent green one but with my text in there "Aerdvark".

THanks in advance for those who are willing to help me out.
Title: Re: .NET mix managed code support
Post by: Nikolay Poleshchuk on June 01, 2010, 09:01:10 AM
Replace the line in Splash16.cpp:

pTxt1->Text = S"Book16";

to

pTxt1->Text = S"Aerdvark";

Title: Re: .NET mix managed code support
Post by: Aerdvark on June 02, 2010, 01:50:42 AM
Replace the line in Splash16.cpp:

pTxt1->Text = S"Book16";

to

pTxt1->Text = S"Aerdvark";


Hello Nikolay, and thanks for helping me out.
As I said I am not much of a programmer, so .NET might be much too big for me.
But I need to start somewhere I guess... So here I am with some basic questions.

I thought the *.arx file is all I need. So now I figure, the seperate files are all partial files that become an *.arx once they are compiled.
Am I right?

For if I only change that .cpp file and then load the *.arx nothing happens...

And how are those *.arx files created? I guess the *.arx files are C++ / C# / VB.NET ...?
Is the program to create these files Visual Studio?

I have read a lot about it but putting it in my own words (and understanding) will give me some more insight.

Please be gentle on me in case my questioning is stupid.
Thanks.
Title: Re: .NET mix managed code support
Post by: Nikolay Poleshchuk on June 02, 2010, 08:37:15 AM
You need Microsoft Visual Studio to compile and link the project and get a new arx file. Version of Visual Studio must correspond to the version of AutoCAD.
Look at http://www.private.peterlink.ru/poleshchuk/cad/2010/TrSplashCse.htm - you will find the version in C#.

I think that the following connection will be more convenient by email (see my email address at

http://www.private.peterlink.ru/poleshchuk/cad/maile.htm )

Regards
Title: Re: .NET mix managed code support
Post by: ahlzl on June 10, 2010, 02:08:09 AM
to daniel: look thisÖÖSDK\samples\entity\SimpleSquare