Click here to Skip to main content
15,917,642 members
Home / Discussions / C#
   

C#

 
GeneralRe: Concatenating 2 string arrays Pin
Jeff Varszegi30-Oct-03 14:46
professionalJeff Varszegi30-Oct-03 14:46 
QuestionHow to take input in a password file? Pin
Anonymous28-Oct-03 20:07
Anonymous28-Oct-03 20:07 
AnswerRe: How to take input in a password field? Pin
Anonymous28-Oct-03 20:09
Anonymous28-Oct-03 20:09 
AnswerRe: How to take input in a password file? Pin
Heath Stewart29-Oct-03 11:27
protectorHeath Stewart29-Oct-03 11:27 
QuestionHow to thread? Pin
Anonymous28-Oct-03 18:39
Anonymous28-Oct-03 18:39 
AnswerRe: How to thread? Pin
Jeremy Kimball29-Oct-03 2:00
Jeremy Kimball29-Oct-03 2:00 
GeneralPosting back datagrid web control values Pin
Ismael Chivite28-Oct-03 17:04
Ismael Chivite28-Oct-03 17:04 
GeneralStringBuilder, byte[], lpstr, interop Pin
Tym!28-Oct-03 14:18
Tym!28-Oct-03 14:18 
Can't quite get this right. I have:
<br />
[StructLayout(LayoutKind.Sequential)]<br />
	public struct MIDIHDR <br />
	{<br />
		[MarshalAs(UnmanagedType.LPStr)]<br />
		public String			Data;<br />
		public uint			Length;<br />
		public uint			RecBytes;<br />
		public uint			User;<br />
		public uint			Flags;<br />
		public uint			Next;<br />
		public uint			reserve;<br />
		public uint			Offset;<br />
		public uint			Reserved;<br />
	}<br />


I am having problems getting the right MIDIHDR.data value, I think. I am building the data as follows:

I am building the string with a StringBuilder object.
I StringBuilder.Append() anywhere from 4 to 16 bytes.
I set MIDIHDR.data = StringBuilder.ToString() and
MIDIHDR.Length = StringBuilder.Length

When I test it by sending the MIDIHDR to a midiOutLongMsg call, I have gotten either no sound, or the same, wrong note, no matter what string I send.

example bytes {153, 41, 127, 0}
StringBuilder.ToString() outputs "153411270"
with a length of 9


What i believe this is doing is converting the byte with a value of 153 to a string of length 3 ("153"). Is there a way to build this string as just the 4 bytes? Can I, for example, cast the byte to char before appending to the string? Am I gonna have problems with the unicode/ansi conversion in the string and it's length as its size in the struct??? Or is the marshalling of the struct really taking care of all this and I just have an error elsewhere?
( I may not understand the proper way to use midiOutLongMsg() to send multiple ShortMsg's simultaneously...)

I was making headway with marshalling/interop and have been successful with everything but this.Confused | :confused: I have used the same byte data to successfully make calls to midiOutShortMsg. The bytes are actually stored in a struct of 4 bytes coerced into a union as an int. So it would be neat if I could just build the string using this int value to represent the 4 bytes, but for now I just wanna get it to work.

i am going to keep playing and researching, but I thought I'd stick the question here to see if I get a nibble.

Any help or insight would be greatly appreciated!

Thanks!
Tym!



Make love, not chocolate chip cookies with nuts.
At least make the cookies without nuts for crying out loud.
GeneralRe: StringBuilder, byte[], lpstr, interop Pin
Jeremy Kimball29-Oct-03 1:40
Jeremy Kimball29-Oct-03 1:40 
GeneralRe: StringBuilder, byte[], lpstr, interop Pin
Tym!29-Oct-03 6:28
Tym!29-Oct-03 6:28 
GeneralRe: StringBuilder, byte[], lpstr, interop Pin
Tym!29-Oct-03 14:12
Tym!29-Oct-03 14:12 
GeneralRenaming a File Pin
deanoA28-Oct-03 14:09
deanoA28-Oct-03 14:09 
GeneralRe: Renaming a File Pin
Nick Parker28-Oct-03 14:21
protectorNick Parker28-Oct-03 14:21 
GeneralSuper Lame QOTD (Stripping Paths) Pin
MKlucher28-Oct-03 11:56
MKlucher28-Oct-03 11:56 
GeneralRe: Super Lame QOTD (Stripping Paths) Pin
Kentamanos28-Oct-03 12:25
Kentamanos28-Oct-03 12:25 
GeneralRe: Super Lame QOTD (Stripping Paths) Pin
MKlucher28-Oct-03 12:40
MKlucher28-Oct-03 12:40 
GeneralRe: Super Lame QOTD (Stripping Paths) Pin
Kentamanos28-Oct-03 12:43
Kentamanos28-Oct-03 12:43 
GeneralRe: Super Lame QOTD (Stripping Paths) Pin
Heath Stewart28-Oct-03 16:40
protectorHeath Stewart28-Oct-03 16:40 
GeneralRe: Super Lame QOTD (Stripping Paths) Pin
Kentamanos29-Oct-03 5:46
Kentamanos29-Oct-03 5:46 
GeneralRe: Super Lame QOTD (Stripping Paths) Pin
James Simpson30-Oct-03 5:10
James Simpson30-Oct-03 5:10 
GeneralRe: Super Lame QOTD (Stripping Paths) Pin
Nick Parker28-Oct-03 14:27
protectorNick Parker28-Oct-03 14:27 
GeneralRe: Super Lame QOTD (Stripping Paths) Pin
Heath Stewart28-Oct-03 16:42
protectorHeath Stewart28-Oct-03 16:42 
GeneralBlocking move of a form Pin
phimix28-Oct-03 6:54
phimix28-Oct-03 6:54 
GeneralRe: Blocking move of a form Pin
Blake Coverett28-Oct-03 7:45
Blake Coverett28-Oct-03 7:45 
GeneralRe: Blocking move of a form Pin
phimix29-Oct-03 4:40
phimix29-Oct-03 4:40 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.