发信人: ilike() 
整理人: flyingmist(1999-12-29 18:05:29), 站内信件
 | 
 
 
说明:程序是调用SystemParametersInfo API函数完成。
 先定义:
 Function uLong SystemParametersInfoA (ulong uAction, ulong uParam, ref 
 
  any lpvParam, ulong fuWinIni) Library "user32.dll" 
 Integer SPI_SCREENSAVERRUNNING = 97 
 //使Ctrl+Alt+Del失效: 
 Integer i_ret 
 any any_value 
 i_ret = SystemParametersInfoA(SPI_SCREENSAVERRUNNING, 1, any_value, 0) 
 
  
 //恢复Ctrl+Alt+Del作用: 
 Integer i_ret 
 any any_value 
 i_ret = SystemParametersInfoA(SPI_SCREENSAVERRUNNING, 0, any_value, 0) 
  
 上面这段是陶清网站(pb7.nethome.com.cn)上的方法
 严格来说这段代码实际是屏蔽了ctrl+alt+del这个键的组合,而并非不让程序出 现在任务列表中。
 这种方法有些缺陷:
 1.其他程序也无法通过这个ctrl+alt+del关闭了,有时候有些程序还是需要通过这 
 
 个键关的。
 2.任务列表并非只能通过ctrl+alt+del打开的,如果通过其他方法打开,那么这 
 
 种方法就失效了。
 
 下面是让程序真正不出现在任务列表的方法:
 定义:
 function long GetCurrentProcessId ( ) library "kernel32"
 function long RegisterServiceProcess ( long dwProcessID, long dwtype ) 
 
  library "kernel32"
 
 Constant long RSP_SIMPLE_SERVICE = 1 
 Constant long RSP_UNREGISTER_SERVICE = 0 
 
 在application -> open event中:
 Long ll_ProcessID
 ll_ProcessID = GetCurrentProcessId ( )
 RegisterServiceProcess ( ll_ProcessID, RSP_SIMPLE_SERVICE )
 
 这样程序将不出现在任务列表中,用户也就无法强行结束任务。
 
 记住,在application close event中要加:
 Long ll_ProcessID
 ll_ProcessID = GetCurrentProcessId ( )
 RegisterServiceProcess ( ll_ProcessID, RSP_UNREGISTER_SERVICE)
 
 来释放资源。
 
 
 
 
 -- ※ 修改:.ilike 于 Dec 29 10:45:29 修改本文.[FROM: 202.103.137.78] ※ 来源:.月光软件站 http://www.moon-soft.com.[FROM: 202.103.137.78]
  | 
 
 
 |