13. marts 2003 - 16:43
Der er
3 kommentarer og
1 løsning
Application.Handle
Hej
Jeg har lige et spm. Hvis man vil fjerne den der dims nede i taskbaren, skreive man notmalt
ShowWindow(Application.Handle, SW_HIDE). Meeeen nu har jeg ingen applications object, fordi min vindue er opprettet med CreateWindowEx
Sp mit spm er :
Hvordan graver jeg
Application.handle fren i REN win32
Jens B
13. marts 2003 - 17:16
#2
Gravet frem fra gemmerne.
Ikke testet !!
In your project source before Application.CreateForm, add the following:
if Application.CreateHandle isn't already there, add it
ExWindowStyle := GetWindowLong(Application.Handle, GWL_EXSTYLE);
SetWindowLong(Application.Handle, GWL_EXSTYLE, ExWindowStyle or
WS_EX_TOOLWINDOW and not WS_EX_APPWINDOW)
Application.ShowMainForm := false;
Look up CreateWindowEx for details on what the WS_EX flags are.
Stoney
14. marts 2003 - 09:47
#3
Bekalger det virker ikke. :-/
Nu poster jeg lige den ORGINALE kode :
program FunBall;
uses
Windows;
var
WinClass: TWndClassA;
Inst, Handle: hWnd;
Msg: TMsg;
Color: Integer;
hRegion: HRGN;
const
WM_DESTROY = $0002;
WM_TIMER = $0113;
procedure aTimerProc;
var
Rect: TRect;
pt: TPoint;
dx, dy: Integer;
BrushHandle: HBRUSH;
PaintDC: hDC;
begin
GetCursorPos(pt);
GetWindowRect(handle, Rect);
dx := (pt.x - Rect.Left - 25) div 6;
dy := (pt.y - Rect.Top - 25) div 7;
Rect.Left := Rect.Left + dx;
Rect.Top := Rect.Top + dy;
MoveWindow(handle, Rect.Left, Rect.Top, 50, 50, True);
if abs(dx * dy) > 3 then
Color := Random(1000000);
PaintDC := GetDc(Handle);
BrushHandle := CreateSolidBrush(Color);
SelectObject(PaintDC, BrushHandle);
Ellipse(PaintDC, 0, 0, 50, 50);
DeleteObject(BrushHandle);
ReleaseDC(Handle, PaintDC);
end;
function WindowProc(hWnd, uMsg, wParam, lParam: Integer): Integer; stdcall;
begin
Result := 0;
case uMsg of
WM_Timer:
begin
aTimerProc;
exit;
end;
WM_DESTROY:
begin
PostQuitMessage(0);
exit;
end;
else
Result := DefWindowProc(hWnd, uMsg, wParam, lParam);
end;
end;
begin
RandSeed := Integer(@WindowProc);
Color := Random(1000000);
{ ** Register Custom WndClass ** }
Inst := hInstance;
with WinClass do
begin
style := CS_CLASSDC or CS_PARENTDC;
lpfnWndProc := @WindowProc;
hInstance := Inst;
hbrBackground := color_btnface + 1;
lpszClassname := 'JB_FUNNBALL';
hCursor := LoadCursor(0, IDC_ARROW);
end; { with }
RegisterClass(WinClass);
{ ** Create Main Window ** }
Handle := CreateWindowEx(WS_EX_WINDOWEDGE, 'JB_FUNNBALL', '', WS_VISIBLE or WS_POPUP, 363, 278, 50, 50, 0, 0, Inst, nil);
SetWindowPos(Handle, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE or SWP_SHOWWINDOW);
hRegion := CreateEllipticRgn(1, 1, 50, 50);
SetWindowRgn(Handle, hRegion, True);
UpdateWindow(Handle);
SetTimer(Handle, 1, 100, nil);
{ ** Message Loop ** }
while (GetMessage(Msg, 0, 0, 0)) do
DispatchMessage(msg);
ExitCode := Msg.wParam;
end.
Så har vi noget mere konkret at teste på !
Jens B
14. marts 2003 - 09:51
#4
har lige selv fundet løsningen :
Handle := CreateWindowEx(WS_EX_TOOLWINDOW , 'JB_FUNNBALL', '', WS_VISIBLE or WS_POPUP, 363, 278, 50, 50, 0, 0, Inst, nil);
Jens B