Re: szPname As String * MAXPNAMELEN (How to declare)
From: Tom Shelton (tom_at_YOUKNOWTHEDRILLmtogden.com)
Date: 10/07/04
- Next message: Agnes: "Re: datagrid checkbox"
- Previous message: Agnes: "Simple Math function"
- In reply to: Sakharam Phapale: "Re: szPname As String * MAXPNAMELEN (How to declare)"
- Next in thread: Sakharam Phapale: "Re: szPname As String * MAXPNAMELEN (How to declare)"
- Reply: Sakharam Phapale: "Re: szPname As String * MAXPNAMELEN (How to declare)"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 07 Oct 2004 00:58:35 -0700
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: Agnes: "Re: datagrid checkbox"
- Previous message: Agnes: "Simple Math function"
- In reply to: Sakharam Phapale: "Re: szPname As String * MAXPNAMELEN (How to declare)"
- Next in thread: Sakharam Phapale: "Re: szPname As String * MAXPNAMELEN (How to declare)"
- Reply: Sakharam Phapale: "Re: szPname As String * MAXPNAMELEN (How to declare)"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|