16,470
社区成员
发帖
与我相关
我的任务
分享
hw:=FindWindow(nil,PChar('Google Earth'));
if hw <> 0 then
SetWindowPos (hw, HWND_TOP, 0, 0, 200000, 20000, SWP_SHOWWINDOW);
var
ViewObject: IViewObject;
sourceDrawRect: TRect;
tmpImage : TImage;
jp: TJPEGImage;
nowtime: TDateTime;
t_hour,t_minute: integer;
s_nowday, s_hour,s_minute: string;
begin
if Msg.Iditem = 100 then
begin
WebB.Document.QueryInterface(IViewObject, ViewObject);
if ViewObject <> nil then
try
jp := TJPEGImage.Create;
tmpImage := TImage.Create(Self);
tmpImage.Width := Web_W;
tmpImage.Height := Web_H;
sourceDrawRect := Rect(0,0,tmpImage.Width,tmpImage.Height);
ViewObject.Draw(DVASPECT_CONTENT,1,nil,nil,Self.Handle,
tmpImage.Canvas.Handle,@sourceDrawRect,nil,nil,0);
tmpImage.Repaint;
jp.Assign(tmpImage.Picture.Bitmap);
jp.CompressionQuality := 100;
nowtime := Now;
t_minute := Round(Frac(nowtime)*1440.0);
s_nowday := DateToStr(Date);
t_hour := t_minute div 60;
t_minute := t_minute - t_hour*60;
if t_hour < 10 then
s_hour := '0'+intToStr(t_hour)
else
s_hour := intToStr(t_hour);
if t_minute < 10 then
s_minute := '0'+intToStr(t_minute)
else
s_minute := intToStr(t_minute);
jp.SaveToFile (GetCurrentDir+'\gmap'+s_nowday+'_'+s_hour+'-'+s_minute+'.jpg');
jp.Free;
tmpImage.Free;
finally
ViewObject._Release;
end;
end