how do I ask for help with APIs?

When I go to a website asking for help with their software's API, what do I say? Surely most people have never used Dragon NaturallySpeaking. I think I'm supposed to say I need "WinWrap API" or "VBA API" to do some action in it. Mentioning NatSpeak will very likely be an exercise in distraction and failure, and that way I'll never get the code I need to paste. I need to ask this the right way.

I just want to make an advanced script that pauses Winamp. I've got a hundred commands to load music, but not one to pause it.

I've also posted this in the knowbrainer forum. I'd appreciate any help that I could receive. Thank you

Ian Nastajus

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

winamp api sdk

You need to search for the application API name e.g. in this case winamp api or sdk (usually contain samples and documentation on using the API)

You will then find documentation and samples, for example in Visual Basic and C++, you need to adapt the Visual Basic programming environment documentation to work with the DNS advanced scripting programming environment. I have posted more information on the other forum where you also posted this question.

http://www.knowbrainer.com/PubForum/index.cfm?page...

use send message

http://forums.winamp.com/showthread.php?threadid=1...

Check out the Winamp forums for further details. The post I sent has some details and examples on how to use the Winamp API (even for VB). There are other posts in the forum that can provide more details to the API.

For pausing music its pretty simple, just use FindWindow to identify the winamp window and then call SendMessage with the appropriate value to pause Winamp. You need to basically send a WM_COMMAND type message with a modifier of 40046 to pause the player. FindWindow and SendMessage themselves are win32 function calls that are hopefully available in your scripting language of choice. If you want to anything that that Winamp API does not support (like search and play a particular track in the media player), you will probably have to use a 3rd party Winamp COM library. Again check the Winamp forums.

Nathaniel

Declare Function SendMessage

Here is the script as you would paste it directly into an advanced scripting command with DNS. PLEASE NOTE THE DIFFERENCES IN THE DECLARATION OF THE FUNCTIONS AND THE CONSTANT VALUES NEED TO BE EXPLICIT. THERE ARE SUBTLE BUT VERY IMPORTANT DIFFERENCES BETWEEN THE VERBAL BASIC EXAMPLES POSTED ON THE LINK FROM Nathaniel AND THE ADVANCED SCRIPT BELOW.

Declare Function SendMessage Lib "user32" Alias "SendMessageA" _
(ByVal hwnd As Long, ByVal wMsg As Long, _
ByVal wParam As Long, lParam As Long) As Long
Declare Function FindWindow Lib "user32" Alias _
"FindWindowA" (ByVal lpClassName As String, ByVal _
lpWindowName As Long) As Long

Sub Main
WA_MESSAGE = 40046 ' see list below, this is the value for pause
WM_COMMAND = 273
hwnd = FindWindow("Winamp v1.x",0)
SendMessage(hwnd,WM_COMMAND, WA_MESSAGE, 0)
End Sub

Http://www.knowbrainer.com/PubForum/index.cfm?page...

Lindsay

Thank you, here too,

Thank you, here too, Lindsay.
To others, see link for further discussion.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.




view recent posts