Форум: "Основная";
Текущий архив: 2002.02.07;
Скачать: [xml.tar.bz2];
ВнизКто-нибудь занимался интерфейсами на Дельфи? Найти похожие ветки
← →
Romkin (2002-01-23 16:22) [34]полностью star © (21.01.02 12:28) переводится примерно так
(могут быть неточности в прототипах.... ObjectFromLresult)
uses MSHTML, ActiveX;
{$R *.DFM}
function EnumChildProc(Handle:HWND; Param: LParam): BOOL; stdcall;
var
Buffer: string;
nSize: integer;
begin
nSize := GetClassName(Handle, nil, 0);
SetLength(Buffer, nSize);
GetClassName(Handle, PChar(Buffer), nSize);
if AnsiCompareText(Buffer,"Internet Explorer_Server") = 0 then
begin
HWND(Param) := Handle;
Result := False; //found
end
else Result := True; //continue Enum
end;
{
STDAPI ObjectFromLresult(
LRESULT lResult,
REFIID riid,
WPARAM wParam,
void** ppvObject
);
}
type
TObjectFromLResultProc =
function(ALRes: LResult; const IID: TGuid; WPar: WParam; out Obj): HResult; stdcall;
//Вообще-то это событие OnGetDocInterface объекта CDlg - ???
procedure GetDocInterface(AHandle: HWND);
var
hInst: HModule;
ObjectFromLResultProc:TObjectFromLResultProc;
spDoc: IHTMLDocument;
spDoc2: IHTMLDocument2;
nMsg: Cardinal;
lRes: LResult;
hWndChild: HWND;
hr: HResult;
spDisp: IDispatch;
spWin: IHTMLWindow2;
begin
if AHandle = 0 then exit;
hWndChild := 0;
//Get 1st document window
EnumChildWindows(AHandle, @EnumChildProc, hWndChild);
if hWndChild = 0 then exit; //Document not ready
hInst := LoadLibrary("OLEACC.DLL");
if hInst = 0 then exit; //не загрузилось...
CoInitialize(nil);
try
nMsg := RegisterWindowMessage("WM_HTML_GETOBJECT");
SendMessageTimeout(hWndChild, nMsg, 0, 0, SMTO_ABORTIFHUNG,
1000, DWORD(lRes));
ObjectFromLResultProc := nil;
ObjectFromLResultProc := GetProcAddress(hInst,"ObjectFromLresult");
if @ObjectFromLResultProc <> nil then begin
hr := ObjectFromLResultProc(lRes, IID_IHTMLDocument, 0, spDoc);
if succeeded(hr) then
begin
spDisp := spDoc.Script;
spWin := IHTMLWindow2(spDisp);
spDoc2 := spWin.Document; //????
//change color
spDoc2.bgColor := clRed;
end;
end;
finally
ObjectFromLResultProc := nil;
FreeLibrary(hInst);
CoUninitialize;
end;
end;
2nikkie: и все равно это вызовы к IE
Страницы: 1 вся ветка
Форум: "Основная";
Текущий архив: 2002.02.07;
Скачать: [xml.tar.bz2];
Память: 0.45 MB
Время: 0.004 c