Desktop Functions: Smart Device Functions:
|
Search Results for "re" in [All]winmmC# Signature:VB.NET Signature:
Private Shared Function mciGetErrorString(ByVal dwError As Integer, ByVal lpstrBuffer As System.Text.StringBuilder, ByVal uLength As Integer) As Integer VB Signature:
Public Declare Auto Function mciGetErrorString Lib "winmm.dll" (ByVal errorCode As Integer, ByRef errorText As StringBuilder, ByVal errorTextSize As Integer) As Integer C# Signature:VB.NET Signature:
Private Shared Function mciSendString(ByVal command As String, ByVal buffer As StringBuilder, ByVal bufferSize As Integer, ByVal hwndCallback As IntPtr) As Integer VB Signature:
Declare Ansi Function mciSendString Lib "winmm.dll" Alias "mciSendStringA" (ByVal command As String, ByRef buffer As StringBuilder, ByVal bufferSize As Integer, ByVal hWndCallback As IntPtr) As Integer
StringBuilder returnstring = new StringBuilder();
mciSendString("set CDAudio door open", returnstring,127, IntPtr.Zero);
// Declare the notify constant
protected override void WndProc(ref Message m)
base.WndProc(ref m);
Dim returnstring As StringBuilder = New StringBuilder()
mciSendString("set CDAudio door open", returnstring, 127, IntPtr.Zero)
MsgBox(returnstring)
' Declare the notify constant
' It's is assumed this function is in a Form so Me points to the current instance of the form
Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message) 3: midiConnect C# Signature:
static extern UInt32 midiConnect(IntPtr hMidi, IntPtr hmo, IntPtr pReserved); VB Signature:
Declare Function midiConnect Lib "winmm.dll" (TODO) As TODO
return midiConnect(midiInputHandle, midiOutputHandle, IntPtr.Zero); C# Signature:
static extern UInt32 midiDisconnect(IntPtr hMidi, IntPtr hmo, IntPtr pReserved); VB Signature:
Declare Function midiDisconnect Lib "winmm.dll" (TODO) As TODO
return midiDisconnect(midiInputHandle, midiOutputHandle, IntPtr.Zero); 5: MIDIHDR C# Signature:
public uint bytesRecorded;
public IntPtr reserved;
public IntPtr[] reservedArray; VB Signature:
Declare Function MIDIHDR Lib "winmm.dll" (TODO) As TODO 6: midiInClose C# Signature:C# Signature:
private static extern MMRESULT midiInGetDevCaps(UIntPtr uDeviceID, ref MIDIINCAPS caps, uint cbMidiInCaps); 9: midiInOpen C# Signature:VB Signature:
Declare Function midiInOpen Lib "winmm.dll" (TODO) As TODO 10: midiInReset 11: midiInStart C# Signature:12: MIDIOUTCAPS C# Signature:
// values for wTechnology field of MIDIOUTCAPS structure
private const ushort MOD_SQSYNTH = 3; // square wave internal synth
private const ushort MOD_WAVETABLE = 6; // hardware wavetable synth
private const ushort MOD_SWSYNTH = 7; // software synth
// flags for dwSupport field of MIDIOUTCAPS structure
private const uint MIDICAPS_STREAM = 8; // driver supports midiStreamOut directly int result = midiOutGetDevCaps(deviceID, ref outCaps, Marshal.SizeOf(outCaps)); 13: midiOutClose C# Signature:VB Signature:
Declare Function midiOutClose Lib "winmm.dll" (ByRef phMidiOut As IntPtr) As Uinteger C# Signature:
public static extern MMRESULT midiOutGetDevCaps(UIntPtr uDeviceID, ref MIDIOUTCAPS lpMidiOutCaps, uint cbMidiOutCaps);
//Do whatever you want with the caps object here C# Signature:
static extern uint midiOutGetErrorText(uint mmrError, StringBuilder pszText, uint cchText); VB Signature:
Declare Function midiOutGetErrorText Lib "winmm.dll" (TODO) As TODO
public string GetErrorText(uint mmrError)
uint uiMMResult = midiOutGetErrorText(mmrError, sb, MAXERRORLENGTH + 1);
if (uiMMResult != MMSYSERR_NOERROR)
throw new Exception(string.Format("Failed to get error text for result {0}.", mmrError));
return sb.ToString(); 17: midiOutOpen C# Signature:VB Signature:
<DllImport("winmm.dll")> Shared Function midiOutOpen(ByRef lphMidiOut As IntPtr, ByVal uDeviceID As UInteger, ByVal dwCallback As IntPtr, ByVal dwInstance As IntPtr, ByVal dwFlags As UInteger) As UInteger The device should be disposed with midiOutClose when not needed anymore. 18: midiOutShortMsg C# Signature:VB Signature:
Declare Function midiOutShortMsg Lib "winmm.dll" (hMidiOut As Intptr,dwMsg As UInt32) As UInt32 19: midiStreamClose C# Signature:
extern static Int32 midiStreamClose(IntPtr hMidiStream); VB.NET Signature:
Public Declare Function midiStreamClose Lib "winmm.dll" (ByVal hMidiStream As IntPtr) As Integer 20: midiStreamOpen C# Signature:
extern static Int32 midiStreamOpen(ref IntPtr hMidiStream, ref Int32 puDeviceID, Int32 cMidi, IntPtr dwCallback, IntPtr dwInstance, Int32 fdwOpen); VB.NET Signature:
Public Declare Function midiStreamOpen Lib "winmm.dll" (ByVal hMidiStream As IntPtr, ByVal puDeviceId As IntPtr, ByVal cMidi As Integer, ByVal dwCallback As IntPtr, ByVal dwInstance As IntPtr, ByVal fdwOpen As Integer) As Integer 21: midiStreamOut C# Signature:
static extern Int32 midiStreamOut(IntPtr hMidiStream, MIDIHDR lpMidiHdr, uint cbMidiHdr); VB Signature:
Declare Function midiStreamOut Lib "winmm.dll" (ByVal hMidiStream As IntPtr, ByVal lpMidiHdr As MIDIHDR, ByVal cbMidiHdr As UInteger) As Integer
int dwBytesRecorded;
IntPtr reserved;
IntPtr dwReserved;
Structure MIDIHDR
Dim dwBytesRecorded As Integer
Dim reserved As IntPtr
Dim dwReserved As IntPtr
End Structure 22: midiStreamPause C# Signature:
static extern Int32 midiStreamPause(IntPtr hMidiStream); VB Signature:
Declare Function midiStreamPause Lib "winmm.dll" (ByVal hMidiStream As IntPtr) As Integer C# Signature:
static extern TODO midiStreamPosition(TODO); VB Signature:
Declare Function midiStreamPosition Lib "winmm.dll" (ByVal hms As IntPtr, ByVal pmmt As MMTIME, ByVal cbmmt As UInteger) As Integer
Structure MMTIME
Structure u
Structure smpte
End Structure
Structure midi
End Structure
End Structure
End Structure C# Signature:
static extern TODO midiStreamProperty(TODO); VB Signature:
Declare Function midiStreamProperty Lib "winmm.dll" (TODO) As TODO 26: midiStreamStop 27: mixerClose C# Signature:VB Signature:
Declare Function mixerClose Lib "winmm.dll" (ByVal hmx As IntPtr) As Integer 28: MixerFlags C# Signature:VB Signature:This enumeration is not yet complete. Many functions use other flags that are not included in this list. Please help to integrate it. C# Signature:
ref MixerControlDetails pmxcd, UInt32 fdwDetailsmixer); VB Signature:
Declare Function mixerGetControlDetails Lib "winmm.dll" (<MarshalAs(UnmanagedType.I4)> ByVal hmxobj As Integer, ByRef pmxcd As MIXERCONTROLDETAILS, ByVal fdwDetails As Integer) As Integer The winmm dll may not execute properly on 64-bit systems. Consequently, the StructLayout must be Sequential, with CharSet = Ansi, and Pack = 4. This particular type has some special layout considerations (the c union keyword) which typically means developers would use the explicit layout. However, the explicit layout breaks down on 64-bit systems for any type with an IntPtr in the type. Consequently, the C# types have been redesigned to use Sequential layout so that they will automatically adjust to 64-bit systems. This means private fields with public properties which perform the gunky work of making it look like there is a union.
#region Properties
get { return this.cbStruct; }
get { return this.dwControlID; }
get { return this.cChannels; }
get { return this.hwndOwner; }
get { return (UInt32)this.hwndOwner; }
get { return this.cbDetails; }
get { return this.paDetails; }
#endregion The fdwDetailsmixer parameter can be composed constants from two distinct enumerations, one of which is used frequently in the winmm library, and the other constant is only used with this method. Consequently, you should wrap up the method definition so that it is easier to use, and more consistent. In the following example, the actual extern is private, while the public static method lists both enums to callers.
private static extern Int32 mixerGetControlDetails(IntPtr hmxobj, ref MIXERCONTROLDETAILS pmxcd, uint fdwDetails);
public static Int32 mixerGetControlDetails(IntPtr hmxobj, ref MIXERCONTROLDETAILS pmxcd, MIXER_OBJECTF fdwDetails, MIXER_GETCONTROLDETAILSF getControlDetails)
return mixerGetControlDetails(hmxobj, ref pmxcd, flags); 30: mixerGetDevCaps C# Signature:
private static extern uint MixerGetDevCaps(int mixerId, ref MixerCaps mixerCaps, int mixerCapsSize); VB Signature:
Private Shared Function MixerGetDevCaps(ByVal mixerId As Integer, ByRef mixerCaps As MixerCaps, ByVal mixerCapsSize As Integer) As UInteger MixerCaps is in Structures.MIXERCAPS
private static extern uint MixerGetDevCaps(int mixerId, ref MixerCaps mixerCaps, int mixerCapsSize);
public ushort ManufacturerID;
return String.Format("Manufacturer ID: {0}, Product ID: {1}, Driver Version: {2}, Product Name: \"{3}\", Support: {4}, Destinations: {5}", ManufacturerID, ProductId, Version, ProductName, Support, Destinations);
uint result = MixerGetDevCaps(mixerId, ref caps, Marshal.SizeOf(caps));
Console.ReadKey(); 31: mixerGetID C# Signature:VB Signature:
Shared Function mixerGetID(<MarshalAs(UnmanagedType.I4)> ByVal hmxobj As Integer, ByRef puMxId As UInteger, ByVal fdwId As MixerFlags) As MMRESULT C# Signature:
ref MIXERLINECONTROLS pmxlc, UInt32 fdwControls); VB Signature:
Declare Function mixerGetLineControls Lib "winmm.dll" (hmxobj As IntPtr, _
ByRef pmxlc As MIXERLINECONTROLS, fdwControls As Integer) As Integer The fdwControls parameter can be composed constants from two distinct enumerations, one of which is used frequently in the winmm library, and the other constant is only used with this method. Consequently, you should wrap up the method definition so that it is easier to use, and more consistent. In the following example, the actual extern is private, while the public static method lists both enums to callers.
private static extern Int32 mixerGetLineControls(IntPtr hmxobj, ref MIXERLINECONTROLS pmxlc, uint fdwControls);
public static Int32 mixerGetLineControls(IntPtr hmxobj, ref MIXERLINECONTROLS pmxlc, MIXER_OBJECTF mixerFlags, MIXER_GETLINECONTROLSF controlsFlags)
return mixerGetLineControls(hmxobj, ref pmxlc, flags); 33: mixerGetLineInfo C# Signature:
ref MIXERLINE pmxl, UInt32 fdwInfo); VB Signature:
Shared Function mixerGetLineInfo(<MarshalAs(UnmanagedType.I4)> ByVal hmxobj As Integer, ByRef pmxl As MIXERLINE, ByVal fdwInfo As MixerFlags) As MMRESULT The fdwInfo parameter can be composed constants from two distinct enumerations, one of which is used frequently in the winmm library, and the other constant is only used with this method. Consequently, you should wrap up the method definition so that it is easier to use, and more consistent. In the following example, the actual extern is private, while the public static method lists both enums to callers.
private static extern Int32 mixerGetLineInfo(IntPtr hmxobj, ref MIXERLINE pmxl, uint fdwInfo);
public static Int32 mixerGetLineInfo(IntPtr hmxobj, ref MIXERLINE pmxl, MIXER_OBJECTF fdwInfo, MIXER_GETLINEINFOF fieldToFollow)
return mixerGetLineInfo(hmxobj, ref pmxl, flags); 34: mixerGetNumDevs C# Signature:VB Signature:
Declare Function mixerGetNumDevs Lib "winmm.dll" () As UInt32
Console.WriteLine("Number of mixers present: {0}", mixerGetNumDevs()); 35: mixerGetNumDevs C# Signature:VB.Net Signature:Public Declare Function mixerGetNumDevs Lib "winmm.dll" () As Integer 36: mixerOpen C# Signature:
static extern Int32 mixerOpen(ref IntPtr phmx, uint pMxId, VB Signature:
Declare Function mixerOpen Lib "winmm.dll" (ByRef phmx As IntPtr, ByVal pMxId As UInteger, ByVal dwCallback As IntPtr, ByVal dwInstance As IntPtr, ByVal fdwOpen As UInteger) As Integer C# Signature:
ref MixerControlDetails pmxcd, UInt32 fdwDetails); VB Signature:
Declare Function mixerSetControlDetails Lib "winmm.dll" (ByVal hmxobj As IntPtr, ByVal pmxcd As MIXERCONTROLDETAILS, ByVal fdwDetails As Integer) As Integer The winmm dll may not execute properly on 64-bit systems. Consequently, the StructLayout must be Sequential, with CharSet = Ansi, and Pack = 4. This particular type has some special layout considerations (the c union keyword) which typically means developers would use the explicit layout. However, the explicit layout breaks down on 64-bit systems for any type with an IntPtr in the type. Consequently, the C# types have been redesigned to use Sequential layout so that they will automatically adjust to 64-bit systems. This means private fields with public properties which perform the gunky work of making it look like there is a union.
#region Properties
/// <summary>size in bytes of <see cref="MIXERCONTROL">MIXERCONTROL</see></summary>
get { return this.cbStruct; }
get { return this.dwControlID; }
get { return (MIXERCONTROL_CONTROLTYPE)this.dwControlType; }
get { return (MIXERCONTROL_CONTROLF)this.fdwControl; }
get { return this.cMultipleItems; }
get { return this.szShortName; }
get { return this.szName; }
#endregion
//public uint dwReserved1; // Unioned with lMinimum
//public uint dwReserved2; // Unioned with lMaximum
private UInt32 dwReserved3;
private UInt32 dwReserved4;
private UInt32 dwReserved5;
private UInt32 dwReserved6;
#region Properties
get { return this.lMinimum; }
get { return this.lMaximum; }
get { return (uint)this.lMinimum; }//TODO: something different
get { return (uint)this.lMaximum; }//TODO: something different
public UInt32 Reserved1
get { return (uint)this.lMinimum; }//TODO: something different
public UInt32 Reserved2
get { return (uint)this.lMaximum; }//TODO: something different
public UInt32 Reserved3
get { return this.dwReserved3; }
set { this.dwReserved3 = value; }
public UInt32 Reserved4
get { return this.dwReserved4; }
set { this.dwReserved4 = value; }
public UInt32 Reserved5
get { return this.dwReserved5; }
set { this.dwReserved5 = value; }
public UInt32 Reserved6
get { return this.dwReserved6; }
set { this.dwReserved6 = value; }
#endregion
//private UInt32 dwReserved1; //Unioned with cSteps
private UInt32 dwReserved2;
private UInt32 dwReserved3;
private UInt32 dwReserved4;
private UInt32 dwReserved5;
private UInt32 dwReserved6;
#region Properties
get { return this.cSteps; }
get { return this.cSteps; }
public UInt32 Reserved1
get { return this.cSteps; }//TODO: something different
public UInt32 Reserved2
get { return this.dwReserved2; }
set { this.dwReserved2 = value; }
public UInt32 Reserved3
get { return this.dwReserved3; }
set { this.dwReserved3 = value; }
public UInt32 Reserved4
get { return this.dwReserved4; }
set { this.dwReserved4 = value; }
public UInt32 Reserved5
get { return this.dwReserved5; }
set { this.dwReserved5 = value; }
public UInt32 Reserved6
get { return this.dwReserved6; }
set { this.dwReserved6 = value; }
#endregion
Structure MIXERCONTROLDETAILS
Structure u ' A union
End Structure
End Structure The fdwDetails parameter can be composed constants from two distinct enumerations, one of which is used frequently in the winmm library, and the other constant is only used with this method. Consequently, you should wrap up the method definition so that it is easier to use, and more consistent. In the following example, the actual extern is private, while the public static method lists both enums to callers.
private static extern Int32 mixerSetControlDetails(IntPtr hmxobj, ref MIXERCONTROLDETAILS pmxcd, uint fdwDetails);
public static Int32 mixerSetControlDetails(IntPtr hmxobj, ref MIXERCONTROLDETAILS pmxcd, MIXER_OBJECTF fdwDetails, MIXER_SETCONTROLDETAILSF setControlDetails)
return mixerSetControlDetails(hmxobj, ref pmxcd, flags); 38: MMRESULT C# Signature:
public static enum MMRESULT : uint
MMSYSERR_READERROR = 16,
WAVERR_UNPREPARED = 34 VB Signature:
Enum MMRESULT
MMSYSERR_READERROR = 16
WAVERR_UNPREPARED = 34 39: PlaySound C# Signature:VB Signature:
Shared Function PlaySound( _
Public Declare Auto Function PlaySound Lib "winmm.dll" (ByVal pszSound As String, ByVal hmod As IntPtr, ByVal fdwSound As Integer) As Boolean
Public Declare Auto Function PlaySound Lib "winmm.dll" (ByVal pszSound As Byte(), ByVal hmod As IntPtr, ByVal fdwSound As SoundFlags) As Boolean
/// <summary>don't stop any currently playing sound</summary>
/// <summary>The pszSound parameter is an application-specific alias in the registry. You can combine this flag with the SND_ALIAS or SND_ALIAS_ID flag to specify an application-defined sound alias.</summary>
/// <summary>name is a registry alias</summary>
/// <summary>alias is a predefined id</summary>
/// <summary>name is resource name or atom</summary>
SND_RESOURCE = 0x00040004
''' The sound is played synchronously, and PlaySound returns after
''' The sound is played asynchronously and PlaySound returns
''' PlaySound returns silently without playing the default sound.
''' The sound plays repeatedly until PlaySound is called again
''' that is already playing. If a sound cannot be played because
''' the resource needed to generate that sound is busy playing
''' another sound, the function immediately returns False without
''' playing the requested sound.
''' <remarks>If this flag is not specified, PlaySound attempts
''' to stop the currently playing sound so that the device can
''' </remarks>
''' the registry. You can combine this flag with the SND_ALIAS
''' If the driver is busy, return immediately without playing
''' registry or the WIN.INI file. Do not use with either
''' SND_FILENAME or SND_RESOURCE.
''' The pszSound parameter is a resource identifier; hmod must
''' identify the instance that contains the resource.
SND_RESOURCE = &H40004
bool result = PlaySound(@"C:\path\to\wav\file.wav" ,ip ,0);
Public Shared Sub Play(ByVal strFileName As String)
Public Shared Sub Play(ByVal waveData As Byte()) //bad idea, see http://blogs.msdn.com/larryosterman/archive/2009/02/19/playsound-xxx-snd-memory-snd-async-is-almost-always-a-bad-idea.aspx
Dim result As Boolean = PlaySound("C:\path\to\wav\file.wav", IntPtr.Zero, ip) 40: timeBeginPeriod C# Signature:VB Signature:
Declare Function timeBeginPeriod Lib "winmm.dll" (ByVal uPeriod As Integer) As Integer
StreamWriter oWriter = null;
MM_BeginPeriod(1); // set timer resolution to 1ms => freq=1000Hz
oWriter = new StreamWriter(@"ticks.txt");
// tickcount has resolution of 16.5ms, mmtime has 1ms 41: timeEndPeriod C# Signature:VB Signature:
Declare Function timeEndPeriod Lib "winmm.dll" (ByVal uPeriod As Integer) As Integer 42: timeGetDevCaps C# Signature:
static extern UInt32 timeGetDevCaps( ref TimeCaps timeCaps, VB Signature:Declare Function timeGetDevCaps Lib "winmm.dll" (ByRef lpTimeCaps As TimeCaps, ByVal uSize As UInt32) As UInt32 http://www.pinvoke.net/default.aspx/Structures.TimeCaps Returns TIMERR_NOERROR if successful or TIMERR_STRUCT if it fails to return the timer device capabilities. C# Signature:
static extern UInt32 timeGetSystemTime( ref MmTime mmTime, UInt32 sizeMmTime ); VB Signature:
Declare Function timeGetSystemTime Lib "winmm.dll" (TODO) As TODO 44: timeGetTime C# Signature:VB Signature:
Public Shared Function MM_GetTime() As UInteger Unlike Environment.TickCount, you can directly set the resolution of this timer with the TimeBeginPeriod function. 45: timeKillEvent C# Signature:
static extern UInt32 timeKillEvent( UInt32 timerEventId ); VB Signature:
Declare Function timeKillEvent Lib "winmm.dll" (TODO) As TODO 46: timeSetEvent C# Signature:
static extern UInt32 timeSetEvent( UInt32 msDelay, UInt32 msResolution,
TimerEventHandler handler, ref UInt32 userCtx, UInt32 eventType ); VB Signature:
Declare Function timeSetEvent Lib "winmm.dll" (TODO) As TODO System.Threading.Timer
static extern uint timeSetEvent(uint uDelay, uint uResolution, TimerCallback lpTimeProc, UIntPtr dwUser, uint fuEvent);
GC.SuppressFinalize(this);
/// The current timer instance ID
/// Stop the current timer instance (if any)
/// <param name="repeat">If true sets a repetitive event, otherwise sets a one-shot</param>
public void Start(uint ms, bool repeat)
fuEvent f = fuEvent.TIME_CALLBACK_FUNCTION | (repeat ? fuEvent.TIME_PERIODIC : fuEvent.TIME_ONESHOT);
//Callback from the MMTimer API that fires the Timer event. Note we are in a different thread here 47: waveInAddBuffer C# Signature:
public static extern uint waveInAddBuffer(IntPtr hwi, ref WAVEHDR pwh, uint cbwh); VB Signature:
Shared Function waveInAddBuffer(<MarshalAs(UnmanagedType.I4)> ByVal hwi As Integer, ByVal pwh As IntPtr, ByVal cbwh As UInteger) As MMRESULT
Shared Function waveInAddBuffer(<MarshalAs(UnmanagedType.I4)> ByVal hwi As Integer, ByRef pwh As WAVEHDR, ByVal cbwh As UInteger) As MMRESULT When recording waveform audio, usually buffers are allocated with unmanaged functions and kept in an IntPtr() array; for this reason the function is provided in two versions, one processing a WAVEHDR ByRef and the other working with an IntPtr. 48: waveInClose C# Signature:VB Signature:
Shared Function waveInClose(<MarshalAs(UnmanagedType.I4)> ByVal hwi As Integer) As MMRESULT 49: waveInGetNumDevs C# Signature:VB Signature:
Shared Function waveInGetNumDevs() As UInteger 50: waveInOpen C# Signature:
CALLBACK_THREAD = 0x20000,
WAVE_FORMAT_DIRECT = 8 VB Signature:
CALLBACK_THREAD = &H20000
WAVE_FORMAT_DIRECT = 8 51: WaveInOpenFlags C# Signature:VB Signature:
CALLBACK_THREAD = &H20000
WAVE_FORMAT_DIRECT = 8 C# Signature:
static extern TODO waveInPrepareHeader3(TODO); VB Signature:
Declare Function waveInPrepareHeader3 Lib "winmm.dll" (TODO) As TODO 54: waveInProc C# Signature:VB Signature:55: waveInReset C# Signature:
static extern uint waveInReset(IntPtr hwi); VB Signature:
Shared Function waveInReset(<MarshalAs(UnmanagedType.I4)> ByVal hwi As Integer) As MMRESULT 56: waveInStart C# Signature:VB Signature:
Shared Function waveInStart(<MarshalAs(UnmanagedType.I4)> ByVal hwi As Integer) As MMRESULT C# Signature:
static extern MMRESULT waveInUnprepareHeader(IntPtr hwi, ref WAVEHDR pwh, uint cbwh); VB Signature:
Shared Function waveInUnprepareHeader(<MarshalAs(UnmanagedType.I4)> ByVal hwi As Integer, ByVal pwh As IntPtr, ByVal cbwh As UInteger) As MMRESULT
Shared Function waveInUnprepareHeader(<MarshalAs(UnmanagedType.I4)> ByVal hwi As Integer, ByRef pwh As WAVEHDR, ByVal cbwh As UInteger) As MMRESULT 58: waveOutClose C# Signature:VB Signature:
Declare Auto Function waveOutClose Lib "winmm.dll" (ByVal hwo As IntPtr) As UInteger "Manufacturer and Product Identifiers" [http://msdn2.microsoft.com/en-us/library/ms709440.aspx] C# Signature:
public static extern uint waveOutGetDevCaps(IntPtr hwo,ref WAVEOUTCAPS pwoc,uint cbwoc); VB Signature:
Declare Auto Function waveOutGetDevCaps Lib "winmm.dll" (ByVal uDeviceID as Integer, ByRef lpCaps As WAVEOUTCAPS, _ Structures Used:
VB.NET 2005 - Use the following structure: WAVEOUTCAPS
Public Structure WAVEOUTCAPS
Public wReserved As Short
End Structure
C# 2005 version of structure
public short wReserved; Remember to have the strings marshaled as ByValTStr with size of 32. Use "Auto" in the Declare statement to have the correct character set selected automatically.
public short wReserved;
return string.Format("wMid:{0}|wPid:{1}|vDriverVersion:{2}|'szPname:{3}'|dwFormats:{4}|wChannels:{5}|wReserved:{6}|dwSupport:{7}", new object[] { wMid, wPid, vDriverVersion, szPname, dwFormats, wChannels, wReserved, dwSupport });
public short wReserved;
return string.Format("wMid:{0}|wPid:{1}|vDriverVersion:{2}|'szPname:{3}'|dwFormats:{4}|wChannels:{5}|wReserved:{6}", new object[] { wMid, wPid, vDriverVersion, szPname, dwFormats, wChannels, wReserved });
waveOutGetDevCaps(uDeviceID, ref waveOutCaps, Marshal.SizeOf(typeof(WAVEOUTCAPS)));
return list;
return null;
public static WAVEINCAPS[] GetDevCapsRecording()
waveInGetDevCaps(uDeviceID, ref waveInCaps, Marshal.SizeOf(typeof(WAVEINCAPS)));
return list;
return null;
public static extern uint waveInGetDevCaps(int hwo, ref WAVEINCAPS pwic, /*uint*/ int cbwic);
public static extern uint waveOutGetDevCaps(int hwo, ref WAVEOUTCAPS pwoc, /*uint*/ int cbwoc); C# Signature:
/// This function gets a string describing the error returned from one of the wave functions.
/// <param name="mmrError">The error code</param>
/// <param name="pszText">String returning the text description</param>
/// <returns>NOERROR success, otherwise fail.</returns>
private static extern uint waveOutGetErrorText(uint mmrError, StringBuilder pszText, uint cchText);
/// This function gets a string describing the error returned from one of the wave functions.
/// <param name="mmrError">The error code</param>
/// <returns>The description</returns>
public static string waveOutGetErrorText(int mmrError)
uint errorResult = waveOutGetErrorText(mmrError, message, (uint)message.Capacity);
if (errorResult == 0)
return message.ToString();
return "waveOutGetErrorText failed."; VB Signature:
Declare Function waveOutGetErrorText Lib "winmm.dll" (TODO) As TODO Cut off search results after 60. Please refine your search. |