unit sub; //{$DEFINE _DEBUG} {$IFNDEF DEBUG} {$UNDEF _DEBUG} {$ENDIF} interface uses Windows, Messages, SysUtils, Forms, Controls, Classes, ExtCtrls, myMessagePanel; type TApp_WallvideoSubForm = class(TForm) MyMessagePanel1: TMyMessagePanel; Timer_CheckMainPlayer: TTimer; procedure FormCreate(Sender: TObject); procedure MyMessagePanel1TextChange(Sender: TObject; Text: String); procedure Timer_CheckMainPlayerTimer(Sender: TObject); procedure FormClose(Sender: TObject; var Action: TCloseAction); private { Private 宣言 } FhMainPlayer : HWND; //メインフォームのハンドルということではない public { Public 宣言 } end; const G_csSUBPLAYER_RUN = 'SUBPLAYER_RUN'; //タスクバーがフラッシュしてしまうのを防ぐため G_csSUBPLAYER_MSG = 'FROM_SUBPLAYER'; G_csMAINPLAYER_MSG = 'FROM_MAINPLAYER'; var App_WallvideoSubForm: TApp_WallvideoSubForm; implementation uses {$IFDEF _DEBUG} myDebug, {$ENDIF} myParam; {$R *.dfm} procedure TApp_WallvideoSubForm.MyMessagePanel1TextChange(Sender: TObject; Text: String); var l_Param : TMyParam; begin {$IFDEF _DEBUG} myDebug.gpcDebug(Text); {$ENDIF} l_Param := nil; try l_Param := TMyParam.Create(Text); if (l_Param.OptionExists('CLOSE')) then begin Close; end else if (l_Param.OptionExists(G_csMAINPLAYER_MSG)) then begin FhMainPlayer := StrToIntDef(l_Param.ValueString(G_csMAINPLAYER_MSG), 0); gpcMessagePanelSend(Format('/%s:%d', [G_csSUBPLAYER_MSG, MyMessagePanel1.Handle]), FhMainPlayer); end; finally l_Param.Free; end; end; procedure TApp_WallvideoSubForm.FormClose(Sender: TObject; var Action: TCloseAction); begin Action := caFree; end; procedure TApp_WallvideoSubForm.FormCreate(Sender: TObject); begin Self.Icon := Application.Icon; SetWindowPos(Self.Handle, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOACTIVATE); ShowWindow(Self.Handle, SW_HIDE); MyMessagePanel1TextChange(nil, ParamW.MessageText); Timer_CheckMainPlayer.Enabled := True; end; procedure TApp_WallvideoSubForm.Timer_CheckMainPlayerTimer(Sender: TObject); begin if not(IsWindow(FhMainPlayer)) then begin Timer_CheckMainPlayer.Enabled := False; Close; end; end; end.