I'm having a problem calling waveInOpen from a VB.NET application, every time
I call it I get a return value of 11 which is MMSYSERR_INVALP ARAM.
I can call waveInGetNumDev s and waveInGetDevCap s just fine. Below is the
format of the waveInOpen call and WaveFormatEx structure.
<DllImport("win mm.dll", SetLastError:=F alse, ExactSpelling:= True)> _
Public Shared Function waveInOpen(ByVa l lphWaveIn As Int32 _
, ByVal uDeviceID As Int32 _
, ByRef lpFormat As APIStructures.W aveFormatEx _
, ByVal dwCallback As Int32 _
, ByVal dwInstance As Int32 _
, ByVal dwFlags As Int32) As Int32
End Function
<StructLayout(L ayoutKind.Seque ntial, CharSet:=CharSe t.Auto, Pack:=1)> _
Public Structure WaveFormatEx
Public FormatTag As Int16
Public Channels As Int16
Public SamplesPerSec As Int32
Public AvgBytesPerSec As Int32
Public BlockAlign As Int16
Public BitsPerSample As Int16
Public ExtraDataSize As Int16
End Structure
A sample solution is available upon request. Any help would be much
appreciated.
--
Fred Loud
MCP 2 4520
Fred, <DllImport("wi nmm.dll", SetLastError:=F alse, ExactSpelling:= True)> _ Public Shared Function waveInOpen(ByVa l lphWaveIn As Int32 _ , ByVal uDeviceID As Int32 _ , ByRef lpFormat As APIStructures.W aveFormatEx _ , ByVal dwCallback As Int32 _ , ByVal dwInstance As Int32 _ , ByVal dwFlags As Int32) As Int32 End Function
Try it like this
<DllImport("win mm.dll", SetLastError:=F alse, ExactSpelling:= True)> _
Public Shared Function waveInOpen(ByRe f lphWaveIn As IntPtr _
, ByVal uDeviceID As IntPtr _
, ByRef lpFormat As APIStructures.W aveFormatEx _
, ByVal dwCallback As IntPtr _
, ByVal dwInstance As IntPtr _
, ByVal dwFlags As Int32) As Int32
End Function
Mattias
--
Mattias Sjögren [MVP] mattias @ mvps.org http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Thanks for the change, I updated the app to use IntPtr for the device handle
instead of Int32s and it worked the first time.
Thanks again for the hugh help!
--
Fred Loud
MCP
"Mattias Sjögren" wrote: Fred,
<DllImport("wi nmm.dll", SetLastError:=F alse, ExactSpelling:= True)> _ Public Shared Function waveInOpen(ByVa l lphWaveIn As Int32 _ , ByVal uDeviceID As Int32 _ , ByRef lpFormat As APIStructures.W aveFormatEx _ , ByVal dwCallback As Int32 _ , ByVal dwInstance As Int32 _ , ByVal dwFlags As Int32) As Int32 End Function
Try it like this
<DllImport("win mm.dll", SetLastError:=F alse, ExactSpelling:= True)> _ Public Shared Function waveInOpen(ByRe f lphWaveIn As IntPtr _ , ByVal uDeviceID As IntPtr _ , ByRef lpFormat As APIStructures.W aveFormatEx _ , ByVal dwCallback As IntPtr _ , ByVal dwInstance As IntPtr _ , ByVal dwFlags As Int32) As Int32 End Function Mattias
-- Mattias Sjögren [MVP] mattias @ mvps.org http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com Please reply only to the newsgroup. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Aaron Prohaska |
last post by:
I have just run into a problem where I have a page that posts back to
itself to execute code, except when the page does the post back it
somehow executes code that is in our home page for the site. The only
reason I know that is happening is because I keep track of the pages
executed by the user to see how they have traversed the site. Has anyone
every seen anything like this before?
Regards,
Aaron Prohaska
|
by: Rajat Tandon |
last post by:
Hello there,
I am relatively new to the newsgroups and C#. I have never been disappointed
with the groups and always got the prompt replies to my queries.This is yet
another strange issue, I am facing. Please please help me to solve this as
soon as possible.
So here we go ...
I am not able to take the screen shot of the windows form based "Smart
|
by: IkBenHet |
last post by:
Hello,
I use this script to upload image files to a folder on a IIS6 server:
******************* START UPLOAD.ASPX FILE **********************
<%@ Page Language="VB" Debug="true" %>
|
by: Sakharam Phapale |
last post by:
Hi All,
I have written following code, but waveInOpen API call gives me error no 32.
Can anyone help me to solve this?
Public Delegate Function callback(ByVal hw As Integer, ByVal uMsg As
Integer, ByVal wParam As Integer, ByVal lParam As Integer) As Integer
Public Const CALLBACK_FUNCTION = &H30000
|
by: Sakharam Phapale |
last post by:
Hi All,
Yestrday I had problem regarding WAVEFORMAT structure in WaveInOpen API
function call.
Following structure works properly. But next to that didn't.
Can anybody tell me why should I used Int16 and Int32 why not just Integer.
Since in it's original definition they are Long, in .NET long is converted
to Integer.
But giving Integer it doesn't works.
Even if I give all elements as int32 it doesn't works.
| |
by: Fred Loud |
last post by:
I'm having a problem calling waveInOpen from a VB.NET application, every time
I call it I get a return value of 11 which is MMSYSERR_INVALPARAM.
I can call waveInGetNumDevs and waveInGetDevCaps just fine. Below is the
format of the waveInOpen call and WaveFormatEx structure.
<DllImport("winmm.dll", SetLastError:=False, ExactSpelling:=True)> _
Public Shared Function waveInOpen(ByVal lphWaveIn As Int32 _
, ByVal uDeviceID As Int32 _
,...
|
by: saverain |
last post by:
//WaveIn.h
MMRESULT IsFormatSupported(LPWAVEFORMATEX pwfx, UINT uDeviceID)
{
return waveInOpen (
NULL, // ptr can be NULL for query
uDeviceID, // The device identifier
pwfx, // Defines the requested
// format.
NULL, // No callback
NULL, // No instance data
|
by: jrumanek |
last post by:
Hallo,
I have a problem with function WaveInOpen.
The function gives ERROR CODE 11 - MMSYSERR_INVALPARAM.
Shall you help me please?
Any sugestion?
|
by: wizche |
last post by:
Hi Everybody,
I'm trying to play a little with waveIn functions... My goal is to calculate if I'm listening a specified sin frequency or not.
For this reason I'm going down with the samplerate... How can I be sure of the sampling rate set on my device?
If I declare waveFormat.nSamplesPerSec = 9441000; waveInOpen return NO error.. (same if I put 500 Hz) But I'm not really sure that's working (9 MHz!!)...
For example if I want to find a...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |