怎样编程滚动WebBrowser中的内容(50分)

  • 主题发起人 主题发起人 avant
  • 开始时间 开始时间
A

avant

Unregistered / Unconfirmed
GUEST, unregistred user!
我采用模拟按键Keybd_event,但是,WebBrowser非常容易失去焦点,而它
又不响应SetFocus函数,它的Hwnd好象不能接受发给它的消息。帮帮忙呀,谢谢
大家。
 
postmessage(webbrowser1.handle,?,wm_VKdown,?)
差不多就是这样,具体查下帮助吧.
 
不行呀!
 
发消息没有响应的,谁有别的妙法?多谢!分不够还可再加!
 
应该有人会呀!
-----好不遗憾的说...
 
你可用Tmarquee的OCX就可以解决你的问题,我把家庭自动化的结果透过WebBrowser通知给其它住户的主画面程序Show出

unit Main;

interface

uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ExtCtrls, Global, ARCAPATXLib_TLB, SHDocVw_TLB, mmsystem, DB,
StdCtrls, MarqueeObjects_TLB, GDamAtx_TLB, MSWinsockLib_TLB, Menus,
OleCtrls;

type
TfrmStatusBar = class(TForm)
MemoHtm: TMemo;
Panel4: TPanel;
Marquee1: TMarquee;
Panel1: TPanel;
Button1: TButton;
Button2: TButton;
Panel2: TPanel;
btnfalseAlarm: TButton;
Timer1: TTimer;
PopupMenu1: TPopupMenu;
N1: TMenuItem;
Panel5: TPanel;
ImgLogo: TImage;
Winsock1: TWinsock;
procedure FormCreate(Sender: TObject);
procedure ImgLogoDblClick(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
procedure Winsock1DataArrival(Sender: TObject
bytesTotal: Integer);
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure GDamX1Error(Sender: TObject
Err: Integer;
const Msg: WideString);
procedure GDamX1Fail(Sender: TObject
Err: Integer;
const Msg: WideString);
procedure Marquee1LMouseClick(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure btnFalseAlarmClick(Sender: TObject);
procedure N1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
frmStatusBar: TfrmStatusBar;
GDamX:array of TGDamX
// 动态增加 ADAM 组件
ElectTimer: TDateTime
// 侦测 电器起始时间关闭时间 (every 60 seconds)
WebPgTimer: TDateTime
// 更换小广告网页 (every 10 seconds)
AdamDetcTimer: TDateTime
// 侦破时间 (every second)
BrowserTimer: TDateTime
//更新 main form 上 Marquee 的讯息 every 60 seconds)
TalkTimer:TDateTime
// 等待对讲对象 60 秒
RecordTimer:TDateTime
// 计算录像时间
WallPaperTimer:TDateTime;
j:integer
// 更换壁画用
CurTime:TDateTime;

implementation

uses Menu, DataModule, Browser, Setting, Records, RecMsg, SetTime, warning, AboutBox,
Wallpaper,uttemp, TimerDlg1, security;

{$R *.DFM}


procedure TfrmStatusBar.FormCreate(Sender: TObject);
var i:integer;
begin
SetLength(GDAMX,TotalModule);
for i := 0 to TotalModule-1 do
begin
GDamX:=TGDamX.Create(self);
GDamX.DevNum:=Modules.DevNum;
GDamX.DevType:=Modules.DevType;
GDamX.TempScale:=Modules.TempScale;
GDamX.TCtype:=Modules.TCtype;
GDamX.Enable;
end;
left:=0;
top:=397;
height:=84;
width:=640;
Talkflag:=0
// 未通话
QryFlag:=True;
ShowMenu:=True;
ShowImage:=False;
Marquee1.ScrollPixelsX:=0;
Marquee1.ScrollPixelsY:=-5;
Marquee1.ScrollDelay:=400;
Marquee1.insertURL(0,sysdir +'/Work.htm');
ElectTimer:=timegettime;
WebPgTimer:=timegettime;
BrowserTimer:=timegettime;
AdamDetcTimer:=timegettime;
j:=0;

Winsock1.Protocol:=sckUDPProtocol
// 设定使用 UDP
Winsock1.Bind_(3000,LocData.ComputerName)
// 设定本机在接收讯息状态

// 从 ini 文件中取得一些默认值
GetPrivateProfileString('Record','AviPath','Wrong',Temp2,Sizeof(Temp2),
Pchar(INIFile));
AviPath:=Temp2;
try
ChDir(AviPath);
except
Avipath:=sysdir +'/MsgAvi';
end;
chdir(sysdir);

GetPrivateProfileString('ChkHardDisk','HD Space','Wrong',Temp10,Sizeof(Temp10),
Pchar(INIFile));
HDMem:=strtoint(Temp10);
GetPrivateProfileString('OverDueMsg','DelDay','Wrong',Temp7,Sizeof(Temp7),
Pchar(INIFile));
GetPrivateProfileString('Record','SetRecTime','Wrong',Temp6,Sizeof(Temp6),
Pchar(INIFile));
GetPrivateProfileString('Record','SetLogDelTime','Wrong',TmpSetLogDelTime,Sizeof(TmpSetLogDelTime),
Pchar(INIFile));
end;

procedure TfrmStatusBar.ImgLogoDblClick(Sender: TObject);
begin
frmAboutBox.show;
end;

procedure TfrmStatusBar.Timer1Timer(Sender: TObject);
var now1:TDateTime;
i,z,BitSwitch:integer;
LocLogIdx,MsgOut,LogTime:string;
bAct:Boolean;
begin
now1:=timegettime;

// 程序执行开始动作 begin//
if QryFlag=True then
begin // 取得系统暂存资料文件 // All the connected unit records
QryFlag:=False
// 让本段程序不再执行
ReSysMemory;
WriteTmpMsg;
Marquee1.deleteURL(0)
//写入 Marquee
MemoHtm.Clear;
TmpHtmOld:=TmpHtmNew;
MemoHtm.Lines.Add(TmpHtmOld);
MemoHtm.Lines.SaveToFile(sysdir +'/Work.htm');
Marquee1.insertURL(0,sysdir +'/Work.htm');
frmMenu.NotTalklbl;

if ShowMenu=True then // 取得小广告 htm 檔
begin
frmMenu.show;
// frmMenu.WBAds.Navigate('//arise/CommHP/cf0.htm',flag,tfn,pd,header);
frmMenu.WBAds.Navigate(htmdir+'/cf0.htm',flag,tfn,pd,header);
ShowMenu:=False;
end;
end;
// 程序执行开始动作 end//


// 对讲 60秒 等待时间 // 他人要求留时也会 OnLineFlag=True
//if OnLineFlag=True then
if talkflag=2 then // 已发出通话中
begin
with frmMenu do
begin
if now1-TalkTimer>=60000 then
begin
talkflag:=0
// 未通话
TalkTimer:=timegettime;
OnLineFlag:=False;
panel7.Caption:='未通话';
// 显示对话框
timerDlg.autoclose:=false;
timerDlg.fclblMsg.Caption:= '对方无人响应';
timerDlg.showmodal;
//

{
Label21.Visible:=True;
Label21.Caption:='无人响应';
}
NotTalklbl;
TalkFlag:=0
// 未通话
//LBoxUnitName.Visible:=True;
Panel4.Caption:='';
end;
end;
end;


// 他户来电 60秒 等待时间
if talkflag=3 then // 已收到通话要求
begin
with frmMenu do
begin
if now1-TalkTimer>=60000 then
begin

talkflag:=0
// 未通话
frmstatusbar.panel1.Visible:=false;
OnLineFlag:=False;
{
TalkTimer:=timegettime;

panel7.Caption:='未通话';
// 显示对话框
timerDlg.autoclose:=false;
timerDlg.fclblMsg.Caption:= '对方无人响应';
timerDlg.showmodal;
//
NotTalklbl;
TalkFlag:=0
// 未通话
//LBoxUnitName.Visible:=True;
Panel4.Caption:='';
}
end;
end;
end;

{
// 计算录像时间 //
if RecordFlag=True then
begin
with frmMenu do
begin
if now1-RecordTimer>=strtoint(Temp6) then
begin
frmMenu.SpBtnEndCapClick(self);
RecordTimer:=timegettime;
RecordFlag:=False;
end;
end;
end;
}
// 更换壁画 //
if frmImage.Visible=True then
begin
if now1-WallPaperTimer>=10000 then
begin
WallPaperTimer:=timegettime;
with frmImage do
begin
if FileExists(sysdir+'/Image/WallPaper'+(inttostr(j))+'.bmp')=True then
begin
frmImage.Image1.Picture.LoadFromFile(sysdir+'/Image/WallPaper'+(inttostr(j))+'.bmp');
j:= j + 1;
end else
begin
j:=0;
end;
end;
end;
end;

// 更换小广告网页 //
if frmMenu.Visible=True then
begin
frmMenu.lblLocalTime.Caption:=Datetimetostr(now);
if now1-WebPgTimer>=15000 then
begin
WebPgTimer:=timegettime;
with frmMenu do
begin
if FileExists(htmdir+'/cf'+(inttostr(j))+'.htm')=True then
begin
//HtmP:='//arise/CommHP/cf'+(inttostr(j))+'.htm';
//WBAds.Navigate (HtmP,flag,tfn,pd,header);
WBAds.Navigate(Htmdir+'/cf'+(inttostr(j))+'.htm',flag,tfn,pd,header);
j:= j + 1;
end else
begin
j:=0;
end;
end;
end;
end;

// check Adam status every second //
if now1-AdamDetcTimer>=1000 then
begin
for i:=0 to TotalModule-1 do // DI 侦测
with Modules do
begin
if Polling and (pDI>-1) and GDamX.Active then
begin
GDamX.Read(0);
DIval:=GDamX.DIVal and IOSet[pDI].ifON;
DIval:=Dival xor IOSet[pDI].ifNO;
end
else DiVal:=0;
end;
for i:=0 to TotalPoint-1 do // AI 侦测
with Points do
if (IoSet[pIO].Sort=2) then
begin
GDamX[pDev].Read(Bit);
Modules[pDev].AIval[Bit]:=GDamx[pDev].AIVal;
end;

// insert Test Value

// 保全侦测并做相关处理
for i:=0 to TotalPoint-1 do
with Points do
if ((IOSet[pIO].ifOn and BitValue[Bit])=BitValue[Bit]) then //是否作用中
begin
case ActType of
0:case IoSet[pIO].Sort of // 保全
0: if((Modules[pDev].DIval and Bitvalue[Bit]) = Bitvalue[Bit])then
begin
if ActFlag=False then
begin
DataModule1.tblLocLog.Last;
LocLogIdx:=inttostr(DataModule1.tblLocLog.FieldByname('LogIdx').asInteger+1);
LogTime:=SockTime(EDatetoCstr(now));
MsgOut:=FillSpc(DefaultLoc,12)+FillSpc('<'+Location+'>',12)
+FillSpc(Position,12)+FillSpc(Equip,12);
if (NotifyClass and $80)=$80 then // 传给管理员
WinSockDataOut(UnitBA,'11'+MsgOut);

if (NotifyClass and $40)=$40 then // 传给联防住户
for z := 0 to Lng-1 do
WinSockDataOut(UDefance[z].ComputerName,'11'+MsgOut);
if (NotifyClass and $20)=$20 then // 传给托管住户
for z := 0 to AllianceSysCnt-1 do
WinSockDataOut(SysAlliance[z].ComputerName,'11'+MsgOut);
//if (NotifyClass and $10)=$10 then // 传给保全公司
MsgOut:=FillSpc(LogTime,14)+MsgOut;
DspWarning(25,MsgOut)
//write into SvrLog and LocLog
WriteToSvrLog(MsgOut);
end;
ActFlag:=True;
if ShowImage= true then frmImage.Image1DblClick(frmImage);
// 将壁画页关闭 显示保全警示
end
else ActFlag:=False;
end;
1:
//照明
2:
//电器
3:case IoSet[pIO].Sort of //对讲
0: if((Modules[pDev].DIval and Bitvalue[Bit]) = Bitvalue[Bit])then
begin
panel1.Visible:=True;
Button1.Visible:=True
// 接听
panel1.Caption:=' 门铃响了 !! ';
frmMenu.lblCallIn.Caption:='门口机';
sndplaysound('Notify.wav',SND_ASYNC);
TalkTimer:=TimeGetTime
// 通话定时器
OnLineFlag:=True;
talkflag:=3;
end;
2:;
end;
4:
//电路
5:
//其它
end;
end;
AdamDetcTimer:=timegettime;
end;

// 电器预约 时间到所做运算 begin //
CurTime:=Now;
if OldMinuteValue<>GetMinute(CurTime) then
begin
OldMinuteValue:=GetMinute(CurTime);
for i:= 0 to SysAppointCnt-1 do
with Points[MatchPointByPNo(SysAppoint.PointNo)] do
begin
if MatchTime(CStrToEDateTime(SysAppoint.StartTime),CurTime) then BitSwitch:=0
else if MatchTime(CStrToEDateTime(SysAppoint.EndTime),CurTime) then BitSwitch:=BitValue[Bit]
else BitSwitch:=-1;
if BitSwitch<>-1 then
case SysAppoint.Power of // Check if State or On/Off
0:begin
IOSet[pIO].ifOn:=IOSet[pIO].ifOn Or Bitvalue[Bit]
//Turn to 1 First
if BitSwitch=BitValue[Bit] then
IOSet[pIO].ifOn:=IOSet[pIO].ifOn Xor Bitvalue[Bit]
//Set to 0;
end;
1:if((IOSet[pIO].ifOn and Bitvalue[Bit])=BitValue[Bit]) then
begin
bAct:=False;
case IOSet[pIO].Sort of
0,2:
//DI,AI 输入型态 之 开关预约 将被忽略
1:case ActType of //DO输出型态
0:;
1:begin
if BitSwitch>0 then Bitswitch:=Bitvalue[Points[PairPNo].Bit];
if ((Modules[Points[PairPNo].pDev].DIval and BitValue[Points[PairPNo].Bit])= BitSwitch) then bAct:=True
//Wrong Fomula
end;
2:if ((GDamX[pDev].DOval and BitValue[Bit])= BitSwitch) then bAct:=True;
3:;
4:;
5:;
end;
3:
//AO输出型态 暂时忽略
end;
if bAct then
begin
GDamX[pDev].DOval := GDamX[pDev].DOval xor Bitvalue[Bit];
GDamX[pDev].Send(0);
end;
end;
end;
end;
ElectTimer:=timegettime;
end;
// 电器预约 时间到所做运算 end //


// 更新 main form 上 Marquee 的讯息 begin //
if now1-BrowserTimer>=6000 then
begin
BrowserTimer:=timegettime;
if TmpHtmNew<> TmpHtmOld then
begin
Marquee1.deleteURL(0);
MemoHtm.Clear;
TmpHtmOld:=TmpHtmNew;
MemoHtm.Lines.Add(TmpHtmOld);
MemoHtm.Lines.SaveToFile(sysdir +'/Work.htm');
Marquee1.insertURL(0,sysdir +'/Work.htm');
end;
// 比对时间 删除留言 //
{
With DataModule1.tblRecords do
begin
if RecordCount<>0 then // 有记录才检查
begin
First;
for iM := 0 to MsgRecCnt-1 do
begin
TmpMsgTime:=FieldByName('MsgTime').asstring;
if CStrToEDateDel(TmpMsgTime) < OCStrToEDateDel(Temp7) then
begin
Edit;
Delete;
end;
next;
end;
end;
end;
}
{
// 比对时间 删除LocLog //
with DataModule1.tblLocLog do
begin
First;
for iM := 0 to LogRecCnt-1 do
begin
TmpLogDate:=FieldByName('LogDate').asstring;
if CStrToEDateDel(TmpLogDate) < OCStrToEDateDel(TmpSetLogDelTime) then
begin
Edit;
Delete;
end;
next;
end;
end;
}
end;
// 更新 main form 上 Marquee 的讯息 begin //


// 显示保全 Dialog (会自动关闭) //
if bAlarmDlg=True and(now1-ShowDlgTimer>=60000)then btnFalseAlarmClick(self);

// 防止timegettime 值过大 //
if now1-ShowDlgTimer<0 then
begin
ShowDlgTimer:=timegettime;
end;
if now1-TalkTimer<0 then
begin
TalkTimer:=timegettime;
end;
if now1-ElectTimer<0 then
begin
ElectTimer:=timegettime;
end;
if now1-WebPgTimer<0 then
begin
WebPgTimer:=timegettime;
end;
if now1-AdamDetcTimer<0 then
begin
AdamDetcTimer:=timegettime;
end;
if now1-WallPaperTimer<0 then
begin
WallPaperTimer:=timegettime;
end;
if now1-BrowserTimer<0 then
begin
BrowserTimer:=timegettime;
end;
if now1-RecordTimer<0 then
begin
RecordTimer:=timegettime;
end;

end;

// WinSock 接收资料的处理
procedure TfrmStatusBar.Winsock1DataArrival(Sender: TObject;
bytesTotal: Integer)
//All data is from other users
var txt:olevariant;
receive_data,sAlliance:string;
i,itype,iState:integer;
copyfrom,copyto:string;
begin
winsock1.getdata(txt,8,200)
// 接收资料
receive_data:=string(txt);
TmpData.UnitName:=trimright(copy(receive_data,1,20))
// 讯息来源的户名

{ // 显示暂用的 Form --------
frmTemp.Edit1.Text:=TmpData.UnitName;
frmTemp.Edit2.Text:=copy(receive_data,21,1)
// 讯息类别
frmTemp.Edit3.Text:=copy(receive_data,22,80);
frmTemp.Show;
// ------------------------
}
// 依送讯的住户名称,得到其ComputerName及Channel //
for i:= 0 to RecCnt-1 do
begin
if LowerCase(PrepareData.UnitName)=LowerCase(TmpData.UnitName) then
begin
TmpData.ComputerName:= PrepareData.ComputerName
// 讯息来源的计算机名称
TmpData.Channel:= PrepareData.Channel
// 讯息来源的频道
Break;
end;
end;
ProtoTyp:=copy(receive_data,21,1)
// 讯息类别
itype:=strtoint(ProtoTyp);

case itype of
// 保全 begin -------------------------------------------------------
1:begin
ProtoMsg:= copy(receive_data,22,1);
iState:=strtoint(ProtoMsg);
ProtoContain:=TmpData.UnitName+copy(receive_data,23,50)+'有状况';
case iState of
1: DspWarning(1,ProtoContain)
//保全
end;
end;
// 保全 end -------------------------------------------------------

// 留言 begin ------------------------------------------------------
2:begin
ProtoMsg:= copy(receive_data,22,1);
iState:=strtoint(ProtoMsg);
case iState of
1: begin // 对方要求留言
msgidx:=copy(receive_data,78,13);
with DataModule1.tblRecords do /// Save to table ///
begin
Insert;
FieldValues['MsgIdx'] :=msgidx
FieldValues['UnitName'] :=LocData.UnitName;
FieldValues['MemberName'] :='';
FieldValues['MsgTime'] :=copy(receive_data,23,15);;
FieldValues['Subject'] :=copy(receive_data,38,40);;
FieldValues['Open'] :=True;
FieldValues['CFirm'] :=False;
FieldValues['FromUnit'] :=TmpData.UnitName;
FieldValues['FromWho'] :=copy(receive_data,91,10);
Post;
close;
open;
try
// 将 Temp 中的档案移到 Msgavi
copyfrom:='//'+locdata.ComputerName+'/temp/'+MsgIdx+'.avi';
copyto:= avipath+'/'+MsgIdx+'.avi';
copyfile(pchar(copyfrom),pchar(copyto),false);
deletefile(copyfrom);
except
end;
ReSysMemory
// 更新系统内存
WriteTmpMsg
// 写入 marquee
end;
WinSockDataOut(TmpData.ComputerName,'22');
end;
2: begin //对方已经接收完毕
// 显示对话框
timerDlg.autoclose:=false;
timerDlg.fclblMsg.Caption:= '对方已收到视讯邮件!';
timerDlg.showmodal;
//要写用 WinSock 传档案部份
end;
end;
end;
// 留言 end ------------------------------------------------------

// 对讲 begin --------------------------------------------------------
3:begin
ProtoMsg:= copy(receive_data,22,1);
iState:=strtoint(ProtoMsg);
// 依状态码处理
case iState of
// 对方要求结束 begin *******************
0:begin
if TmpData.UnitName = TalkData.UnitName then // 确认对象
begin
try
captalk.free;
TalkData.UnitName:='';
TalkData.ComputerName:='';
except
end;
if RequestAlliance=True then // 若是在要求托管状态 回托管画面
begin
StartX:=3;
frmMenu.Close;
end;
with frmMenu do
begin
talkflag:=0
// 未通话
NotTalklbl;
notebook1.PageIndex:=0;
panel7.caption:='未通话';
//LBoxUnitName.Visible:=True;
OnLineFlag:=False;
// use PreparedData to write it
end;
end;
end;
// 对方要求结束 end *******************

// 对方要求通话 begin *****************
1:begin
if talkflag<>0 then // 已经在通话中或准备通话中
begin // 响应忙线中 = 4
if TmpData.UnitName=TalkData.UnitName then frmmenu.Label21.Visible:=False // 拒绝接听 Label
else WinSockDataOut(TmpData.ComputerName,'34');
end
else
if talkflag=0 then // 不在通话中
begin // 先显示来电讯息,再决定是否响应 Ready
talkflag:=3
// 收到通话要求了
sAlliance:=copy(receive_data,23,1)
//检查是否要求托管
if sAlliance = '1' then AllianceRequest:=True;
panel1.Visible:=True;
Button1.Visible:=True
// 接听
Button2.Visible:=True
// 拒绝接听
panel1.Caption:=' '+TmpData.UnitName+'来电';
frmMenu.lblCallIn.Caption:=TmpData.UnitName;
sndplaysound('Notify.wav',SND_ASYNC);
TalkTimer:=TimeGetTime
// 通话定时器
OnLineFlag:=True;
end;
end;
// 对方要求通话 end ***********************

// 对方响应接听 begin ************************
2: begin
if talkflag=2 then // 已发出通话要求中
begin // 确认对象
if TmpData.UnitName = TalkData.UnitName then
begin // 切换频道,显示视讯
with frmMenu do
begin
CreateCap(1,TalkData.Channel);
talkflag:=1
// 通话中
panel7.caption:='对讲中';
SpBtnCancelTalk.Enabled:=False
// 取消对谈
SpBtnEndTalk.Enabled:=True
// 结束对谈
SpBtnStartRec.Enabled:=True
// 录像钮
end;
end else if talkflag=0 then // 不在准备通话中
begin // 忽略不处理
end;
end;
end;
// 对方响应接听 end ************************

// 对方拒绝 显示拒绝讯息 结束对谈
3: begin
with frmMenu do
begin
NotTalklbl
// 更新按钮状态
talkflag:=0
// 重设对谈 flag =0

// 显示对话框
timerDlg.autoclose:=false;
timerDlg.fclblMsg.Caption:= '对方拒绝接听';
timerDlg.showmodal;
//
{
Label21.Visible:=true
// 显示拒绝接听 Label
Label21.Caption:='拒绝接听';
}
OnLineFlag:=False;
end;
end;

// 通话中 显示忙碌讯息
4: begin
with frmMenu do
begin
panel7.Caption:='未通话';
// 显示对话框
timerDlg.autoclose:=false;
timerDlg.fclblMsg.Caption:= '对方忙线中';
timerDlg.showmodal;
//
{
Label21.Visible:=true;
Label21.Caption:='忙线中';
}
talkflag:=0
//结束对谈 重设对谈 flag =0
NotTalklbl;
OnLineFlag:=False;
end;
end;

//取消通话
5: begin
TalkFlag:=0;
frmStatusBar.Panel1.Visible:=False;
end;

//接受托管 加入至名单 回到 frmSecurity
6: begin
StartX:=3;
frmMenu.Close;
with DataModule1.tblAlliance do
begin
insert;
FieldValues['ComputerName']:=TalkData.ComputerName;
FieldValues['UnitName']:=TalkData.UnitName;
Post;
end;
end;
end;
end;
// 对讲 end --------------------------------------------------------


4:begin //更新网页
end;
6:begin //get the float for the outdoor tempture from BA
ProtoMsg:= copy(receive_data,22,5);
//frmMenu.Label5.Caption:=ProtoMsg;
end;
end;

end;

// 接听钮
procedure TfrmStatusBar.Button1Click(Sender: TObject);
var i:integer;
begin
frmRecMsg.RecMsgCloseclick(self);
frmStatusBar.Panel1.Visible:=False;
with frmmenu do
begin
notebook1.PageIndex:=1;
lblTalkName.Visible:=False;
lblCallIn.Visible:=True;
if lblCallIn.Caption='门口机' then // 判断是否为门口机
begin
talkflag:=1;
lblTalkName.Visible:=False;
SpBtnDoorClick(self);
end
else // else 则为其它住户来电
begin
TalkData.UnitName:=TmpData.UnitName;
for i:= 0 to RecCnt-1 do
begin
if LowerCase(PrepareData.UnitName)=LowerCase(TmpData.UnitName) then
begin
TalkData.ComputerName:= PrepareData.ComputerName;
TalkData.Channel:= PrepareData.Channel;
Break;
end;
end;
TalkData.UnitName:=TmpData.UnitName;
ProtoTyp:='3'
// 讯息类别 ,对讲=3
ProtoMsg:='2'
// 讯息内容, 响应接听=2
WinSockDataOut(TalkData.ComputerName,ProtoTyp+ProtoMsg);
CreateCap(1,TalkData.Channel);
panel7.caption:='对讲中';
SpBtnCancelTalk.Enabled:=False;
SpBtnEndTalk.Enabled:=True;
SpBtnStartRec.Enabled:=true
// 录像钮
if AllianceRequest=True then SpBtnAcpt.Enabled:=True
else SpBtnAcpt.Enabled:=False;
end;
end;
end;

// 拒绝接听钮
procedure TfrmStatusBar.Button2Click(Sender: TObject);
begin
ProtoTyp:='3'
// 讯息类别 ,对讲=3
ProtoMsg:='3'
// 讯息内容, 拒绝接听=3
WinSockDataOut(TmpData.ComputerName,ProtoTyp+ProtoMsg);
Panel1.Visible:=False;
talkflag:=0;
AllianceRequest:=False;
frmmenu.panel7.caption:='未通话';
end;

procedure TfrmStatusBar.GDamX1Error(Sender: TObject
Err: Integer;
const Msg: WideString);
begin
Panel2.Visible:=True;
Panel2.Caption:=Msg;
end;

procedure TfrmStatusBar.GDamX1Fail(Sender: TObject
Err: Integer;
const Msg: WideString);
begin
Panel2.Visible:=True;
Panel2.Caption:=Msg;
end;

procedure TfrmStatusBar.Marquee1LMouseClick(Sender: TObject)
// 显示 browser (marquee 内容)
begin
MemoHtm.Lines.SaveToFile(sysdir +'/Work1.htm');
frmBrowser.WBrowse.Navigate(sysdir +'/work1.htm',flag,tfn,pd,header);
FrmBrowser.Show;
end;

procedure TfrmStatusBar.FormShow(Sender: TObject);
begin // load logo bmp
ImgLogo.Picture.LoadFromFile(sysdir+'/Image/logo.bmp');
end;

procedure TfrmStatusBar.btnFalseAlarmClick(Sender: TObject)
// 确认钮
begin
sndplaysound('/',1);
bAlarmDlg:=False;
Panel2.Visible:=False;
end;

procedure TfrmStatusBar.N1Click(Sender: TObject);
begin
frmstatusbar.WindowState:=wsMinimized;
frmmenu.WindowState:=wsMinimized;
end;

end.
 
Motar Liu:是不是有些不对题呀!还是谢谢您!
大家帮帮忙了!
-------要求:用“程序”滚动WebBrowser中显示的内容
-------难点:WebBrowser不响应一般发送的消息,无法控制其滚动条。
实现就发分,不够再加!
 
Easy!
1、让WebBrowser得到焦点。
procedure SetFocusToDoc;
begin
if Wbe1.Document <> nil then
with Wbe1.Application as IOleobject do
DoVerb(OLEIVERB_UIACTIVATE, nil, Self, 0, Handle, GetClientRect);
end;

2、滚动WebBrowser的内容
uses mshtml;
……
var
 a: IHTMLDocument2;
begin
a :=web1.Document as IHTMLDocument2;
a.Get_ParentWindow.ScrollBy(dx,dy);
或者
a.Get_ParentWindow.Scroll(x,y);

结了,给分吧!
 
CathyEagle:
谢谢!帮我解决了许多问题!
但是当有多帧时,Document.ParentWindow.ScrollBy(dx,dy)就不起效果了,怎么办?50分太少,我可以在给您添!
 
对了,多帧时,应滚动最后激活的帧.望不吝赐教!
 
CathyEagle:
给分喽!有时间看一看:
有多帧时,Document.ParentWindow.ScrollBy(dx,dy)不起效果了,怎么办?
 

Similar threads

S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
后退
顶部