Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

delphiÆô¶¯·þÎñÍ£Ö¹·þÎñн¨·þÎñµÄ·½·¨

 
unit Servicescontrol;
   
interface  
uses Windows,Messages,SysUtils,Winsvc,Dialogs;
   
function StartServices(Const SvrName:String):Boolean;
function StopServices(Const SvrName:String):Boolean;
function QueryServiceStatu(Const SvrName:   String):String;
function CreateServices(Const SvrName,FilePath:String):Boolean;  
function DeleteServices(Const SvrName: String):Boolean;  
   
implementation  
   
//¿ªÆô·þÎñ  
function StartServices(Const   SvrName:   String):   Boolean;
var  
      a,b:SC_HANDLE;  
        c:PChar;  
begin  
        Result:=False;  
   
        a:=OpenSCManager(nil,nil,SC_MANAGER_ALL_ACCESS);  
   
        if a <=0 then Exit;  
   
        b:=OpenService(a,PChar(SvrName),SERVICE_ALL_ACCESS);  
   
        if b <=0 then Exit;  
            try  
              Result:=StartService(b,0,c);  
              CloseServiceHandle(b);  
              CloseServiceHandle(a);  
        except  
              CloseServiceHandle(b);  
    


Ïà¹ØÎĵµ£º

Delphi Éè¼Æģʽ£º¡¶HeadFirstÉè¼Æģʽ¡·Delphi7´úÂë

ûÓÐÓ¦ÓÃ״̬ģʽµÄ´úÂë
1. ¹¤³ÌÎļþ
program Project1;
{$APPTYPE CONSOLE}
uses
uGumballMachine in 'uGumballMachine.pas';
var
aGumballMachine: TGumballMachine;
begin
aGumballMachine := TGumballMachine.Create(5);
aGumballMachine.InsertQuarter;
aGumballMachine.TurnCrank;
Writeln; ......

DELPHIÈçºÎÏìӦʼþ

ÓÉÓÚÏîÄ¿ÐèÒª£¬¿ªÊ¼Ñ§Ï°DELPHI£¬²¢×Ô¼º±àд´úÂëÀ´²âÊÔÓÃVCдµÄDLL£¬¾õµÃ×Ô¼ºÓÖ¶àÕÆÎÕÁËһЩ£¬²»¶ÔµÄµØ·½Ï£ÍûÖ¸Õý£¬ÎÒ»áºÃºÃѧϰ
1¡¢ÏìÓ¦¼üÅÌʼþ£º
ÒòΪKeyPreviewĬÈÏÊÇ False;ÎÒÃÇÕâÀïÐèÒªÏìÓ¦¼üÅÌʼþµÄ»°£¬ÐèÒª½«ÆäÐÞ¸ÄΪTrue£»
ËùÒÔKeyPreview:=True; Õâ¶ÔһЩ¿ì½Ý¼ü»áÓÐÓá£
ÔÚFormCreateÕâ¸öº¯ÊýÀïÐÞ¸ÄKeyPrevie ......

Format¸ñʽ Delphi

Delphi formatµÄÓ÷¨
Ò»¡¢Formatº¯ÊýµÄÓ÷¨
FormatÊÇÒ»¸öºÜ³£Óã¬È´ÓÖËƺõºÜ·³µÄ·½·¨£¬±¾ÈËÊÔͼ¶ÔÕâ¸ö·½·¨µÄ°ïÖú½øÐÐһЩ·­Ò룬ÈÃËüÓÐÒ»¸öÍêÕûµÄ¸Åò£¬ÒÔ¹©´ó¼Ò²éѯ֮Óãº
Ê×ÏÈ¿´ËüµÄÉùÃ÷£º
function Format(const Format: string; const Args: array of const): string; overload;
ÊÂʵÉÏFormat·½·¨ÓÐÁ½¸öÖÖÐÎʽ£¬Á ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ