我以前对这个问题回答过,结果被高手嗤之以鼻。呵呵。我给你看一件作品的部分内容:
IPC_GETVERSION = 0;
(*
** int version = SendMessage(hwnd,WM_WA_IPC,0,IPC_GETVERSION);
**
** Version will be 0x20yx for Applica 2.yx. versions previous to Applica 2.0
** typically (but not always) use 0x1zyx for 1.zx versions. Weird, I know.
**
** The basic format for sending messages to Applica is:
** int Result=SendMessage(hwnd,WM_WA_IPC,command_data,command);
** (for the version check, command_data is 0).
*)
IPC_DELETE = 101;
(*
** SendMessage(hwnd,WM_WA_IPC,0,IPC_DELETE);
**
** You can use IPC_DELETE to clear Applica's internal playlist.
*)
IPC_STARTPLAY = 102;
(*
** SendMessage(hwnd,WM_WA_IPC,0,IPC_STARTPLAY);
**
** Using IPC_STARTPLAY is like hitting 'Play' in Applica, mostly.
*)
IPC_ISPLAYING = 104;
(*
** int res = SendMessage(hwnd,WM_WA_IPC,0,IPC_ISPLAYING);
**
** IPC_ISPLAYING returns the status of playback.
** if it returns 1, it is playing. if it returns 3, it is paused,
** if it returns 0, it is not playing.
*)
IPC_GETOUTPUTTime = 105;
(*
** int res = SendMessage(hwnd,WM_WA_IPC,mode,IPC_GETOUTPUTTime);
**
** IPC_GETOUTPUTTime returns the position in milliseconds of the
** current song (mode = 0), or the song Length, in seconds (mode = 1).
** Returns -1 if not playing or error.
*)
IPC_JUMPTOTIME = 106;
(* (requires Applica 1.60+)
** SendMessage(hwnd,WM_WA_IPC,ms,IPC_JUMPTOTIME);
** IPC_JUMPTOTIME sets the position in milliseconds of the
** current song (approximately).
** Returns -1 if not playing, 1 on eof, or 0 if successful
*)
IPC_WRITEPLAYLIST = 120;
(* (requires Applica 1.666+)
** SendMessage(hwnd,WM_WA_IPC,0,IPC_WRITEPLAYLIST);
**
** IPC_WRITEPLAYLIST writes the current playlist to <Applicadir>//Applica.msd,
** and returns the current playlist position.
** Kinda obsoleted by some of the 2.x new stuff, but still good for when
** using a front-end (instead of a plug-in)
*)
IPC_SETPLAYLISTPOS = 121;
(* (requires Applica 2.0+)
** SendMessage(hwnd,WM_WA_IPC,position,IPC_SETPLAYLISTPOS)
**
** IPC_SETPLAYLISTPOS sets the playlsit position to 'position'.
*)
IPC_SETVOLUME = 122;
(* (requires Applica 2.0+)
** SendMessage(hwnd,WM_WA_IPC,volume,IPC_SETVOLUME);
**
** IPC_SETVOLUME sets the volume of Applica (from 0-255).
*)
IPC_SETPANNING = 123;
(* (requires Applica 2.0+)
** SendMessage(hwnd,WM_WA_IPC,panning,IPC_SETPANNING);
**
** IPC_SETPANNING sets the panning of Applica (from 0 (Left) to 255 (Right)).
*)
IPC_GETLISTLENGTH = 124;
(* (requires Applica 2.0+)
** int Length = SendMessage(hwnd,WM_WA_IPC,0,IPC_GETLISTLENGTH);
**
** IPC_GETLISTLENGTH returns the Length of the current playlist, in
** tracks.
*)
IPC_SETSKIN = 200;
(* (requires Applica 2.04+, only usable from plug-ins (not external apps))
** SendMessage(hwnd,WM_WA_IPC,(WPARAM)"skinname",IPC_SETSKIN);
**
** IPC_SETSKIN sets the current skin to "skinname". Note that skinname
** can be the name of a skin, a skin .zip file, with or without path.
** if path isn't specified, the default search path is the Applica skins
** directory.
*)
上面是一个定义自己的消息的公共单元,他们都对应一个 CopyData 数据,看 Delphi
Windows API 帮助 COPYDATASTRUCT 和 WM_COPYDATA 对它的说明。上例是一个复杂程序
的内容,你的相对简单,定义结构后直接 SendMessage(HWND,Msg_Type,wParam,lParam)
就可以使用消息来变相多线程。