API function not working in .NET (works well in VB 6)

  • Thread starter Thread starter Sakharam Phapale
  • Start date Start date
S

Sakharam Phapale

Hi All,

..NET application does not give correct result when I used following API
function .

{
Declare Function waveInGetNumDevs Lib "winmm.dll" () As Long

MsgBox(waveInGetNumDevs)

}

..NET gives it as 855400533......

VB6 gives it 1
VC++6 gives it 1

So why .NET is not giving correct one.

Thanks in advance

Sakharam Phapale
 
Declare Function waveInGetNumDevs Lib "winmm.dll" () As Long

You are using the wrong function signature. In .Net, a long is 64 bits
whereas an Integer is 32. Your return type should be Integer, not Long.

--
Chris

dunawayc[AT]sbcglobal_lunchmeat_[DOT]net

To send me an E-mail, remove the "[", "]", underscores ,lunchmeat, and
replace certain words in my E-Mail address.
 
declare the function as:
Declare Function waveInGetNumDevs Lib "winmm.dll" () As Integer

Longs from VB6 convert to Integers in .NET (32-bit). Longs in .NET are
64-bit.

Imran.
 
Thanks

Chris & Imran

Regards
Sakharam Phapale


Chris Dunaway said:
Declare Function waveInGetNumDevs Lib "winmm.dll" () As Long

You are using the wrong function signature. In .Net, a long is 64 bits
whereas an Integer is 32. Your return type should be Integer, not Long.

--
Chris

dunawayc[AT]sbcglobal_lunchmeat_[DOT]net

To send me an E-mail, remove the "[", "]", underscores ,lunchmeat, and
replace certain words in my E-Mail address.
 
* "Sakharam Phapale said:
.NET application does not give correct result when I used following API
function .

{
Declare Function waveInGetNumDevs Lib "winmm.dll" () As Long

'Long' maps to 'Int64' which is a 64-bit datatype. Use '...As Int32'
instead.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top