我做了一个ActiveFrom控件,是接收组播信号的。如接收视频源。
可我现在遇到一个问题,当我在IE里能正常收看时,我在同一IE窗口的地址栏输入地址进入其他网页时,接收的声音还在。我知道是我没有关闭接收信号,可是我无法判断我的控件在IE里什么时候没有被使用,也就是我不知道控件在什么时候去关闭接收信号。但是此IE一旦关闭声音也就没有了。各位大哥帮帮小弟吧,很急呀!
可我现在遇到一个问题,当我在IE里能正常收看时,我在同一IE窗口的地址栏输入地址进入其他网页时,接收的声音还在。我知道是我没有关闭接收信号,可是我无法判断我的控件在IE里什么时候没有被使用,也就是我不知道控件在什么时候去关闭接收信号。但是此IE一旦关闭声音也就没有了。各位大哥帮帮小弟吧,很急呀!
解决方案 »
- Creport 纸张大小
- 怎么在Label里显示字符®?
- 给推荐本delphi入门的好书
- 请教又一ShellListView和ShellTreeView中的问题?还望大家多多指教!
- 怎样截获窗体的隐藏消息,然后屏蔽掉?(高手来,UP有分)
- 文件版本信息中“中文”的代码页Lang_CodePage_String是多少?我知道“英文(美国)”的Lang_CodePage_String为040904E4,但想知道中文的。
- 5.1放假了,走时再替我解决一个问题好了!
- 请教一个SQL的UPDATE语句的问题。。。
- 关于RichEdit控件。
- 高难度!有没有把utf-8转为iso-8859-1的函数或是算法?(用DELPHI写组件完成)
- Delphi利用RealAudio1控件播放出现的问题
- 数据库恢复
procedure TctvBuildup.EventSinkChanged(const EventSink: IUnknown);
begin
FEvents := EventSink as IctvBuildupEvents;
inherited EventSinkChanged(EventSink);
end;procedure TctvBuildup.Initialize;
begin
inherited Initialize;
OnActivate := ActivateEvent;
OnClick := ClickEvent;
OnCreate := CreateEvent;
OnDblClick := DblClickEvent;
OnDeactivate := DeactivateEvent;
OnDestroy := DestroyEvent;
OnKeyPress := KeyPressEvent;
OnPaint := PaintEvent;
end;function TctvBuildup.Get_Active: WordBool;
begin
Result := Active;
end;function TctvBuildup.Get_AlignDisabled: WordBool;
begin
Result := AlignDisabled;
end;function TctvBuildup.Get_AutoScroll: WordBool;
begin
Result := AutoScroll;
end;function TctvBuildup.Get_AutoSize: WordBool;
begin
Result := AutoSize;
end;function TctvBuildup.Get_AxBorderStyle: TxActiveFormBorderStyle;
begin
Result := Ord(AxBorderStyle);
end;function TctvBuildup.Get_Caption: WideString;
begin
Result := WideString(Caption);
end;function TctvBuildup.Get_Color: OLE_COLOR;
begin
Result := OLE_COLOR(Color);
end;function TctvBuildup.Get_Cursor: Smallint;
begin
Result := Smallint(Cursor);
end;function TctvBuildup.Get_DoubleBuffered: WordBool;
begin
Result := DoubleBuffered;
end;function TctvBuildup.Get_DropTarget: WordBool;
begin
Result := DropTarget;
end;function TctvBuildup.Get_Enabled: WordBool;
begin
Result := Enabled;
end;function TctvBuildup.Get_Font: IFontDisp;
begin
GetOleFont(Font, Result);
end;function TctvBuildup.Get_HelpFile: WideString;
begin
Result := WideString(HelpFile);
end;function TctvBuildup.Get_HelpKeyword: WideString;
begin
Result := WideString(HelpKeyword);
end;function TctvBuildup.Get_HelpType: TxHelpType;
begin
Result := Ord(HelpType);
end;function TctvBuildup.Get_KeyPreview: WordBool;
begin
Result := KeyPreview;
end;function TctvBuildup.Get_PixelsPerInch: Integer;
begin
Result := PixelsPerInch;
end;function TctvBuildup.Get_PrintScale: TxPrintScale;
begin
Result := Ord(PrintScale);
end;function TctvBuildup.Get_Scaled: WordBool;
begin
Result := Scaled;
end;function TctvBuildup.Get_Visible: WordBool;
begin
Result := Visible;
end;function TctvBuildup.Get_VisibleDockClientCount: Integer;
begin
Result := VisibleDockClientCount;
end;procedure TctvBuildup._Set_Font(var Value: IFontDisp);
begin
SetOleFont(Font, Value);
end;procedure TctvBuildup.ActivateEvent(Sender: TObject);
begin
if FEvents <> nil then FEvents.OnActivate;
end;procedure TctvBuildup.ClickEvent(Sender: TObject);
begin
if FEvents <> nil then FEvents.OnClick;
end;procedure TctvBuildup.CreateEvent(Sender: TObject);
begin
if FEvents <> nil then FEvents.OnCreate;
end;procedure TctvBuildup.DblClickEvent(Sender: TObject);
begin
if FEvents <> nil then FEvents.OnDblClick;
end;procedure TctvBuildup.DeactivateEvent(Sender: TObject);
begin
if FEvents <> nil then FEvents.OnDeactivate;
end;procedure TctvBuildup.DestroyEvent(Sender: TObject);
begin
if FEvents <> nil then FEvents.OnDestroy;
end;procedure TctvBuildup.KeyPressEvent(Sender: TObject; var Key: Char);
var
TempKey: Smallint;
begin
TempKey := Smallint(Key);
if FEvents <> nil then FEvents.OnKeyPress(TempKey);
Key := Char(TempKey);
end;procedure TctvBuildup.PaintEvent(Sender: TObject);
begin
if FEvents <> nil then FEvents.OnPaint;
end;procedure TctvBuildup.Set_AutoScroll(Value: WordBool);
begin
AutoScroll := Value;
end;procedure TctvBuildup.Set_AutoSize(Value: WordBool);
begin
AutoSize := Value;
end;procedure TctvBuildup.Set_AxBorderStyle(Value: TxActiveFormBorderStyle);
begin
AxBorderStyle := TActiveFormBorderStyle(Value);
end;procedure TctvBuildup.Set_Caption(const Value: WideString);
begin
Caption := TCaption(Value);
end;procedure TctvBuildup.Set_Color(Value: OLE_COLOR);
begin
Color := TColor(Value);
end;procedure TctvBuildup.Set_Cursor(Value: Smallint);
begin
Cursor := TCursor(Value);
end;procedure TctvBuildup.Set_DoubleBuffered(Value: WordBool);
begin
DoubleBuffered := Value;
end;procedure TctvBuildup.Set_DropTarget(Value: WordBool);
begin
DropTarget := Value;
end;
procedure TctvBuildup.Set_Enabled(Value: WordBool);
begin
Enabled := Value;
end;procedure TctvBuildup.Set_Font(const Value: IFontDisp);
begin
SetOleFont(Font, Value);
end;procedure TctvBuildup.Set_HelpFile(const Value: WideString);
begin
HelpFile := String(Value);
end;procedure TctvBuildup.Set_HelpKeyword(const Value: WideString);
begin
HelpKeyword := String(Value);
end;procedure TctvBuildup.Set_HelpType(Value: TxHelpType);
begin
HelpType := THelpType(Value);
end;procedure TctvBuildup.Set_KeyPreview(Value: WordBool);
begin
KeyPreview := Value;
end;procedure TctvBuildup.Set_PixelsPerInch(Value: Integer);
begin
PixelsPerInch := Value;
end;procedure TctvBuildup.Set_PrintScale(Value: TxPrintScale);
begin
PrintScale := TPrintScale(Value);
end;procedure TctvBuildup.Set_Scaled(Value: WordBool);
begin
Scaled := Value;
end;procedure TctvBuildup.Set_Visible(Value: WordBool);
begin
Visible := Value;
end;procedure TctvBuildup.CameraControl(cCamCode: char);
var
sData : string;
begin
sData := C_CON_CAMERA + cCamCode + '1'; // cCamNum;
tcpCatvClient.Socket.SendText(sData);
end;procedure TctvBuildup.ParaOutput(bCode: byte);
begin
Out32($378, bCode);
end;
procedure TctvBuildup.EnableControl(bControl: boolean);
begin
//cnlMenuRecord.Enabled := bControl;
cnlMenuUp.Enabled := bcontrol;
cnlMenuDown.Enabled := bControl;
cnlMenuleft.Enabled := bcontrol;
cnlMenuRight.Enabled := bControl;
cnlMenuUp.Enabled := bcontrol;
cnlMenuAuto.Enabled := bControl;
cnlMenuAdd.Enabled := bcontrol;
cnlMenuSub.Enabled := bcontrol;
end;//-------------------------------------------------------------------
//procedure ncptBuildup(bldpIp:String)
//
//into parameter:
// bldpIp:BuildUp Ip address
//
//
//2004.6.16 code by Jockey - AVC
//-------------------------------------------------------------------procedure TctvBuildup.ncptBuildup(bldpIp:String);
var
j : integer;
iViewPort : integer;
iCastPort : integer;
iCastAddr : integer;
sCastAddr : string;
begin
if sViewip<>'' then
begin
// sviewip := '192.168.0.26';
iCastAddr := 0;
iViewPort := 0;
for j := Length(sViewIp) - 1 downto 1 do
if sViewIp[j] = '.' then
begin
sCastAddr := Copy(sViewIp, j + 1, Length(sViewIp) - j);
iCastAddr := StrToInt(sCastAddr);
sCastAddr := '234.0.1.' + sCastAddr;
break;
end;
iCastPort := 10000 + iCastAddr shl 6 + iViewPort shl 1; aVideoInfo.nChannel := 0;
aVideoInfo.nSendMode := 2;
aVideoInfo.psAddress := pChar(sViewIp);
aVideoInfo.bUserCheck := false;
aVideoInfo.hShowVideo := pnlView.Handle; MP4_ClientAudioStop();
MP4_ClientStop(iHandle1);
pnlView.Refresh;
iHandle1 := MP4_ClientStart(@aVideoInfo, nil);
MP4_ClientCastGroup(iHandle1, pChar(sCastAddr), iCastPort);
MP4_ClientAudioStart(iHandle1);
if sCapture = '1' then
cnlMenuRecord.Enabled := True
else if sCapture = '0' then
cnlMenuRecord.Enabled := False; if sCortrol = '1' then
bConAllow := true;
if sCortrol = '0' then
bConAllow := false;
EnableControl(bConAllow);
if pro = '0' then
begin
tcpCatvClient.Close;
tcpCatvClient.Address := sViewIp;
tcpCatvClient.Open;
end;
end;
end;procedure TctvBuildup.ActiveFormCreate(Sender: TObject);
var str :pchar;
begin
tmStart := false;
//cnlBtnInitialize(false,'',True);
winHwnd := GetActiveWindow ;
end;//-------------------------------------------------------------------
//procedure cntrlBtnShw(shw:String)
//
//control graph's size
//
//into parameter:
// no
//
//
//2004.6.16 code by Jockey - AVC
//-------------------------------------------------------------------
procedure TctvBuildup.cntrlBtnShw;
var
dd,mm,hh:hwnd;
begin
pnlView.Height := height;
pnlView.Width := width; { dd:= findwindow(nil,'ctvBuildup');
// ie := GetTopWindow(dd);
mm := GetActiveWindow;
dd:=GetForegroundWindow;
if dd = 0 then
begin
tcpCatvClient.Close;
MP4_ClientAudioStop();
MP4_ClientStop(iHandle1);
end; }
end;procedure TctvBuildup.cnlMenuRecordClick(Sender: TObject);
begin
if not cnlRecord then
begin
if dlgSave.Execute then
begin
MP4_ClientStartCaptureFile(iHandle1, pChar(dlgSave.FileName));
end;
cnlMenuRecord.Caption := '停止录像';
end
else
begin
MP4_ClientStopCapture(iHandle1);
cnlMenuRecord.Caption := '开始录像';
end;
cnlRecord := not cnlRecord
end;//-------------------------------------------------------------------
//procedure cnlBtnInitialize(init:boolean,cnlBtn:String,btnAll:boolean)
//
//Initialize 'up' and 'down' and 'left' and 'right'
//
//into parameter:
// init
// true ---move
// False ---stop
// cnlBtn ---button's name
// btnAll ---initialize all btn to init
//
//
//2004.6.16 code by Jockey - AVC
//-------------------------------------------------------------------
procedure TctvBuildup.cnlBtnInitialize(init:boolean;cnlBtn:String;btnAll:boolean);
begin
if btnAll then
begin
msUp := init;
msDown := init;
msLeft := init;
msRight := init;
end
else
if cnlBtn = 'Left' then
begin
msUp := not init;
msDown := not init;
msLeft := init;
msRight := not init;
end
else if cnlBtn = 'Right' then
begin
msUp := not init;
msDown := not init;
msLeft := not init;
msRight := init;
end
else if cnlBtn = 'Up' then
begin
msUp := init;
msDown := not init;
msLeft := not init;
msRight := not init;
end
else if cnlBtn = 'Down' then
begin
msUp := not init;
msDown := init;
msLeft := not init;
msRight := not init;
end;
end;
procedure TctvBuildup.cnlMenuAutoClick(Sender: TObject);
begin
CameraControl('a');
end;procedure TctvBuildup.cnlMenuUpClick(Sender: TObject);
begin
CameraControl('u');
end;procedure TctvBuildup.cnlMenuDownClick(Sender: TObject);
begin
CameraControl('d');
end;procedure TctvBuildup.cnlMenuLeftClick(Sender: TObject);
begin
CameraControl('l');
end;procedure TctvBuildup.cnlMenuRightClick(Sender: TObject);
begin
CameraControl('r');
end;procedure TctvBuildup.cnlMenuAddClick(Sender: TObject);
begin
CameraControl('m');
end;procedure TctvBuildup.cnlMenuSubClick(Sender: TObject);
begin
CameraControl('n');
end;procedure TctvBuildup.N1Click(Sender: TObject);
begin
CameraControl('s');
end;procedure TctvBuildup.pnlViewClick(Sender: TObject);
begin
CameraControl('s');
end;procedure TctvBuildup.pnlViewMouseMove(Sender: TObject; Shift: TShiftState;
X, Y: Integer);
begin
if (x >0) and (x < 30) then
begin
cnlBtnInitialize(True,'Left',False);
//Screen.Cursors[24] := LoadCursor(HInstance, 'E:\Tian\ico00003.ico');
//pnlview.Cursor :=24;
pnlview.Cursor := crSizeAll;
end
else if (y > 0) and (y < 30) and (x > 30) and (x < width - 30) then
begin
cnlBtnInitialize(True,'Up',False);
pnlview.Cursor := crSizeAll
end
else if (x > width - 30) then
begin
cnlBtnInitialize(True,'Right',False);
pnlview.Cursor := crSizeAll
end
else if (y > height - 30) and (x > 30) and (x < width - 30) then
begin
cnlBtnInitialize(True,'Down',False);
pnlview.Cursor := crSizeAll
end
else
pnlview.Cursor := crDefault;
end;procedure TctvBuildup.pnlViewMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
CameraControl('s');
cnlBtnInitialize(false,'',True);
end;procedure TctvBuildup.pnlViewMouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
if msLeft and (pnlview.Cursor = crSizeAll) then CameraControl('l')
else if msUp and (pnlview.Cursor = crSizeAll) then CameraControl('u')
else if msRight and (pnlview.Cursor = crSizeAll) then CameraControl('r')
else if msDown and (pnlview.Cursor = crSizeAll) then CameraControl('d');
end;procedure TctvBuildup.Timer1Timer(Sender: TObject);
begin
if tmStart = false then
begin
ncptBuildup(sViewip);
tmStart := true;
end;
cntrlBtnShw;
end;function TctvBuildup.Get_IP: WideString;
beginend;procedure TctvBuildup.Set_IP(const Value: WideString);
begin
sViewip := Value;
end;function TctvBuildup.Get_sCptr: WideString;
beginend;procedure TctvBuildup.Set_sCptr(const Value: WideString);
begin
sCortrol := Value;
end;function TctvBuildup.Get_sCl: WideString;
beginend;procedure TctvBuildup.Set_sCl(const Value: WideString);
begin
sCapture := Value;
end;function TctvBuildup.Get_pro: WideString;
beginend;procedure TctvBuildup.Set_pro(const Value: WideString);
begin
pro := Value;
end;procedure TctvBuildup.ActiveFormDestroy(Sender: TObject);
begin
//IctvBuildupEvents
end;initialization
TActiveFormFactory.Create(
ComServer,
TActiveFormControl,
TctvBuildup,
Class_ctvBuildup,
1,
'',
OLEMISC_SIMPLEFRAME or OLEMISC_ACTSLIKELABEL,
tmApartment);
end.