segun tengo entendido en todos los sistemas basados en NT
(w2k, xp, .Net server...) no se puede deshabilitar el ALT +CTRL +
Delete, pues es parte integral del sistema. por medio de politicas
en w2k, se puede deshabilitar el uso del administrador de tareas
ahora bien, lo que a mi se me ocurriria a grosso modo, es tener 2
ejecutables uno, con un nombre extraño, o nombre similar al de
algun programa de windows, y que el se encargue de ver cada 5
minutos si tu otro exe esta corriendo (con la api FindWindow, o
IsWindow) y si no la encuentra, pues, que la ejecute.
la otra opcion, es que si van a ser todas las estaciones windows 2000 o Xp, pues correr el programa como un servicio, de esa
manera no se puede matar, y que el programa cuando cumpla el
tiempo de alquiler, pues que bloquee la estacion de trabajo con
la api LockWorkStation
aca mando las declaraciones de las 3 apis mencionadas:
Private Declare Function LockWorkStation Lib "user32.dll" () As Long
Private Sub Form_Load()
'KPD-Team 2000
'URL:
http://www.allapi.net/
'E-Mail:
[email protected]
LockWorkStation
End Sub
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function PostMessage Lib "user32" Alias "PostMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Declare Function GetClassName Lib "user32" Alias "GetClassNameA" (ByVal hwnd As Long, ByVal lpClassName As String, ByVal nMaxCount As Long) As Long
Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
Const SW_SHOWNORMAL = 1
Const WM_CLOSE = &H10
Const gcClassnameMSWord = "OpusApp"
Const gcClassnameMSExcel = "XLMAIN"
Const gcClassnameMSIExplorer = "IEFrame"
Const gcClassnameMSVBasic = "wndclass_desked_gsk"
Const gcClassnameNotePad = "Notepad"
Const gcClassnameMyVBApp = "ThunderForm"
Private Sub Form_Load()
'KPD-Team 1998
'URL:
http://www.allapi.net/
'E-Mail:
[email protected]
Dim WinWnd As Long, Ret As String, RetVal As Long, lpClassName As String
'Ask for a Window title
Ret = InputBox("Enter the exact window title:" + Chr$(13) + Chr$(10) + "Note: must be an exact match")
'Search the window
WinWnd = FindWindow(vbNullString, Ret)
If WinWnd = 0 Then MsgBox "Couldn't find the window ...": Exit Sub
'Show the window
ShowWindow WinWnd, SW_SHOWNORMAL
'Create a buffer
lpClassName = Space(256)
'retrieve the class name
RetVal = GetClassName(WinWnd, lpClassName, 256)
'Show the classname
MsgBox "Classname: " + Left$(lpClassName, RetVal)
'Post a message to the window to close itself
PostMessage WinWnd, WM_CLOSE, 0&, 0&
End Sub
Const RDW_INVALIDATE = &H1
Const BS_HATCHED = 2
Const HS_CROSS = 4
Private Type LOGBRUSH
lbStyle As Long
lbColor As Long
lbHatch As Long
End Type
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Private Declare Function CreateBrushIndirect Lib "gdi32" (lpLogBrush As LOGBRUSH) As Long
Private Declare Function CreateRectRgn Lib "gdi32" (ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
Private Declare Function IsWindow Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function SetRectEmpty Lib "user32" (lpRect As RECT) As Long
Private Declare Function SetRect Lib "user32" (lpRect As RECT, ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
Private Declare Function IsRectEmpty Lib "user32" (lpRect As RECT) As Long
Private Declare Function IntersectRect Lib "user32" (lpDestRect As RECT, lpSrc1Rect As RECT, lpSrc2Rect As RECT) As Long
Private Declare Function RedrawWindow Lib "user32" (ByVal hwnd As Long, lprcUpdate As Any, ByVal hrgnUpdate As Long, ByVal fuRedraw As Long) As Long
Private Declare Function GetRgnBox Lib "gdi32" (ByVal hRgn As Long, lpRect As RECT) As Long
Private Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As Long
Private Declare Function FillRect Lib "user32" (ByVal hdc As Long, lpRect As RECT, ByVal hBrush As Long) As Long
Private Sub Form_Load()
'KPD-Team 1999
'URL:
http://www.allapi.net/
'E-Mail:
[email protected]
'Check if this window is a window
If IsWindow(Me.hwnd) = 0 Then
MsgBox "Hmm.. I hope you altered the code, or else your system is meeting with difficulties!", vbInformation
End If
'API uses pixels
Me.ScaleMode = vbPixels
End Sub
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
'Redraw this window (invoke a Paint-event)
RedrawWindow Me.hwnd, ByVal 0&, ByVal 0&, RDW_INVALIDATE
End Sub
Private Sub Form_Paint()
Dim LB As LOGBRUSH, R As RECT, Rgn As Long, RgnRect As RECT, hBrush As Long
'randomize
Randomize Timer
LB.lbColor = RGB(Int(Rnd * 256), Int(Rnd * 256), Int(Rnd * 256))
LB.lbStyle = BS_HATCHED
LB.lbHatch = HS_CROSS
'Create a new brush
hBrush = CreateBrushIndirect(LB)
'Set the rectangle's values
SetRect R, 0, 0, 200, 200
'Create a rectangle region
Rgn = CreateRectRgn(100, 50, 300, 10)
'Get the region box
GetRgnBox Rgn, RgnRect
'calculate the intersection of two rectangles
IntersectRect R, RgnRect, R
'Empty the rectangle
SetRectEmpty RgnRect
'Fill our rectangle
FillRect Me.hdc, R, hBrush
'delete our brush
DeleteObject hBrush
'Check if the rectangle is empty
If IsRectEmpty(RgnRect) <> 0 Then SetRectEmpty RgnRect
End Sub