Y
yjpya
Unregistered / Unconfirmed
GUEST, unregistred user!
各位朋友,想请教一下,下面的过程是窗体的一部分过程,请问怎样改,才可以让窗体响应键盘消息而不单单是鼠标消息,即窗体可以响应键盘输入的东西,请各位朋友赐教,谢谢!!
其中const
WM_TrayIcon = WM_USER + 1234;
procedure TFrmMain.AddIconToTray; //服务部分
begin
ZeroMemory(@IconData, SizeOf(TNotifyIconData));
IconData.cbSize := SizeOf(TNotifyIconData);
IconData.Wnd := Handle;
IconData.uID := 1;
IconData.uFlags := NIF_MESSAGE or NIF_ICON or NIF_TIP;
IconData.uCallbackMessage := WM_TrayIcon;
IconData.hIcon := Application.Icon.Handle;
IconData.szTip := 'Delphi服务演示程序';
Shell_NotifyIcon(NIM_ADD, @IconData);
end;
procedure TFrmMain.TrayIconMessage(var Msg: TMessage); //响应鼠标动作
begin
if (Msg.LParam = WM_LBUTTONDOWN) then Show();
end;
procedure TFrmMain.SysButtonMsg(var Msg: TMessage); //服务部分
begin
if (Msg.wParam = SC_CLOSE) or
(Msg.wParam = SC_MINIMIZE) then Hide
else inherited; // 执行默认动作
end;
其中const
WM_TrayIcon = WM_USER + 1234;
procedure TFrmMain.AddIconToTray; //服务部分
begin
ZeroMemory(@IconData, SizeOf(TNotifyIconData));
IconData.cbSize := SizeOf(TNotifyIconData);
IconData.Wnd := Handle;
IconData.uID := 1;
IconData.uFlags := NIF_MESSAGE or NIF_ICON or NIF_TIP;
IconData.uCallbackMessage := WM_TrayIcon;
IconData.hIcon := Application.Icon.Handle;
IconData.szTip := 'Delphi服务演示程序';
Shell_NotifyIcon(NIM_ADD, @IconData);
end;
procedure TFrmMain.TrayIconMessage(var Msg: TMessage); //响应鼠标动作
begin
if (Msg.LParam = WM_LBUTTONDOWN) then Show();
end;
procedure TFrmMain.SysButtonMsg(var Msg: TMessage); //服务部分
begin
if (Msg.wParam = SC_CLOSE) or
(Msg.wParam = SC_MINIMIZE) then Hide
else inherited; // 执行默认动作
end;