PC Review


Reply
Thread Tools Rate Thread

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

 
 
Sakharam Phapale
Guest
Posts: n/a
 
      31st Aug 2004
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


 
Reply With Quote
 
 
 
 
Chris Dunaway
Guest
Posts: n/a
 
      31st Aug 2004
On Tue, 31 Aug 2004 18:38:46 +0530, Sakharam Phapale wrote:

> 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.
 
Reply With Quote
 
Imran Koradia
Guest
Posts: n/a
 
      31st Aug 2004
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.

"Sakharam Phapale" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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
>
>



 
Reply With Quote
 
Sakharam Phapale
Guest
Posts: n/a
 
      31st Aug 2004

Thanks

Chris & Imran

Regards
Sakharam Phapale


"Chris Dunaway" <"dunawayc[[at]_lunchmeat_sbcglobal[dot]]net"> wrote in
message news:2fnlsfy1x8zf.7v74ii1t7aa7$.(E-Mail Removed)...
> On Tue, 31 Aug 2004 18:38:46 +0530, Sakharam Phapale wrote:
>
> > 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.



 
Reply With Quote
 
Herfried K. Wagner [MVP]
Guest
Posts: n/a
 
      31st Aug 2004
* "Sakharam Phapale" <(E-Mail Removed)> scripsit:
> .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.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Newly created Get Function is not working when I copied the syntax from a working function CJ Microsoft Excel Programming 1 16th Jan 2007 05:28 AM
'send' function stopped working - 'receive' works fine =?Utf-8?B?cnVzcy5iYWRlc3NhQGNvbWNhc3QubmV0?= Microsoft Outlook Discussion 1 13th Jun 2006 04:54 PM
Function not working (but works as a sub). Any ideas? reppy@usa.net Microsoft Excel Programming 2 7th Mar 2006 07:11 PM
Dedupe Function works/works not Tom Bock Microsoft Excel Worksheet Functions 5 17th Mar 2004 08:41 PM
Javascript function works but C# function doesn't execute Jim Hammond Microsoft ASP .NET 2 14th Nov 2003 08:43 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:10 PM.