Playing With System Using Delphi

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;

转载于:https://www.cnblogs.com/Thinknet/archive/2006/10/25/538985.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值