1。可以吧程序方到启动里
2。用api函数测试如果再空闲时就启动time计数器控件然后就行了

解决方案 »

  1.   

    能否再详细些 ? 
      1、比方一些实时监控程序,象KILL、瑞星等杀毒软件,在系统启动时便自动运行了,我看它们也不在启动里啊。
      2、如何判断系统是否处于空闲状态,用哪个API函数 ?
      
      

  2.   

    第一个问题:杀毒软件一般都放在注册表里:
    路径是:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run
      

  3.   

    uses registry;
    procedure AddToAutoRun(szCaption,szExeName:string);
    var
     reg:tregistry;
    begin
     reg:=tregistry.create;
     reg.rootkey:=hkey_local_machine;
     if reg.Openkey('Software\Microsoft\Windows\CurrentVersion\Run',true) then
       reg.writestring(szCaption,szExeName);
     reg.free;
    end;用法:
      AddToAutoRun('随便一个名字','你的可执行文件名');
    例如:
      AddToAutoRun('MyAutoRun',paramstr(0));
      

  4.   

    to Kingron:
        依照你的方式做,好象程序并没有启动啊。
      

  5.   

    1. 楼上各位的作法是对的,有4个地方可以做
      .Registry的HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run 
      .加到启动中
      .在 win.ini 中加入 Run= \path\your application name
      .如果你的程序是个事务,那它是在加载 Windows时就执行了。2. 有两种可能
      .你的程序是个一般 Win32应用程序, 用子类化Application.Handle后, 用Screen server消息作。
      .是个事务, 因为你的程序是运行在 1级,可以得到空闲通知
      

  6.   

    uses registry;
    procedure AddToAutoRun(szCaption,szExeName:string);
    var
    reg:tregistry;
    begin
    reg:=tregistry.create;
    reg.rootkey:=hkey_local_machine;
    if reg.Openkey('Software\Microsoft\Windows\CurrentVersion\Run',true) then
      reg.writestring(szCaption,szExeName);
    reg.free;
    end;这段程序已经把你的程序写到注册表里了!
    你可以到注册表里
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run 
    下看看!如有就OK了,你下次在启动机器时就可以了!
      

  7.   

    你删除后只能在下次启动是有效。
    1 用注册表编辑器删除。(废话)
    2 运行 开始/程序/附件/系统工具/系统信息,在工具菜单下单击系统配置项,在启动页下可以使已经添加的项失效。
    3 当然用程序,方法和写入一样,换一个函数就行了。查一查HELP吧。BTW,你几年级了,是MM吗?(不想说也没关系)。
      

  8.   

    谁能告诉我DeleteValue()函数的用法,最好给我一个可行的例子,谢谢 !
      

  9.   

    RegDeleteValue
    The RegDeleteValue function removes a named value from the specified registry key. 
    LONG RegDeleteValue(
      HKEY hKey,            // handle to key
      LPCTSTR lpValueName   // address of value name
    );
    Parameters
    hKey 
    Handle to a currently open key or any of the following predefined reserved handle values: 
    HKEY_CLASSES_ROOT
    HKEY_CURRENT_CONFIG
    HKEY_CURRENT_USER
    HKEY_LOCAL_MACHINE
    HKEY_USERS
    Windows NT: HKEY_PERFORMANCE_DATA
    Windows 95 and Windows 98: HKEY_DYN_DATA lpValueName 
    Pointer to a null-terminated string that names the value to remove. If this parameter is NULL or points to an empty string, the value set by the RegSetValue function is removed. 
    Return Values
    If the function succeeds, the return value is ERROR_SUCCESS.If the function fails, the return value is a nonzero error code defined in WINERROR.H. You can use the FormatMessage function with the FORMAT_MESSAGE_FROM_SYSTEM flag to get a generic description of the error.
      

  10.   

    哈哈,居然所我的程序没有起作用?
    删除:
    uses registry;
    procedure DeleteAutoRun(szCaption:string);
    var
    reg:tregistry;
    begin
    reg:=tregistry.create;
    reg.rootkey:=hkey_local_machine;
    if reg.Openkey('Software\Microsoft\Windows\CurrentVersion\Run',true) then
      reg.DeleteValue(szCaption);
    reg.free;
    end;
    其中,szCaption就是你上次写的名字!
      

  11.   

    这两个问题对VB来说是小菜,我劝你改用VB得了。