Re: Question on Marshaling
From: Alex Feinman [MVP] (public_news_at_alexfeinman.com)
Date: 04/08/04
- Next message: Alex Feinman [MVP]: "Re: Copy Emulator Setting"
- Previous message: Lloyd Dupont: "Re: File extension: Flabbergasted"
- In reply to: Rodger Higgins: "Question on Marshaling"
- Next in thread: Rodger Higgins: "Re: Question on Marshaling"
- Reply: Rodger Higgins: "Re: Question on Marshaling"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 8 Apr 2004 00:19:46 -0700
Change the PInvoke definition to:
DllImport("Coredll.dll", SetLastError=true)]
public static extern bool ReadMsgQueue(
int hMsgQ,
byte[] lpBuffer,
int cbBufferLen,
out int lpNumberOfBytesRead,
int dwTimeout,
out int dwFlags ) ;
Adjust your parameters accordingly.
-- Alex Feinman --- Visit http://www.opennetcf.org "Rodger Higgins" <rhiggins@earthling.net> wrote in message news:O$myyTJHEHA.740@tk2msftngp13.phx.gbl... > I am trying marshal ReadMSgQueue on a Windows CE .NET platform. I am > using the following code: > > > ... > [DllImport("Coredll.dll", SetLastError=true)] > public static extern bool ReadMsgQueue( > int hMsgQ, > out byte[] lpBuffer, > int cbBufferLen, > out byte[] lpNumberOfBytesRead, > int dwTimeout, > out byte[] dwFlags ) ; > ... > > if ( !MsgQueue.ReadMsgQueue( hReadMsgQueue, out msg, 64, len, 0, flags ) ) > { > MessageBox.Show( "Err: " + MsgQueue.GetLastError() ) ; > } > else > { > Received.Items.Add( "OK" ) ; > UnicodeEncoding UEncoder = new UnicodeEncoding() ; > string msgString = UEncoder.GetString( msg, 0, msg.Length ) ; > > MessageBox.Show( msgString ) ; > } > > > The Received.Items.Add causes a general exception if its located after > the call to ReadMsgQueue. It appears to be related to marshaling the > lpBuffer parameter. What am I missing or doing wrong? > > Thanks > Rodger Higgins
- Next message: Alex Feinman [MVP]: "Re: Copy Emulator Setting"
- Previous message: Lloyd Dupont: "Re: File extension: Flabbergasted"
- In reply to: Rodger Higgins: "Question on Marshaling"
- Next in thread: Rodger Higgins: "Re: Question on Marshaling"
- Reply: Rodger Higgins: "Re: Question on Marshaling"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|