|
| |

VB.NET - Fortgeschrittene| API Anbindung eines Programmes | |  | | Autor: Hannes H. | | Datum: 01.10.06 10:06 |
| Hallo
Für das Musikverwaltungsprogramm "Helium Music Manager" gibt es eine Anbindung über SendMessage von Windows.
Man könnt so das Programm steuern.
Leider ist mir bei der Eklärung so einiges unklar:
Gesendet wird ja über "SendMessage". Aber alle Beispiele hier im Forum haben ein anderes Format.
Könnt mir jemand das ganze so "übersetzen", das ich aus einem vb.net Programm heraus versenden kann?
Vielen Dank
Hannes
Als API Infos habe ich:
| Zitat: |  |
Introduction
The Helium Music Manager Simple API or SA for short allows you to quickly communicate with Helium Music Manager from an external application.
The API currently contains only basic features, but might be extended in the future.
Suggestions are welcome.
The API is built on windows messages as in Winamp’s API, in order that it should be as easy as possible to interact with the SA. The code examples in this document are written for Borland Delphi, but it should be simple enough to use the same code in VB and C/C++.
All of the messages are sent in the form:
Result := SendMessage(hwnd_helium, WM_HMM_IPC, (parameter), IPC_*);
The parameter hwnd_helium can be retrieved with the following code:
hwnd_helium := FindWindow(PChar(CLASS_NAME), nil);
CLASS_NAME is equal to:
Const CLASS_NAME = 'THeliumMainForm';
If Helium Music Manager is not started or the window cannot be found for some other reason then hwnd_helium will be equal to zero.
WM_HMM_IPC is defined as:
const WM_HMM_IPC = WM_USER;
Not all messages return a result and not all messages require a parameter. This is described in detail below.
Callbacks
The messages IPC_GET_CURRENT_TRACK and IPC_GET_LIST_ITEM are a bit special and require more programming to handle than for the other messages.
Both these messages will return data back to the calling application via a callback, therefore before calling these messages you must ensure that you have defined this callback in your application. The callback itself is defined by an IPC message, IPC_SET_CALLBACK_HWND.
To define this callback, send the following IPC to Helium Music Manager:
SendMessage(wnd, WM_USER, Self.Handle, IPC_SET_CALLBACK_HWND);
Self.handle in this case is the window handle of your application, which Helium Music Manager will return data to.
The data returned from IPC_GET_CURRENT_TRACK and IPC_GET_LIST_ITEM comes as a WM_COPYDATA message which you will need to handle. In short, you should handle them in your application as shown in the code below:
Type
TForm1 = class(TForm)
Private
…
public
procedure WMCOPYDATA(var Msg: TWMCopyData); message WM_COPYDATA;
end;
…
procedure TForm1.WMCOPYDATA(var Msg: TWMCopyData);
var
sText: array[0..4096] of Char;
begin
case Msg.CopyDataStruct.dwData of
IPC_GET_CURRENT_TRACK:
begin
StrLCopy(sText, Msg.CopyDataStruct.lpData, Msg.CopyDataStruct.cbData);
// Do something with the resulting string here
end;
IPC_GET_LIST_ITEM:
begin
StrLCopy(sText, Msg.CopyDataStruct.lpData, Msg.CopyDataStruct.cbData);
// Do something with the resulting string here
end;
end;
end;
Detailed list of all available IPC messages
IPC_PLAY = 100;
This message will start to play the active track in Helium Music Manager’s Active Playlist
Parameters: None
Result: None
IPC_PLAYPAUSE = 101;
This message will pause the playback (if playing), otherwise it will resume the playback (if paused)
Parameters: None
Result: None
|  |
|  |
 | Sie sind nicht angemeldet! Um auf diesen Beitrag zu antworten oder neue Beiträge schreiben zu können, müssen Sie sich zunächst anmelden.
Einloggen | Neu registrieren |
  |
|
Neu! sevDTA 3.0 Pro 
SEPA mit Kontonummernprüfung
Erstellen von SEPA-Dateien mit integriertem BIC-Verzeichnis und Konto- nummern-Prüfverfahren, so dass ungültige Bankdaten bereits im Vorfeld ermittelt werden können. Weitere InfosTipp des Monats TOP Entwickler-Paket 
TOP-Preis!!
Mit der Developer CD erhalten Sie insgesamt 24 Entwickler- komponenten und Windows-DLLs. Die Einzelkomponenten haben einen Gesamtwert von 1866.50 EUR...
Jetzt nur 979,00 EURWeitere Infos
|
| |
|
Copyright ©2000-2025 vb@rchiv Dieter Otter Alle Rechte vorbehalten.
Microsoft, Windows und Visual Basic sind entweder eingetragene Marken oder Marken der Microsoft Corporation in den USA und/oder anderen Ländern. Weitere auf dieser Homepage aufgeführten Produkt- und Firmennamen können geschützte Marken ihrer jeweiligen Inhaber sein.
Diese Seiten wurden optimiert für eine Bildschirmauflösung von mind. 1280x1024 Pixel
|
|