(lParam = wm_RButtonDown) then
begin
GetCursorPos (pt);
pm := CreatePopupMenu;
AppendMenu (pm, 0, Ord (''A''), ''About DeskTop Hide'');
AppendMenu (pm, mf_Separator, 0, Nil);
AppendMenu (pm, 0, Ord (''E''), ''Exit DeskTop Hide'');
SetForegroundWindow (Wnd);
dc := GetDC (0);
if TrackPopupMenu (pm, tpm_BottomAlign or tpm_RightAlign,pt.x,GetDeviceCaps(dc,HORZRES){pt.y}, 0, Wnd, Nil) then SetForegroundWindow (Wnd);
DestroyMenu (pm)
end; {end of if}
end; {end of case}
{在处理过消息之后,还要调用默认函数,以完成标准的Windows程序应该执行的任务,所 以这一句非常重要}
DummyWindowProc := DefWindowProc (Wnd, Msg, wParam, lParam);
end;
{这个就是处理菜单消息的过程}
procedure HandleCommand (Wnd: hWnd; Cmd: Word);
begin
case Cmd of
Ord (''A''): MessageBox (0, ''Freeware brian.slack@strath.ac.uk 1997'', AppName, mb_ok);
Ord (''E''): PostMessage (Wnd, wm_Close, 0, 0);
end;
end;
至此我们已经完成了这个只有38K的能将Win95桌面隐藏起来的程序,只要将本文中所有的函数和过程的顺序倒置,并将主程序放到最后,即可编译通过。