Fake media 1.60 API reference
Fake media 1.60 and later has its own API, or Application Programming Interface.
Using this API, you can order Fake media to alter the media message at any
time, without having to write an entire script yourself.
The API works through Windows-messages. You cannot
just send any random message into the window; some messages could have bad
consequences. Fake media’s API messages constants are based on WM_APP (0x8000)
and have the following values and parameters:
|
Message |
Value |
Description |
|
WM_INITIALISEAPI |
(WM_APP + 1) |
Notifies Fake media of a new application or script
to be registered. Use this if you want to make several calls to the API. Parameters: wParam:
pointer to a null-terminated string specifying the title of your window. The
string is followed by the hWnd. lParam: the
size of the pointer. To contain both the window title and its hWnd, it should be (TitleString.length
+ 1) * 2 + 4; |
|
WM_CHANGEMEDIA |
(WM_APP + 2) |
Orders Fake media to alter the media message. This
message is used to set simple media messages. To set a more complex one, see
WM_CHANGEMEDIA2 Parameters: wParam:
pointer to a null-terminated string that is used as new media message. If
this is 0 (zero), the media message will be disabled, as were the user not
listening to any music. lParam: the
size of the pointer. This should be (MessageString.length
+ 1) * 2; |
|
WM_RESETMEDIA |
(WM_APP + 3) |
Orders Fake media to disable the media message. This
is the same as sending WM_CHANGEMEDIA with wParam
0. Parameters: wParam: not used, must be
0 (zero) lParam: not used, must be
0 (zero) |
|
WM_FREEAPI |
(WM_APP + 4) |
Notifies Fake media of the previously registered
application to be unregistered. This message is only to be used when
WM_INITIALISEAPI was sent before. Parameters: wParam: not used, must be
0 (zero) lParam: hWnd of your application’s window |
|
WM_CHANGEMEDIA2 |
(WM_APP + 5) |
Sets a more complex media message. If you want to set
a simple one, WM_CHANGEMEDIA is recommended. Parameters: wParam: pointer to a NEWMEDIA
structure lParam: not used, must be
0 (zero) |
Data structures are often used to allow applications
to send more data than wParam and lParam.
Fake media also uses a data structure:
typedef struct _NEWMEDIA
|
Structure
property |
Meaning and
value |
|
Associated message |
WM_CHANGEMEDIA2 |
|
Description |
This data structure is used by WM_CHANGEMEDIA2, the
message used for more complex media messages. |
|
Size |
Size of the structure. Must be 48 |
|
TypeSize |
Size of the Type parameter. Must be (Type.length + 1) * 2. Set to 0 (zero) to use the default
type |
|
TypePtr |
Pointer to a string that contains Type. If TypeSize is 0 (zero), this parameter will be ignored |
|
TitleSize |
Size of the Title parameter. Must be (Title.length + 1) * 2. Set to 0 (zero) to use no title |
|
TitlePtr |
Pointer to a string that contains Title. If TitleSize is 0 (zero), this parameter will be ignored |
|
ArtistSize |
Size of the Artist parameter. Must be (Artist.length + 1) * 2. Set to 0 (zero) to use no artist |
|
ArtistPtr |
Pointer to a string that contains Artist. If ArtistSize is 0 (zero), this parameter will be ignored |
|
AlbumSize |
Size of the Album parameter. Must be (Album.length + 1) * 2. Set to 0 (zero) to use no album |
|
AlbumPtr |
Pointer to a string that contains Album. If AlbumSize is 0 (zero), this parameter will be ignored |
|
ContentIDSize |
Size of the ContentID
parameter. Must be (ContentID.length + 1) * 2. Set
to 0 (zero) to use no ContentID |
|
ContentIDPtr |
Pointer to a string that contains ContentID. If ContentIDSize is set
to 0 (zero), this parameter will be ignored. |
|
FormatSize |
Size of the Format parameter. Must be (Format.length + 1) * 2. Required. |
|
FormatPtr |
Pointer to a string that contains Format. required |
A working example of the API can be found here