home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 1_2002.ISO / Data / Zips / ProjectX1_562922192002.psc / ModulesSystem / modSystemX2.bas < prev   
Encoding:
BASIC Source File  |  1997-02-19  |  2.9 KB  |  87 lines

  1. Attribute VB_Name = "modSystemX2"
  2. '-----------------------------------
  3. '-   You can change/restrict Windows a little:
  4. '-
  5. '-  Disable/Enable Ctrl+Alt+Delete
  6. '-  Hide/Show Stuff
  7. '-  Set forms on top/not on top
  8. '-
  9. '-   By T-Virus Creations
  10. '- http://www.tvirusonline.be
  11. '- email: tvirus4ever@yahoo.co.uk
  12. '-
  13. '-----------------------------------
  14.  
  15. Option Explicit
  16. Private Declare Function GetDiskFreeSpace Lib "kernel32" Alias "GetDiskFreeSpaceA" (ByVal lpRootPathName As String, lpSectorsPerCluster As Long, lpBytesPerSector As Long, lpNumberOfFreeClusters As Long, lpTtoalNumberOfClusters As Long) As Long
  17. '--
  18. Public Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal X As Long, ByVal Y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
  19. Public Declare Function SystemParametersInfo Lib "user32" Alias "SystemParametersInfoA" (ByVal uAction As Long, ByVal uParam As Long, ByRef lpvParam As Any, ByVal fuWinIni As Long) As Long
  20. Public Const HWND_TOPMOST = -1
  21. Public Const HWND_NOTOPMOST = -2
  22. Public Const SWP_NOSIZE = &H1
  23. Public Const SWP_NOMOVE = &H2
  24. Public Const FLAGS = SWP_NOSIZE Or SWP_NOMOVE
  25. '--
  26. Private Declare Function GetCurrentProcessId Lib "kernel32" () As Long
  27. Private Declare Function RegisterServiceProcess Lib "kernel32" (ByVal dwProcessId As Long, ByVal dwType As Long) As Long
  28.     Const SPI_SCREENSAVERRUNNING = 97
  29.     Const RSP_SIMPLE_SERVICE = 1
  30.     Const RSP_UNREGISTER_SERVICE = 0
  31. '--
  32. Private Declare Function GetDesktopWindow Lib "user32" () As Long
  33. Private Declare Function GetTopWindow Lib "user32" (ByVal hwnd As Long) As Long
  34. Private Declare Function SetForegroundWindow Lib "user32" (ByVal hwnd As Long) As Long
  35.  
  36.  
  37.  
  38. '--
  39. Public Sub HideStart(FormT As Form)
  40. ' Put HideStart in a timer
  41.    Dim desktop, tophwnd As Long
  42.    
  43.    desktop = GetDesktopWindow()
  44.    tophwnd = GetTopWindow(desktop)
  45.    If tophwnd <> FormT.hwnd Then SetForegroundWindow (FormT.hwnd)
  46.  
  47. End Sub
  48.  
  49. Public Sub TvHideFromCAD()
  50.     Dim lngProcessID As Long
  51.     Dim lngid As Long
  52.     
  53.     lngid = GetCurrentProcessId()
  54.     Call RegisterServiceProcess(lngid, RSP_SIMPLE_SERVICE)
  55. End Sub
  56.  
  57.  
  58. Public Sub TvShowInCAD()
  59.     Dim lngProcessID As Long
  60.     Dim lngid As Long
  61.     
  62.     lngid = GetCurrentProcessId()
  63.     Call RegisterServiceProcess(lngid, RSP_UNREGISTER_SERVICE)
  64. End Sub
  65.  
  66. Public Function TvDisableCAD()
  67. Dim bck As Integer
  68.  Dim Old As Boolean
  69.  bck = SystemParametersInfo(SPI_SCREENSAVERRUNNING, True, Old, 0)
  70. End Function
  71. Public Function TvEnableCAD()
  72. Dim bck As Integer
  73. Dim Old As Boolean
  74.  bck = SystemParametersInfo(SPI_SCREENSAVERRUNNING, False, Old, 0)
  75. End Function
  76.  
  77. Public Function TvOnTop(TForm As Form)
  78. Dim WinOnTop As Long
  79. WinOnTop = SetWindowPos(TForm.hwnd, HWND_TOPMOST, 0, 0, 0, 0, FLAGS)
  80. End Function
  81. Public Function TvNotOnTop(TForm As Form)
  82. Dim WinOnTop As Long
  83. WinOnTop = SetWindowPos(TForm.hwnd, HWND_NOTOPMOST, 0, 0, 0, 0, FLAGS)
  84. End Function
  85.  
  86.  
  87.