program nonVCL;
uses
SysUtils,
windows,
messages,
classes,
ActiveX,
OleServer,
Variants,
SHDocVw_TLB;
const
ClassName1 = '
Wnd1Class';
Window1Name = '
Window 1';
WindowWidth1 = 500;
WindowHeight1 = 400;
var Browser : IWebBrowser2;
FensterH : HWND;
function WndProc(hWnd1: HWND; uMsg: UINT; wParam: wParam; lParam: LParam):
lresult;
stdcall;
var
x, y : integer;
PaintStructut : TPaintStruct;
CanvasH : HDC;
begin
Result := 0;
case uMsg
of
WM_CREATE:
begin
{Fenster zentrieren}
x := GetSystemMetrics(SM_CXSCREEN);
y := GetSystemMetrics(SM_CYSCREEN);
MoveWindow(hWnd1, (x
div 2) - (WindowWidth1
div 2),
(y
div 2) - (WindowHeight1
div 2),
WindowWidth1, WindowHeight1, true);
end;
WM_DESTROY:
begin
Browser.Quit;
PostQuitMessage(0);
end;
WM_PAINT:
begin
BeginPaint(hWnd1,PaintStructut);
//Geht doch so oder? auch wenn ich von Browser auf Content oder Container oder sonst ein Interface gehe gehts net.
OleDraw(Browser,DVASPECT_CONTENT,PaintStructut.hdc,PaintStructut.rcPaint);
EndPaint(hWnd1,PaintStructut);
end
else
Result := DefWindowProc(hWnd1, uMsg, wParam, lParam);
end;
end;
var
wc: TWndClassEx = (
cbSize : SizeOf(TWndClassEx);
Style : CS_HREDRAW
or CS_VREDRAW;
lpfnWndProc : @WndProc;
//Fensterfunktion für Fenster 1
cbClsExtra : 0;
cbWndExtra : 0;
lpszMenuName :
nil;
lpszClassName : ClassName1;
//Klassenname für Fenster 1
hIconSm : 0;
);
msg: TMsg;
hresult : Integer;
begin
{Struktur mit Infos für Fenster 1 füllen}
wc.hInstance := hInstance;
wc.hCursor := LoadCursor(0, IDC_ARROW);
wc.hbrBackground := GetSysColorBrush(COLOR_BTNFACE);
{Fenster 1 registrieren}
RegisterClassEx(wc);
{Fenste 1 erzeugen und hWnd1 zuweisen}
FensterH := CreateWindowEx(0, ClassName1, Window1Name, WS_VISIBLE
or WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, CW_USEDEFAULT, WindowWidth1, WindowHeight1, 0, 0, hInstance,
nil);
hresult := OleInitialize(
nil);
Browser := CoInternetExplorer.Create;
Browser.Silent := True;
Browser.Navigate('
http://fotonickel.com/index.htm',EmptyParam,EmptyParam,EmptyParam,EmptyParam);
while GetMessage(msg,0,0,0)
do
begin
TranslateMessage(msg);
DispatchMessage(msg);
end;
ExitCode := msg.wParam;
end.