Registriert seit: 29. Okt 2005
Ort: Hinter den Bergen bei den Sieben Zwergen
98 Beiträge
Delphi 2005 Personal
|
Re: Komponente geht nicht
20. Dez 2006, 16:39
Sie ist aber trotzdem unterstrichen.
\\Edit
Delphi-Quellcode:
unit shutdown;
interface
uses
SysUtils, Classes, shellapi, Forms, Windows;
type
Tshutdown = class(TComponent)
private
{ Private-Deklarationen }
out: Boolean;
down: Boolean;
re: Boolean;
kill: Boolean;
protected
{ Protected-Deklarationen }
public
{ Public-Deklarationen }
function shutdown: Boolean;
function logout: Boolean;
function restart: Boolean;
function killtask : Boolean;
published
{ Published-Deklarationen }
property shutdown_ : Boolean Read down write down;
property restart_ : Boolean Read re write re;
property logout_ : Boolean Read out write out;
property killtask_ : Boolean Read kill write kill;
end;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents(' Samples', [Tshutdown]);
end;
function Tshutdown.shutdown:Boolean;
begin
if shutdown_= true then
begin
ShellExecute(Application.Handle, ' open', ' cmd', ' shutdown -s', nil, SW_Shownormal);
end
else
shutdown_ := false;
end;
function Tshutdown.logout:Boolean;
begin
if logout_= true then
begin
ShellExecute(Application.Handle, ' open', ' cmd', ' shutdown -l', nil, SW_Shownormal);
end
else
logout_ := false;
end;
function Tshutdown.restart:Boolean;
begin
if restart_= true then
begin
ShellExecute(Application.Handle, ' open', ' cmd', ' shutdown -r', nil, SW_Shownormal);
end
else
restart_ := false;
end;
function Tshutdown.killtask:Boolean;
begin
if killtask_= true then
begin
ShellExecute(Application.Handle, ' open', ' cmd', ' shutdown -f', nil, SW_Shownormal);
end
else
killtask_ := false;
end;
end.
[edit=MrSpock]Delphi-Code tags eingefügt. Mfg, MrSpock[/edit]
|
|
Zitat
|