PC Review


Reply
Thread Tools Rate Thread

Declare Error

 
 
David Webb
Guest
Posts: n/a
 
      2nd Sep 2003
Hi,

I found the following snippet of code in a form on the Open NETCF
site. When I add a new class and paste the code, it is having a hiccup
on the Declare word, after Private Shared statement. It says "Shared
is not valid on a Declare". This is probably simple so could someone
please point me in the right direction? I'm hoping this is an easy
solution to play a wave file.

Using VS.NET 2003, CF (VB.NET)

Regards,

David.

Imports System
Imports System.Runtime.InteropServices

Namespace InTheHand

Public Class Sound

Public Shared Sub Play(ByVal FileName As String)
Dim hResult As Integer = PlaySoundW(FileName, 0, 0)
End Sub 'Play

'playsound
Private Shared Declare Function PlaySoundW Lib "coredll.dll"
Alias "PlaySoundW" _
(ByVal lpszName As String, ByVal hModule As Integer, ByVal
dwFlags As Integer) As Integer

End Class 'Sound

End Namespace 'InTheHand
 
Reply With Quote
 
 
 
 
Jay Abbott [msft]
Guest
Posts: n/a
 
      24th Sep 2003
"Shared" is implied when using Declare. Remove it from your code below and you should be set.

This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
| From: (E-Mail Removed) (David Webb)
| Newsgroups: microsoft.public.dotnet.framework.compactframework
| Subject: Declare Error
| Date: 1 Sep 2003 22:56:08 -0700
| Organization: http://groups.google.com/
| Lines: 35
| Message-ID: <(E-Mail Removed)>
| NNTP-Posting-Host: 203.25.165.1
| Content-Type: text/plain; charset=ISO-8859-1
| Content-Transfer-Encoding: 8bit
| X-Trace: posting.google.com 1062482169 8189 127.0.0.1 (2 Sep 2003 05:56:09 GMT)
| X-Complaints-To: groups-(E-Mail Removed)
| NNTP-Posting-Date: 2 Sep 2003 05:56:09 GMT
| Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfeed00.sul.t-online.de!t-online.de!newsfeed.icl.net!newsfeed.fjserv.net!news.tele.dk!
news.tele.dk!small.news.tele.dk!sn-xit-02!sn-xit-04!sn-xit-01!sn-xit-09!supernews.com!postnews1.google.com!not-for-mail
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.compactframework:32497
| X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework
|
| Hi,
|
| I found the following snippet of code in a form on the Open NETCF
| site. When I add a new class and paste the code, it is having a hiccup
| on the Declare word, after Private Shared statement. It says "Shared
| is not valid on a Declare". This is probably simple so could someone
| please point me in the right direction? I'm hoping this is an easy
| solution to play a wave file.
|
| Using VS.NET 2003, CF (VB.NET)
|
| Regards,
|
| David.
|
| Imports System
| Imports System.Runtime.InteropServices
|
| Namespace InTheHand
|
| Public Class Sound
|
| Public Shared Sub Play(ByVal FileName As String)
| Dim hResult As Integer = PlaySoundW(FileName, 0, 0)
| End Sub 'Play
|
| 'playsound
| Private Shared Declare Function PlaySoundW Lib "coredll.dll"
| Alias "PlaySoundW" _
| (ByVal lpszName As String, ByVal hModule As Integer, ByVal
| dwFlags As Integer) As Integer
|
| End Class 'Sound
|
| End Namespace 'InTheHand
|


 
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
BCM error message : must declare the scalar variable @ID Burcak Turkay Microsoft Outlook BCM 1 4th Oct 2010 10:56 PM
run-time error '6' - overflow - once I declare a pre-used variable name as integer ker_01 Microsoft Excel Programming 3 2nd Sep 2008 02:24 PM
Must Declare the Scalar Variable error Oded Dror Microsoft ASP .NET 2 28th May 2006 03:39 PM
Error:Cannot declare a managed <variable_name> in an unmanaged <cl =?Utf-8?B?Q29tTmV0?= Microsoft Dot NET Framework 0 7th Jul 2005 01:06 PM
Error: Must Declare Variable Boris Zakharin Microsoft ASP .NET 2 22nd Jul 2003 02:04 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:33 PM.