📄 untmsghdl.~pas
字号:
function DlgAboutWMSetCursor(
hWnd : THandle;
Msg : LongWord;
wParam : WPARAM;
lParam : LPARAM):BOOL;stdcall;
var
CtlID : integer;
cursor : HCURSOR;
begin
//result := false;
CtlID := GetWindowLong(wParam, GWL_ID);
case CtlID of
ID_ABOUT_LBLEMAIL:
begin
//MessageBox(GetFocus,'fdfd','fdf',MB_OK);
result := true;
cursor := LoadCursor(0,MAKEINTRESOURCE(IDC_HAND));
SetCursor(cursor);
//result := true;
end;
end;
end;
const
hBrushStatic : HBRUSH = 0;
{******************************************************************************
* Function DlgAbout(hDlg,Msg,wParam,lParam)
* Purpose:
* The Loop Message Handler of About Dialog
* Date : 2001-1-9
******************************************************************************}
function DlgAboutProc(hDlg: THandle;
Msg : LongWord;
wParam : WPARAM;
lParam : LPARAM):BOOL;
var
CtlID : integer;
begin
result := BOOL(false);
case Msg of
WM_INITDIALOG :
begin
SetWindowInCenter(hDlg);
(*
SetLastError(0);
if SetWindowLong(GetDlgItem(hDlg,ID_ABOUT_LBLEMAIL),GWL_WNDPROC,
LongInt(@DlgAboutLblEmailProc)) = 0 then
MessageBox(GetFocus,PChar('Error to subclass the label:'+
IntToStr(GetLastError)),'Hi',MB_OK);
*)
hBrushStatic := CreateSolidBrush(GetSysColor(COLOR_MENU));
result := BOOL(true);
end;
WM_COMMAND :
begin
if lParam<>0 then begin // so it is a control
case LO(wParam) of
ID_ABOUT_OK :
begin
EndDialog(hDlg, integer(TRUE));
result := BOOL(TRUE);
end;
ID_ABOUT_LBLEMAIL:
begin
ShellExecute(hDlg,'open',
PChar('mailto:Gan Huaxin<huiyugan@263.net>'+
'?subject=About Clock'+
'&body=Hello,Mr. Gan Huaxin'),
nil,nil,SW_SHOW);
end;
end;
end;
end;
WM_CLOSE :
begin
DeleteObject(hBrushStatic);
hBrushStatic := 0;
EndDialog(hDlg,integer(true));
result := BOOL(true);
end;
WM_CTLCOLORSTATIC:
begin
ctlID := GetWindowLong(lParam,GWL_ID);
case CtlID of
ID_ABOUT_LBLEMAIL:
begin
SetTextColor(wParam,RGB(0,0,255));
SetBkColor(wParam,GetSysColor(COLOR_Menu));
result := BOOL(hBrushStatic);
end;
end;
end;
WM_SETCURSOR:
begin
//MessageBox(Getfocus,'SetCursor','fd',MB_OK);
result := DlgAboutWMSetCursor(hDlg,Msg,wParam,lParam);
end;
end;
end;
//
//*** The Following functions is work for Dialog Option! ***
//
var
opt : integer; // this global save the current select window postion
// option setting
// it Init in DlgOptionInitDlgProc
// and can change in DlgOptionWMCommand
{******************************************************************************
* Function DlgOptionWMInitDlgProc(hDlg,Msg,wParam,lParam);
* Purpose:
* To Initial the Option Dialog
* Date :
* New Development : 2001-1-10
* Modified :
******************************************************************************}
function DlgOptionWMInitDlgProc(
hDlg : THandle;
Msg : LongWord;
wParam : WPARAM;
lParam : LPARAM):BOOL;stdcall;
const
CHECK_BOOL : Array[false..true] of UINT =
(BST_UNCHECKED, BST_CHECKED);
var
bOpt: boolean;
begin
GetRegShowOnTaskBar(bOpt);
CheckDlgButton(hDlg,ID_OPTION_CHKTASKBAR,CHECK_BOOL[bOpt]);
//
// Set the Radion Button First State
//
GetRegWindowPosOpt(opt);
CheckRadioButton(hDlg,ID_OPTION_TOPLEFT,
ID_OPTION_USERPLACE,opt);
//
// Set Apply Button Enabled
//
EnableWindow(GetDlgItem(hDlg,ID_OPTION_APPLY),false);
//
// initial the Check buttons Status
//
GetRegAllOnTop(bOpt);
CheckDlgButton(hDlg,ID_OPTION_CHKALLONTOP,CHECK_BOOL[bOpt]);
CheckDlgButton(hDlg,ID_OPTION_CHKSTARTWIN,
CHECK_BOOL[GetAppAtStart]);
GetRegTransparent(bOpt);
CheckDlgButton(hDlg,ID_OPTION_CHKTRANS,CHECK_BOOL[bOpt]);
//
// Set the transparent edit enable status
//
EnableWindow(GetDlgItem(hDlg,ID_OPTION_EDITTRANS),bOpt);
EnableWindow(GetDlgItem(hDlg,ID_OPTION_LBLDEGREE),bOpt);
GetRegShowTray(bOpt);
CheckDlgButton(hDlg,ID_OPTION_CHKSHOWTRAY,CHECK_BOOL[bOpt]);
// place the window as center in desktop
SetWindowInCenter(hDlg);
result := BOOL(0);
end;
{******************************************************************************
* Function DlgOptionWMCommandProc(hDlg,Msg,wParam,lParam);
* Purpose:
* To Deal with Menu, Button click events
* Global Variable :
* Opt : To Remember the Radio Button Saved
* Date :
* New Development : 2001-1-10
* Modified :
******************************************************************************}
function DlgOptionWMCommandProc(
hDlg : THandle;
Msg : LongWord;
wParam : WPARAM;
lParam : LPARAM):BOOL;stdcall;
var
Pos:TMyWindowPos;
dwStyle : integer;
begin
if lParam<>0 then begin // control command
case LO(wParam) of
//
// push Buttons
//
ID_OPTION_OK:
begin
if IsWindowEnabled(GetDlgItem(hDlg,ID_OPTION_APPLY)) then begin
SendDlgItemMessage(hDlg,ID_OPTION_APPLY,WM_LBUTTONDOWN,0,0);
SendDlgItemMessage(hDlg,ID_OPTION_APPLY,WM_LBUTTONUP,0,0);
end;
SendMessage(hDlg,WM_CLOSE,0,0);
end;
ID_OPTION_CANCEL:
Begin
//GetRegWindowPos(TestPos);
SendMessage(hDlg,WM_CLOSE,0,0);
end;
ID_OPTION_APPLY:
begin
SetRegTransParent(
IsDlgButtonChecked(hDlg,ID_OPTION_CHKTRANS)= BST_CHECKED);
SetWindowTransparent(
GetParent(hDlg),
IsDlgButtonChecked(hDlg,ID_OPTION_CHKTRANS)= BST_CHECKED);
SetRegAllOnTop(
IsDlgButtonChecked(hDlg,ID_OPTION_CHKALLONTOP) = BST_CHECKED);
SetWindowAllOnTop(
GetParent(hDlg),
IsDlgButtonChecked(hDlg,ID_OPTION_CHKALLONTOP) = BST_CHECKED);
SetRegShowTray(
IsDlgButtonChecked(hDlg,ID_OPTION_CHKSHOWTRAY) = BST_CHECKED);
if IsDlgButtonChecked(hDlg,ID_OPTION_CHKSHOWTRAY) = BST_CHECKED then
ShowOnTray(GetParent(hDlg))
else
DelOnTray(GetParent(hDlg));
SetRegWindowPos(GetParent(hDlg));
SetRegWindowPosOpt(opt);
SetAppAtStart(
IsDlgButtonChecked(hDlg,ID_OPTION_CHKSTARTWIN) = BST_CHECKED);
//
// to Move the Main Window !
//
GetPlacePos(Pos);
//dwStyle := GetWindowLong(GetParent(hDlg),GWL_STYLE);
MoveWindow(GetParent(hDlg),Pos.Left,Pos.Top,
Pos.Width,Pos.Width,True);
//SetWindowLong(GetParent(hDlg),GWL_STYLE,dwStyle);
EnableWindow(GetDlgItem(hDlg,ID_OPTION_APPLY),false);
if IsDlgButtonChecked(hDlg,ID_OPTION_CHKTASKBAR) = BST_CHECKED then
begin
ShowWindow(ParentWnd,SW_SHOW);
SetRegShowOnTaskBar(true);
end
else begin
ShowWindow(ParentWnd,SW_HIDE);
SetRegShowOnTaskBar(false);
end;
SetFocus(hDlg);
end;
//
// radion buttons
//
ID_OPTION_TOPLEFT, ID_OPTION_TOPCENTER, ID_OPTION_TOPRIGHT,
ID_OPTION_MIDDLELEFT,ID_OPTION_MIDDLECENTER,ID_OPTION_MIDDLERIGHT,
ID_OPTION_BOTTOMLEFT,ID_OPTION_BOTTOMCENTER,ID_OPTION_BOTTOMRIGHT,
ID_OPTION_USERPLACE:
// just to Remember the click Button ID
begin
EnableWindow(GetDlgItem(hDlg,ID_OPTION_APPLY),TRUE);
opt := LO(wParam);
end;
//
// check buttons
//
ID_OPTION_CHKSTARTWIN..ID_OPTION_CHKTASKBAR:
begin
if IsDlgButtonChecked(hDlg,LO(wParam))=BST_CHECKED then
CheckDlgButton(hDlg,LO(wParam),BST_UNCHECKED)
else
CheckDlgButton(hDlg,LO(wParam),BST_CHECKED);
EnableWindow(GetDlgItem(hDlg,ID_OPTION_APPLY),TRUE);
if LO(wParam) = ID_OPTION_CHKTRANS then
if IsDlgButtonChecked(hDlg,ID_OPTION_CHKTRANS)=BST_CHECKED then
begin
EnableWindow(GetDlgItem(hDlg,ID_OPTION_EDITTRANS),TRUE);
EnableWindow(GetDlgItem(hDlg,ID_OPTION_LBLDEGREE),TRUE);
end
else begin
EnableWindow(GetDlgItem(hDlg,ID_OPTION_EDITTRANS),FALSE);
EnableWindow(GetDlgItem(hDlg,ID_OPTION_LBLDEGREE),FALSE);
end;
end;
end;
end
else
if HI(wParam)<>0 then begin // Accelerator command
end
else begin // menu command
end;
result := BOOL(true);
end;
{******************************************************************************
* Function DlgOptionProc
* Purpose:
* The Loop Message Handler of Option Dialogs
* Date : 2001-1-9
******************************************************************************}
//var hBrushStatic : HBRUSH;
function DlgOptionProc(hDlg : THandle;
Msg : LongWord;
wParam : WPARAM;
lParam : LPARAM):BOOL;
var
ctlID : integer;
begin
result := BOOL(false);
case Msg of
WM_INITDIALOG :
result := DlgOptionWMInitDlgProc(hDlg,Msg,wParam,lParam);
WM_CLOSE :
begin
EndDialog(hDlg,integer(true));
result := BOOL(true);
end;
WM_COMMAND :
result := DlgOptionWMCommandProc(hDlg,Msg,wParam,lParam);
WM_CTLCOLORSTATIC:
begin
ctlID := GetWindowLong(lParam,GWL_ID);
if ctlID = ID_OPTION_LBLDEGREE then begin
SetTextColor(HDC(wParam),RGB(255,0,0));
SetBkColor(HDC(wParam),RGB(255,255,255));
result := BOOL(0);
end;
end;
end;
end;
function DlgClockSetProc(hDlg : THandle;
Msg : LongWord;
wParam : WPARAM;
lParam : LPARAM):BOOL;
var
ctlID : integer;
begin
result := BOOL(false);
case Msg of
WM_INITDIALOG :
SetWindowInCenter(hDlg);
WM_CLOSE :
begin
EndDialog(hDlg,integer(true));
result := BOOL(True);
end;
WM_CTLCOLORSTATIC:
begin
ctlID := GetWindowLong(lParam,GWL_ID);
end;
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -