c语言 桌面下雪程序,[Lazarus]使用Lazarus编写的桌面下雪小程序

c语言 桌面下雪程序,[Lazarus]使用Lazarus编写的桌面下雪小程序该楼层疑似违规已被系统折叠隐藏此楼查看此楼LineTo(hdlDC,x+9,y+2);MoveToEx(hdlDC,x+6,y+12,nil);LineTo(hdlDC,x+9,y+12);MoveToEx(hdlDC,x+2,y+6,nil);LineTo(hdlDC,x+2,y+9);MoveToEx(hdlDC,x+12…

该楼层疑似违规已被系统折叠 隐藏此楼查看此楼

LineTo(hdlDC, x + 9, y + 2);

MoveToEx(hdlDC, x + 6, y + 12, nil);

LineTo(hdlDC, x + 9, y + 12);

MoveToEx(hdlDC, x + 2, y + 6, nil);

LineTo(hdlDC, x + 2, y + 9);

MoveToEx(hdlDC, x + 12, y + 6, nil);

LineTo(hdlDC, x + 12, y + 9);

end else begin

MoveToEx(hdlDC, x + 7, y + 2, nil);

LineTo(hdlDC, x + 7, y + 13);

MoveToEx(hdlDC, x + 2, y + 7, nil);

LineTo(hdlDC, x + 13, y + 7);

MoveToEx(hdlDC, x + 4, y + 4, nil);

LineTo(hdlDC, x + 11, y + 11);

MoveToEx(hdlDC, x + 4, y + 10, nil);

LineTo(hdlDC, x + 11, y + 3);

MoveToEx(hdlDC, x + 6, y + 3, nil);

LineTo(hdlDC, x + 9, y + 3);

MoveToEx(hdlDC, x + 6, y + 11, nil);

LineTo(hdlDC, x + 9, y + 11);

MoveToEx(hdlDC, x + 3, y + 6, nil);

LineTo(hdlDC, x + 3, y + 9);

MoveToEx(hdlDC, x + 11, y + 6, nil);

LineTo(hdlDC, x + 11, y + 9);

end;

end;

procedure TfmMainForm.FormCreate(Sender: TObject);

var

i, nTimer:integer;

h:longint;

rcWorkArea:RECT;

hProgMan, hShellDefView:HWND;

begin

Application.ShowMainForm := false;

{

h := GetWindowLong(fmMainForm.Handle, GWL_EXSTYLE);

h := h or WS_EX_LAYERED;

SetWindowLong(fmMainForm.Handle, GWL_EXSTYLE, h);

SetLayeredWindowAttributes(fmMainForm.Handle, 0, 0, LWA_ALPHA);

}

randomize;

SystemParametersInfo(SPI_GETWORKAREA, 0, @rcWorkArea, 0);

hProgMan := FindWindow(‘ProgMan’, nil);

if(hProgMan <> 0) then begin

hShellDefView := FindWindowEx(hProgMan, 0, ‘SHELLDLL_DefView’, nil);

if(hShellDefView <> 0) then

hDesktop := FindWindowEx(hShellDefView, 0, ‘SysListView32’, nil);

end;

ScrWidth := abs(rcWorkArea.Right – rcWorkArea.Left);

ScrHeight := abs(rcWorkArea.Bottom – rcWorkArea.Top);

for i := 1 to SNOWNUM do begin

pData[i].x := random(ScrWidth);

pData[i].y := 0;

pData[i].size := (random(10) > 5);

pData[i].increment := (random(10) > 5);

nTimer := 10 + random(70);

SetTimer(fmMainForm.Handle, i, nTimer, @DrawFlake);

end;

hdlDC := GetDC(hDesktop);

hdlPen := CreatePen(PS_SOLID, 1, SNOWCOL);

SelectObject(hdlDC, hdlPen);

end;

procedure TfmMainForm.FormDestroy(Sender: TObject);

var

i:integer;

begin

for i := 1 to SNOWNUM do KillTimer(fmMainForm.Handle, i);

InvalidateRect(0, nil, true);

DeleteObject(hdlPen);

ReleaseDC(fmMainForm.Handle, hdlDC);

end;

procedure TfmMainForm.IDM_ExitClick(Sender: TObject);

begin

Application.Terminate;

end;

initialization

{$I main.lrs}

end.

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。
如需转载请保留出处:https://bianchenghao.cn/37696.html

(0)
编程小号编程小号

相关推荐

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注