//=======================================================================
Function LinkProc(LinkCtl:HWND;uMsg,wParam,lParam:DWORD):LRESULT;stdcall;
Begin
Result:=0;
Case uMsg of
WM_SETCURSOR:
Begin
SetCursor(L_Cur);
End;
WM_NCHITTEST:
Begin
Result:=1;
End;
WM_LBUTTONUP:
Begin
ShellExecute(0,nil,'http://www.pediy.com',nil,nil,0);//链接到:看雪学院
End
else
Begin
CallWindowProc(Pointer(GetWindowLong(LinkCtl,GWL_USERDATA)),LinkCtl,uMsg,wParam,lParam);
End;
end;
End;
procedure MoveToCentre(hDlg:HWND); //窗口启动中在屏幕中心显示
Var
D_Rect:TRECT; //本程序的RECT
S_Rect:Trect; //DeskTop 的RECT,实际上就是SCREEN了。
S_Hwnd:HWND; //DeskTop 的句柄
Begin
GetWindowRECT(hDlg,D_Rect);
S_Hwnd:=GetDesktopwindow;
GetWindowRect(s_Hwnd,S_Rect);
moveWindow(hDlg,(S_Rect.right-D_Rect.Right)div 2 ,(S_Rect.Bottom-D_Rect.Bottom ) div 2,D_Rect.Right ,D_Rect.Bottom,true);
End;
Function GetOS:string;
var
OS: OSVERSIONINFO;
OS_Str:string;
begin
ZeroMemory(@OS,sizeof(OS));
OS.dwOSVersionInfoSize :=sizeof(OSVERSIONINFO);
GetVerSionEx(OS);
OS_Str:='你使用非Windows操作系统';
if (OS.dwPlatformId = VER_PLATFORM_WIN32_NT) and
(OS.dwMajorVersion = 5) and (OS.dwMinorVersion =1)
then OS_str:='你使用WinXP'+' '+OS.szCSDVersion;
if (OS.dwPlatformId = VER_PLATFORM_WIN32_NT) and
(OS.dwMajorVersion = 5) and
(OS.dwMinorVersion =0)
then OS_str:='你使用Win2K'+' '+OS.szCSDVersion;
if (OS.dwPlatformId = VER_PLATFORM_WIN32_NT) and
(OS.dwMajorVersion = 4)
then OS_str:='你使用WinNT'+' '+OS.szCSDVersion;
if (OS.dwPlatformId = VER_PLATFORM_WIN32_WINDOWS)
then OS_str:='你使用Win9X'+' '+OS.szCSDVersion;
Result:=OS_str;
end;
Procedure DialogInit(hDlg:HWND);
Begin
SetDlgItemText(hDlg,IDC_Time,Time);
SetDlgItemText(hDlg,IDC_wofan,Author);
SetDlgItemText(hDlg,IDC_Name,Pchar('wofan[OCN][PYG][DCG]'));
if h_Cur<>0 then
Begin
SetClassLong(hDlg,GCL_HCURSOR,h_Cur); //设置动画光标
SetClassLong(GetDlgItem(hDlg,IDC_Name),GCL_HCURSOR,h_Cur); //各个控件有同样的光标
SetClassLong(GetDlgItem(hDlg,IDC_Code),GCL_HCURSOR,h_Cur);
SetClassLong(GetDlgItem(hDlg,IDC_OK),GCL_HCURSOR,h_Cur);
SetClassLong(GetDlgItem(hDlg,IDC_About),GCL_HCURSOR,h_Cur);
SetClassLong(GetDlgItem(hDlg,IDC_Cancel),GCL_HCURSOR,h_Cur);
End;
WM_LBUTTONDOWN:
Begin
Cap_PT.X:=lParam and $FFFF;
Cap_PT.Y:=lParam SHR 16;
if PTInRect(Cap_Rect,Cap_PT) then
Begin
PostMessage(hDlg,WM_NCLBUTTONDOWN,HTCAPTION,0); //转换消息,单击Form如同单击标题栏
End;
End;
if h_Icon<>0 Then
Begin
DrawIconEx(DC,4,4,h_Icon,$10,$10,0,0,3);
End;
SetBKMode(DC,TRANSPARENT); //设置背景透明,标题栏的画出的文字背景色不再是难看的白色
DrawText(DC,MainCaption,-1,Cap_Rect,DT_CENTER OR DT_SINGLELINE OR DT_VCENTER); //居中单行绘制文本
EndPaint(hDlg,sPaint);
End;
WM_COMMAND:
Begin
Case wParam and $FFFF of
IDC_OK:
Begin
SetDlgItemText(hdlg,IDC_Code,pchar(inttostr(wofanKeygen(hDlg))));
End;
IDC_About:
Begin
MessageBox(hDlg,pchar(AboutText+#13+GetOS),AboutTitle,MB_OK or MB_ICONINFORMATION);
End;
IDC_Cancel:
Begin
EndDialog(hDlg,0);
End;
IDC_Close:
Begin
EndDialog(hDlg,0);
End;
IDC_Name:
Begin
Case wParam shr 16 of
EN_CHANGE:
Begin
SetDlgItemText(hdlg,IDC_Code,pchar(inttostr(wofanKeygen(hDlg))));
End;
End; //end---wParam shr 16 of---- case
End; //End ----IDC_Name ----Begin
End; //End----WM_Command----Case
End; //End ----WM_Command---- Begin
End; //End ---Umsg----case
End; //End -----Function