• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PlayingWithSystemUsingDelphi

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

1.Open/close CD ROM
Uses mmsystem;
mciSendString('Set cdaudio door open wait', nil, 0, handle);  to open
mciSendString('Set cdaudio door closed wait', nil, 0, handle);  to close

2.Monitor stand by
Uses Shellapi;
SendMessage(Application.Handle, wm_SysCommand, SC_MonitorPower, 0) ;

3.Hide/show application on task bar
Uses Shellapi;
ShowWindow(application.handle, SW_hide);  to hide
ShowWindow(application.handle, SW_restore);  to show

4.Hide/show application on task list (task display when you press Ctrl+Alt+Del)
implementation
function RegisterServiceProcess(idProcess,dwType : Integer):Integer; stdcall; external 'KERNEL32.Dll';
...........
on your event handler
RegisterServiceProcess(GetCurrentProcessID, 0); to show
RegisterServiceProcess(GetCurrentProcessID, 1); to hide

5.Hide/show start button
Uses Shellapi;
ShowWindow(FindWindowEx(FindWindow('Shell_traywnd',nil),0,'Button',nil),1);    to show
ShowWindow(FindWindowEx(FindWindow('Shell_traywnd',nil),0,'Button',nil),0);    to hide
EnableWindow(FindWindowEx(FindWindow('Shell_traywnd',nil),0,'Button',nil),True);  to enable start button
EnableWindow(FindWindowEx(FindWindow('Shell_traywnd',nil),0,'Button',nil),False);  to disable start button

6.Hide/show task bar
Uses Shellapi;
ShowWindow(FindWindow('shell_traywnd',nil),1); to show
ShowWindow(FindWindow('shell_traywnd',nil),0); to hide
EnableWindow(FindWindow('shell_traywnd',nil),True); enable task bar
EnableWindow(FindWindow('shell_traywnd',nil),False); disable task bar

7.Hide/show desktop
Uses Shellapi;
ShowWindow(FindWindow('progman',nil),1);  to show
ShowWindow(FindWindow('progman',nil),0);  to hide
EnableWindow(FindWindow('shell_traywnd',nil),True); to enable desktop
EnableWindow(FindWindow('shell_traywnd',nil),False); to disable desktop

8.Hide/show clock
Uses Shellapi;
ShowWindow(FindWindowEx(FindWindowEx(FindWindow('shell_traywnd',nil),0,'TrayNotifyWnd',nil),0,'TrayClockWClass',nil),1);  to show
ShowWindow(FindWindowEx(FindWindowEx(FindWindow('shell_traywnd',nil),0,'TrayNotifyWnd',nil),0,'TrayClockWClass',nil),0);  to hide

9.Shutdown/restart windows
Uses Shellapi;
ExitWindowsEx(ewx_Shutdown,0);  to shutdown
ExitWindowsEx(ewx_Reboot,0);  to restart
ExitWindowsEx(ewx_Poweroff,0);  to off your computer power

10.Scrolling Caption
procedure TForm1.Timer1Timer(Sender: TObject);
var  j : Integer;
     MyString: String;
     ScrollingCap: string;
begin
MyString := form1.Caption; //gives the title of your form that sits on the tastbar the caption of your form
form1.Caption:=ScrollingCap;
for j := 1 to Length(Scrollingcap) do //going from 1 to the length of chars in Scrollingcap
ScrollingCap[j] := MyString[j + 1];
ScrollingCap[Length(ScrollingCap)] := MyString[1];
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
Scrollingcap:=form1.caption;
end;


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
常用的排列、组合、阶乘函数MATLAB发布时间:2022-07-18
下一篇:
【转载!】用matlab做矩阵的乘法,求行列式,求逆发布时间:2022-07-18
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap