API + MIDI in C# 
Author Message
 API + MIDI in C#

I have some problems with the midiOutGetErrorText API using CSharp (VS.NET
beta 2):

[DllImport( "winmm.dll")]
private static extern int midiOutGetErrorText(int err, ref string lpText,int
uSize);

Everytime I call the function (using something like below) I get the "We are
sorry for the inconveniance" error screen in XP.

int result;
int OutErr = 8;   // Just as an exemple to retrieve error #8
int MAXERRORLENGTH = 128; //Lenght of the return string
string strMsg = new String('*',MAXERRORLENGTH); // The function is supposed
to return the error text in this string
//Now I call the function and I get the error screen
result = midiOutGetErrorText(OutErr, ref strMsg, MAXERRORLENGTH);

I also tried without the "ref" keyword and it doesn't work as it returns the
exact same string (but I don't get the error).

I have no problem at all with other MIDI functions like midiOutOpen,
midiGetDevCaps and so on... They all work great except the
midiOutGetErrorText.

Any help will be appreciated
Marc



Tue, 28 Sep 2004 14:01:36 GMT  
 API + MIDI in C#
use StringBuilder, like sample:
  ...FrameworkSDKPath...\Samples\Technologies\Interop\PlatformInvoke\WinAPIs\CS
Quote:

> I have some problems with the midiOutGetErrorText API using Csharp (VS.NET beta 2):
> [DllImport( "winmm.dll")]
> private static extern int midiOutGetErrorText(int err, ref string lpText,int uSize);



Tue, 28 Sep 2004 20:22:33 GMT  
 API + MIDI in C#
Thanks for the help!
I didn't know about the class and I feel like it will be very handy in other
apps too!

Marc


Quote:
> use StringBuilder, like sample:

...FrameworkSDKPath...\Samples\Technologies\Interop\PlatformInvoke\WinAPIs\C
S


Wed, 29 Sep 2004 02:41:01 GMT  
 API + MIDI in C#
Hi Marc, glad you got your answer.  Q: would you be willing to share some
simple examples for invoking MIDI API calls in C# (playing individual or
groups of notes against a specific device would be cool)?  I posted a
question about this several days ago, and the only response I got was
someone else also wanting to know!

Thanks,
Richard


Quote:
> I have some problems with the midiOutGetErrorText API using Csharp (VS.NET
> beta 2):

> [DllImport( "winmm.dll")]
> private static extern int midiOutGetErrorText(int err, ref string
lpText,int
> uSize);

> Everytime I call the function (using something like below) I get the "We
are
> sorry for the inconveniance" error screen in XP.

> int result;
> int OutErr = 8;   // Just as an exemple to retrieve error #8
> int MAXERRORLENGTH = 128; //Lenght of the return string
> string strMsg = new String('*',MAXERRORLENGTH); // The function is
supposed
> to return the error text in this string
> //Now I call the function and I get the error screen
> result = midiOutGetErrorText(OutErr, ref strMsg, MAXERRORLENGTH);

> I also tried without the "ref" keyword and it doesn't work as it returns
the
> exact same string (but I don't get the error).

> I have no problem at all with other MIDI functions like midiOutOpen,
> midiGetDevCaps and so on... They all work great except the
> midiOutGetErrorText.

> Any help will be appreciated
> Marc



Wed, 29 Sep 2004 03:33:21 GMT  
 API + MIDI in C#
Hi Richard,

I don't mind at all to share code with you and other people. Right now I'm
making a class in C# that will have a lot of the MIDI functions (as I don't
know the existence of anything like it yet). If you have specific questions
just send me an email and I will be glad to help.

Marc



Quote:
> Hi Marc, glad you got your answer.  Q: would you be willing to share some
> simple examples for invoking MIDI API calls in C# (playing individual or
> groups of notes against a specific device would be cool)?  I posted a
> question about this several days ago, and the only response I got was
> someone else also wanting to know!

> Thanks,
> Richard



Thu, 30 Sep 2004 02:01:46 GMT  
 API + MIDI in C#
Sorry my email got mixed up in my previous post. You can send your questions

Regards,
Marc



Thu, 30 Sep 2004 02:10:55 GMT  
 API + MIDI in C#


Wed, 18 Jun 1902 08:00:00 GMT  
 API + MIDI in C#


Quote:
> Sorry my email got mixed up in my previous post. You can send your
questions

> Regards,
> Marc



Thu, 30 Sep 2004 02:17:50 GMT  
 API + MIDI in C#


Wed, 18 Jun 1902 08:00:00 GMT  
 API + MIDI in C#
Marc,

I tried emailing but it keeps returning so I'll post here... I'm also trying
to convert the MIDI API and Structs to C#... any change of sharing it with
me?

Thanks,
Shawn


Quote:
> Hi Richard,

> I don't mind at all to share code with you and other people. Right now I'm
> making a class in C# that will have a lot of the MIDI functions (as I
don't
> know the existence of anything like it yet). If you have specific
questions
> just send me an email and I will be glad to help.

> Marc



> > Hi Marc, glad you got your answer.  Q: would you be willing to share
some
> > simple examples for invoking MIDI API calls in C# (playing individual or
> > groups of notes against a specific device would be cool)?  I posted a
> > question about this several days ago, and the only response I got was
> > someone else also wanting to know!

> > Thanks,
> > Richard



Sat, 30 Oct 2004 07:09:59 GMT  
 API + MIDI in C#
He used an alias, try:
  http://groups.google.com/groups?selm=u3VkMax4BHA.2532%40tkmsftngp04

--
  NETMaster  (Thomas Scheidegger)
  http://www.cetus-links.org/oo_csharp.html

Quote:

> I tried emailing but it keeps returning so I'll post here... I'm also trying
> to convert the MIDI API and Structs to C#... any change of sharing it with
> me?



Sat, 30 Oct 2004 18:00:04 GMT  
 
 [ 11 post ] 

 Relevant Pages 

1. MIDI in API

2. API to play midi, mp3

3. API to play midi & mp3 file

4. Accessing the MIDI port in C#

5. MIDI I/O in C#

6. Game / midi port with C#

7. Windows API with C#

8. API functions in C#

9. Newbie C# api

10. How to map api event in C#?

11. (C)API problem C# dotnet

12. Call API functions(C#)

 

 
Powered by phpBB® Forum Software