Re: szPname As String * MAXPNAMELEN (How to declare)
From: Sakharam Phapale (sphapale_at_annetsite.com)
Date: 10/07/04
- Next message: Husam: "Using VS 2003 bootstrapper plug-in....."
- Previous message: Bernie Yaeger: "Re: Web.Mail Problems"
- In reply to: Tom Shelton: "Re: szPname As String * MAXPNAMELEN (How to declare)"
- Next in thread: Tom Shelton: "Re: szPname As String * MAXPNAMELEN (How to declare)"
- Reply: Tom Shelton: "Re: szPname As String * MAXPNAMELEN (How to declare)"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 7 Oct 2004 17:09:48 +0530
Hi Tom,
Thanks for your reply. I have another query related to this.
I am using GlobalAlloc API to allocate memeory for structure "MIXERCONTROL"
And then I used following API function to get the mixer control iformation.
mixerGetLineControls(hMixer, mxlc, MIXER_GETLINECONTROLSF_ONEBYTYPE)
Everyhing goes right upto above statement.
Now I want to fill the allocated strucure by the pointer which returned by
above API function.
For that, I used API function CopyStructFromPtr(........)
Calling this function resulted application to crash without giving any
error.
I tried lot but I don't understand why?
Since the same code runs in VB6.0. well I am not been able to convert it to
.NET
Any Help will be really appriciated.
Thanks & Regards
Sakharam Phapale
"Tom Shelton" <tom@YOUKNOWTHEDRILLmtogden.com> wrote in message
news:ufgYzNErEHA.452@TK2MSFTNGP09.phx.gbl...
> On 2004-10-07, Sakharam Phapale <sphapale@annetsite.com> wrote:
> > Hi Tom,
> >
> > I am using the structure "MIXERLINE" which includes structure "TARGET".
> > I have used following statement
> > mxl.cbStruct = Len(mxl)
> >
> > This should gives me 168 as length of structure mxl which is "MixerLine"
> > type, but it gives me 68. It doesn't include the string variables.
> >
> > What is the reason?
> >
>
> User Marshal.SizeOf... This will give you the marshaled length, instead
> of the .NET length. (Does that makes sense?)
>
> > I am also using following API function which fills detail of mixer
control
> > in mxl structure which includs short and full name.
> >
> > ret = mixerGetLineInfo(hMixer, mxl, MIXER_GETLINEINFOF_COMPONENTTYPE)
> >
> > ret comes as 11. Above function doesn't work.
> >
>
> Are you declaring mixerGetLineInfo correctly? Should probably be:
>
> Public Declare Auto Function mixerGetLineInfo Lib "winmm.dll" _
> (ByVal hmxobj As System.IntPtr, _
> ByRef pmxl As MIXERLINE, _
> ByVal fdwInfo As Integer) As Integer
> >
> ><StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Auto)> _
> >
> > Public Structure Target
> >
> > Public dwType As Integer
> >
> > Public dwDeviceID As Integer
> >
> > Public wMid As Integer
> >
> > Public wPid As Int16
> >
> > Public vDriverVersion As Int16
> >
> ><MarshalAs(UnmanagedType.ByValTStr, SizeConst:=MAXPNAMELEN)> _
> >
> > Public szPname As String
> >
> > End Structure
> >
>
> According to MSDN, your wMid should also be Short or Int16. I would
> also verify the MMVERSION type - I'm assuming Int16 from the docs, but
> you never know...
>
> >
> >
> ><StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Auto)> _
> >
> > Public Structure MIXERLINE
> >
> > Public cbStruct As Integer
> >
> > Public dwDestination As Integer
> >
> > Public dwSource As Integer
> >
> > Public dwLineID As Integer
> >
> > Public fdwLine As Integer
> >
> > Public dwUser As Integer
> >
> > Public dwComponentType As Integer
> >
> > Public cChannels As Integer
> >
> > Public cConnections As Integer
> >
> > Public cControls As Integer
> >
> ><MarshalAs(UnmanagedType.ByValTStr, SizeConst:=MIXER_SHORT_NAME_CHARS)> _
> >
> > Public szShortName As String
> >
> ><MarshalAs(UnmanagedType.ByValTStr, SizeConst:=MIXER_LONG_NAME_CHARS)> _
> >
> > Public szName As String
> >
> > Public tTarget As Target
> >
> > End Structure
> >
> >
> > Waiting for your respose.
> >
> > Thanks
> >
> > Sakharam Phapale
> >
>
> The rest looks ok at first glance...
>
> --
> Tom Shelton [MVP]
- Next message: Husam: "Using VS 2003 bootstrapper plug-in....."
- Previous message: Bernie Yaeger: "Re: Web.Mail Problems"
- In reply to: Tom Shelton: "Re: szPname As String * MAXPNAMELEN (How to declare)"
- Next in thread: Tom Shelton: "Re: szPname As String * MAXPNAMELEN (How to declare)"
- Reply: Tom Shelton: "Re: szPname As String * MAXPNAMELEN (How to declare)"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|