![]() |
|
|
|||||||
| Регистрация | << Правила форума >> | FAQ | Пользователи | Календарь | Поиск | Сообщения за сегодня | Все разделы прочитаны |
![]() |
|
|
Опции темы | Поиск в этой теме | Опции просмотра |
|
#1
|
|||
|
|||
|
как узнать свойсва картинки(интересует ее размер в байтах) по средствам webbrowser'a?
Код картинки: Код HTML:
|
|
#2
|
||||
|
||||
|
Код:
IHTMLImgElement:
property isMap: WordBool dispid 2002;
property useMap: WideString dispid 2008;
property mimeType: WideString readonly dispid 2010;
property fileSize: WideString readonly dispid 2011;
property fileCreatedDate: WideString readonly dispid 2012;
property fileModifiedDate: WideString readonly dispid 2013;
property fileUpdatedDate: WideString readonly dispid 2014;
property protocol: WideString readonly dispid 2015;
property href: WideString readonly dispid 2016;
property nameProp: WideString readonly dispid 2017;
property border: OleVariant dispid 1004;
property vspace: Integer dispid 1005;
property hspace: Integer dispid 1006;
property alt: WideString dispid 1002;
property src: WideString dispid 1003;
property lowsrc: WideString dispid 1007;
property vrml: WideString dispid 1008;
property dynsrc: WideString dispid 1009;
property readyState: WideString readonly dispid -2147412996;
property complete: WordBool readonly dispid 1010;
property loop: OleVariant dispid 1011;
property align: WideString dispid -2147418039;
property onload: OleVariant dispid -2147412080;
property onerror: OleVariant dispid -2147412083;
property onabort: OleVariant dispid -2147412084;
property name: WideString dispid -2147418112;
property width: Integer dispid -2147418107;
property height: Integer dispid -2147418106;
property Start: WideString dispid 1013; |
|
#3
|
|||
|
|||
|
Делаю так:
Код:
procedure TForm1.Button3Click(Sender: TObject);
var
doc: IHTMLDocument2;
i: Integer;
s:string;
begin
s:='%'+'/items/phone/'+'%';
try
doc:=WebBrowser1.Document as IHTMLDocument2;
for i:=0 to doc.all.length-1 do
begin
if (doc.all.item(i, 0) as IHTMLIMGElement).src=s then
//edit1.Text:=(doc.all.item(i, 0) as IHTMLIMGElement).fileSize;
showmessage('1');
end;
except
end;
end; |
|
#4
|
||||
|
||||
|
не любой элемент может вернуть интерфейс IHTMLImgElement. делай проверку.
|
|
#5
|
||||
|
||||
|
Ф-я Supports(...) подробности в справке.
|
|
#6
|
||||
|
||||
|
или сразу так:
Код:
var
doc: IHTMLDocument2;
i: Integer;
img: IHTMLImgElement;
begin
doc:=WebBrowser1.Document as IHTMLDocument2;
for i:=0 to doc.all.length-1 do
if doc.all.item(i, 0).QueryInterface(IID_IHTMLImgElement, img)=S_OK then
ShowMessage(IntToStr(img.width));
end; |
|
#7
|
|||
|
|||
|
Цитата:
|
|
#8
|
||||
|
||||
|
Константа.
|
|
#9
|
|||
|
|||
|
Цитата:
Код:
s:='%'+'/items/phone/'+'%'; |
|
#10
|
|||
|
|||
|
Код:
procedure TForm1.Button4Click(Sender: TObject);
var
doc: IHTMLDocument2;
i: Integer;
img: IHTMLImgElement;
begin
doc:=WebBrowser1.Document as IHTMLDocument2;
for i:=0 to doc.all.length-1 do
if doc.all.item(i, 0).QueryInterface(IID_IHTMLImgElement, img)=S_OK then
if img.width=121 then
ShowMessage(img.src);
end;Код:
ShowMessage(img.fileSize); |
|
#11
|
||||
|
||||
|
смотри где что не так написал. у меня на:
Код HTML:
|
|
#12
|
|||
|
|||
|
Цитата:
|