473,398 Members | 2,404 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

Pacemaker Winamp-Plugin code doesnt work in VB.NET

1
Hi!

I am trying to use the following code in a little VB.Net project and I just cant get it to work. I get an error that says the "adressof"-command isnt using the right delegate type and some functions seem to be missin return commands?!? Could someone please have a look at this and maybe change it, so it works in VB.Net?

Thank you :)
Christian

====

Attribute VB_Name = "Module_PaceMaker"
' ==========================================
' PaceMaker plug-in message control routines
' ==========================================
' Copyleft (c) Olli Parviainen 2004
'
' These routines allow Visual Basic programs to control PaceMaker plug-in.
' Please visit http://www.iki.fi/oparviai/pacemaker for more information about
' PaceMaker plug-in.
'
' Usage:
' - First grab handle of active PaceMaker plug-in window by calling
' PaceMaker_SeekHandle()
' - Then use the handle to control the PaceMaker plug-in with routines
' PaceMaker_GetVersion(), PaceMaker_SetTempo(), PaceMaker_SetPitch() and so on.
'
' License: All permissions granted. This source code can be used, modified and
' included in applications without restrinctions.
'
' $Id: PaceMaker.bas,v 1.1 2004/08/28 13:16:34 Olli Exp $
'
' ================================================== ===========================

' Windows API function declarations
Private Declare Function EnumWindows Lib "USER32.dll" (ByVal lpEnumFunc As Long, _
ByVal lParam As Long) As Long

Private Declare Function GetWindowText Lib "USER32.dll" Alias "GetWindowTextA" (ByVal hwnd As Long, _
ByVal lpString As String, ByVal aint As Long) As Long

Private Declare Function SendMessageTimeout Lib "USER32.dll" Alias "SendMessageTimeoutA" _
(ByVal hwnd As Long, ByVal msg As Long, ByVal wParam As Long, ByVal lParam As _
Long, ByVal fuFlags As Long, ByVal uTimeout As Long, lpdwResult As Long) As Long

Private Declare Function PostMessage Lib "USER32.dll" Alias "PostMessageA" _
(ByVal hwnd As Long, ByVal msg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long

Private hPaceMaker As Long

' Constants
Private Const SMTO_ABORTIFHUNG = 2
Private Const WM_APP = 32768
Private Const SCALE_COEFF = 1000
Public Const PM_IDENTIFY = WM_APP + 0
Public Const PM_GETVERSION = WM_APP + 1
Public Const PM_ENABLE_SHADOWMODE = WM_APP + 2
Public Const PM_ENABLE_TWEAKING = WM_APP + 3
Public Const PM_RESET = WM_APP + 5
Public Const PM_SET_TEMPO = WM_APP + 6
Public Const PM_SET_PITCH = WM_APP + 7
Public Const PM_SET_SPEED = WM_APP + 8
Public Const PM_IS_REGISTERED = WM_APP + 10

' This function checks if a window being enumerated has a title beginning
' with "PaceMaker"
Private Function EnumWindowsProc(ByVal hwnd As Long, ByVal lParam As Long) As Long

Dim sWindowTitle As String
Dim r As Integer
Dim response As Long

sWindowTitle = Space(255)
' Compare beginning of window title
r = GetWindowText(hwnd, sWindowTitle, 255)

EnumWindowsProc = True

If Left(sWindowTitle, 9) = "PaceMaker" Then
' Found a window having title beginning with "PaceMaker...".
' Test now that it's the real thing.
If PaceMaker_SendCommand(hwnd, PM_IDENTIFY, 0, response) <> 0 Then
' We got a response of some kind
If response = &H1770 Then
' Ho! found PaceMaker
hPaceMaker = hwnd
EnumWindowsProc = False
End If

End If
End If

End Function

'Function that returns handle to PaceMaker window if found
Public Function PaceMaker_SeekHandle() As Long
hPaceMaker = 0
' Call function 'EnumWindows' to seek for a window with title
' beginning with 'PaceMaker'
r = EnumWindows(AddressOf EnumWindowsProc, hPaceMaker)

PaceMaker_SeekHandle = hPaceMaker
End Function
' Subroutine for sending a command query message to PaceMaker
Public Function PaceMaker_SendCommand(hPaceMaker As Long, command As Long, _
param As Long, response As Long) As Long

PaceMaker_SendCommand = SendMessageTimeout(hPaceMaker, command, param, 0, SMTO_ABORTIFHUNG, 1000, response)

End Function
' Get PaceMaker version identifier.
Public Function PaceMaker_GetVersion(hPaceMaker As Long) As Long
r = PaceMaker_SendCommand(hPaceMaker, PM_GETVERSION, 0, PaceMaker_GetVersion)
End Function
' Query if PaceMaker plug-in has been registered (requirement for commercial use etc).
Public Function PaceMaker_IsRegistered(hPaceMaker As Long) As Long
r = PaceMaker_SendCommand(hPaceMaker, PM_IS_REGISTERED, 0, PaceMaker_IsRegistered)
End Function
' Enable/disable PaceMaker window shadow mode
Public Sub PaceMaker_EnableShadowMode(hPaceMaker As Long, bEnable As Boolean)
r = PostMessage(hPaceMaker, PM_ENABLE_SHADOWMODE, 0, bEnable)
End Sub
' Enable/disable PaceMaker sound tweaking
Public Sub PaceMaker_EnableTweaking(hPaceMaker As Long, bEnable As Boolean)
r = PostMessage(hPaceMaker, PM_ENABLE_TWEAKING, 0, bEnable)
End Sub
' Reset PaceMaker tempo/pitch/speed controls
Public Sub PaceMaker_Reset(hPaceMaker As Long)
r = PostMessage(hPaceMaker, PM_RESET, 0, 0)
End Sub
' Set new tempo setting
Public Sub PaceMaker_SetTempo(hPaceMaker As Long, ByVal Tempo As Double)
Dim value As Long
value = Tempo * SCALE_COEFF
r = PostMessage(hPaceMaker, PM_SET_TEMPO, 0, value)
End Sub
' Set new pitch setting
Public Sub PaceMaker_SetPitch(hPaceMaker As Long, ByVal Pitch As Double)
Dim value As Long
value = Pitch * SCALE_COEFF
r = PostMessage(hPaceMaker, PM_SET_PITCH, 0, value)
End Sub
' Set new speed setting
Public Sub PaceMaker_SetSpeed(hPaceMaker As Long, ByVal Speed As Double)
Dim value As Long
value = Speed * SCALE_COEFF
r = PostMessage(hPaceMaker, PM_SET_SPEED, 0, value)
End Sub
Mar 27 '11 #1
0 1389

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Michael Hogan | last post by:
I want to pars a playlist file for three different varibles, so I can save them as mp3 files. I am using: strTEMPURL = GetUrlSource(Text1.Text) to put the entire .pls file into a strTEMPURL...
1
by: BadOmen | last post by:
I am using this to send am command to WinAmp and it works, The Open File(s) is opening but my program halts until I presses the Open or Cancel button. I think my program is waiting for a returned...
1
by: BadOmen | last post by:
This works fine, but I want to be able to make WinAmp3 to play a playlist at startup, how do i do that? This is my playlist... MyPlaylist.b4s //Initsierar activeX Objekt var oShell = new...
5
by: Kamyk | last post by:
Hello all again! On the main form I have a few fields and among of them there is button which opens additional window (named "Links") where user can delete and add data from the database. I...
3
by: Ron Vecchi | last post by:
I'm trying to get a list of all file icons registered to file extensions located on the machine. I would like to beable to loop through all icons and save the images in a seperate directory named...
1
by: Lasse Edsvik | last post by:
Hello I was wondering if you guys could help me. My goal is to make a program that just show's what my winamp on same comp with a button-click or something. Now I was wondering if you guys...
2
by: pangel83 | last post by:
I've been trying for days to write a piece of VB.NET code that will read from winamp's memory space the paths of the files from the current winamp playlist. The GETPLAYLISTFILE command of the...
8
by: PiotrKolodziej | last post by:
Hi A have a class containing elements of string type. I need to print them using 'for' loop. How to do this. I spent few hours trying to do this from the other approach. Thanks for any help. ...
4
by: Terry Olsen | last post by:
Here's another odd request. I want to embed the winamp window in my app. I have a panel that I want Winamp to be locked to. Using a couple of API calls, I can set the panel as the parent of the...
10
gsgurdeep
by: gsgurdeep | last post by:
winamp in my pc hang my whole system for atleast for 5 minuts, when changing to next track. i'm using xp sp2 core 2 duo laptop. i'm playing only mp3 tracks. please tell me the solution...........
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
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...
0
tracyyun
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.