indiocolifa
October 22nd, 2004, 11:56 AM
How I can access MIDI ports through C#?
I think that I must access Win32 MIDI APIs.
thanks.
I think that I must access Win32 MIDI APIs.
thanks.
|
Click to See Complete Forum and Search --> : MIDI in C# indiocolifa October 22nd, 2004, 11:56 AM How I can access MIDI ports through C#? I think that I must access Win32 MIDI APIs. thanks. darwen October 22nd, 2004, 04:19 PM How many people should learn C++.NET ? I dunno. If you do this then everything you can do in C++ you can also do for .NET. It is SO POWERFUL ! Otherwise you're looking at hacking about with interop in C# and taking twice as long to do it as it takes in C++. Oh well.... nobody ever listens to poor old Darwen (sob). Darwen. indiocolifa October 22nd, 2004, 04:27 PM darwen, i'm currently learning C# altough I know C/C++/Win32 API rather well. Its possible to do old-school API calls mixed with managed code? Can you give me a very short (an easy to write for you, I dont want you blaming me :p ) example? Wow, this would be VERY NICE. Thanks a lot darwen October 22nd, 2004, 05:40 PM OK, simplest way of doing this : (1) I'm assuming you have C++.NET (2) File/New project/Managed C++ Class Library (find the item). (3) Click ok. This will create a project with a default class called Class1. If you compile this up, and add the dll produced as a reference to C# then - you can see Class1 in C# ! OOh. Wonderful. OK, now all you really need to know is (1) You can mix native & managed code without a problem. However, the best way of doing this is to write a class in native and then use this class in your managed class. (2) Any class with "public __gc <classname>" will be visible to C#. Play with it, and I think you're going to find it is wonderfully powerful. Everything works - don't worry. Microsoft have done a fanstastic job. OK - now the design side of things. Everything in managed should be kept to managed and everything in native should be kept to native. You should interface between the two in destinct ways, and not mix the two up all over the place. To do namespaces do like this : System::Drawing::Graphics etc. Bear in mind everything in .NET is a pointer and needs to be newed e.g. System::String *psString = new System::String(); or System::IO::StreamReader *pStreamReader = new System::IO::StreamReader(...); If you have any problems look at the excellent articles about VC++.NET on this website - go to the CG main site and look at the VC++ Nuts and bolts section. There's a huge amount of support for VC++.NET - so go and use it ! Once you know it questions like you're asking will be a thing of a past - you'll be able to (like myself) just jump into C++ and do whatever you want. Now this IS NOT A SHORTCUT TO KNOWING THE .NET FRAMEWORK CLASSES. It's an ability to do things that they do not support. If there is a class in the .NET framework which does what you want, use it. It will be considerably more efficient than trying to link to unmanaged code. And design wise, it's a bad thing to do. Have fun, I did. It takes a while to get used to it but from my previous experience in the forums answering questions from yourself I think you'll be fine. Darwen. indiocolifa October 22nd, 2004, 10:17 PM yes, Indeed I learned to properly route events in C# and i'm learning fast! Seems that i'll use C++ just for critical parts, not for an entire .NET framework based applications. C# syntax is so good. But I like the old and trusty C++ ! See that I'm not with a firm decision yet. ;) 2) Did you've tried the C++ 2005 beta? Regards, Hernan indiocolifa October 22nd, 2004, 10:28 PM Sorry, darwen but tell me if i'm understanding well I could implement a C++ managed DLL involving the Win32 MIDI interface. Compile up and use in C#? mmm.. that would be powerful, yess.... For what things are you using c++ and for what c#? thank you for your comments! darwen October 23rd, 2004, 06:15 AM Yep, no problems. C++.NET wouldn't be much use if you couldn't really.... In actual fact I've written all my modem (TAPI) code in C++ and then added a managed C++ wrapper so I can use it in C# projects. I tend to keep the amount of C++ to a bare minimum- because if Microsoft do release the functionality in .NET that I've had to implement in C++ all I need to do is to replace the assembly with a C# assembly with the same classes in it. Darwen. codeguru.com
Copyright Internet.com Inc., All Rights Reserved. |