Visual Basic Classic
--
Questions
--
Followers
Top Experts
Zero AI Policy
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
On win 9.x it's possible but you'll have to be sure that your code handles all keyboard activity
Private Const SPI_SCREENSAVERRUNNING = 97&
   Private Declare Function SystemParametersInfo Lib "User32" _
     Alias "SystemParametersInfoA" _
     (ByVal uAction As Long, _
     ByVal uParam As Long, _
     lpvParam As Any, _
     ByVal fuWinIni As Long) As Long
   Private Sub Form_Load()
     Command1.Caption = "Disabled"
     Command2.Caption = "Enabled"
   End Sub
   Private Sub Form_Unload(Cancel As Integer)
     'Re-enable CTRL+ALT+DEL and ALT+TAB before the program terminates.
     Command2_Click
   End Sub
   Private Sub Command1_Click()
     Dim lngRet As Long
     Dim blnOld As Boolean
     lngRet = SystemParametersInfo(SPI_S
     blnOld, _
      0&)
   End Sub
   Private Sub Command2_Click()
    Dim lngRet As Long
    Dim blnOld As Boolean
    lngRet = SystemParametersInfo(SPI_S
    blnOld, _
      0&)
   End Sub
Â






EARN REWARDS FOR ASKING, ANSWERING, AND MORE.
Earn free swag for participating on the platform.

Get a FREE t-shirt when you ask your first question.
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
Option Explicit
Private Const SPI_SCREENSAVERRUNNING = 97&
   Private Declare Function SystemParametersInfo Lib "user32" _
     Alias "SystemParametersInfoA" _
     (ByVal uAction As Long, _
     ByVal uParam As Long, _
     lpvParam As Any, _
     ByVal fuWinIni As Long) As Long
' SetWindowPos Function
   Private 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
   ' SetWindowPos Flags
   Private Const SWP_NOSIZE = &H1
   Private Const SWP_NOMOVE = &H2
   Private Const HWND_TOPMOST = -1
   Private Const HWND_NOTOPMOST = -2
Public LoginSucceeded As Boolean
Private Sub cmdOK_Click()
  'check for correct password
  If txtPassword = Form1.Text1.Text Then
    'place code to here to pass the
    'success to the calling sub
    'setting a global var is the easiest
    LoginSucceeded = True
    Dim lngRet As Long
    Dim blnOld As Boolean
    lngRet = SystemParametersInfo(SPI_S
    blnOld, _
      0&)
    End
  Else
    MsgBox "Invalid Password, try again!", , "Login"
    txtPassword.SetFocus
    SendKeys "{Home}+{End}"
  End If
End Sub
Private Sub Command1_Click()
  'check for correct password
  If txtPassword = Form1.Text1.Text Then
    'place code to here to pass the
    'success to the calling sub
    'setting a global var is the easiest
    LoginSucceeded = True
    Dim lngRet As Long
    Dim blnOld As Boolean
    lngRet = SystemParametersInfo(SPI_S
    blnOld, _
    0&)
    Form1.Show
    Unload Me
  Else
    MsgBox "Invalid Password, try again!", , "Login"
    txtPassword.SetFocus
    SendKeys "{Home}+{End}"
  End If
End Sub
Private Sub Form_Load()
  Me.Left = 0
  Me.Top = 0
  SetTopMostWindow Me.hwnd, True
  Dim lngRet As Long
  Dim blnOld As Boolean
  lngRet = SystemParametersInfo(SPI_S
  blnOld, _
  0&)
End Sub
Private Sub Form_Resize()
  Me.Width = Screen.Width
  Me.Height = Screen.Height
  Â
End Sub
Have you setup Form2 as the startup object for the project? Â Is there any code in form1 I should know about?
If not, save your project and reboot. Â
Try it when your machine is cleanly booted.
Option Explicit
Private Declare Function fCreateShellLink Lib "STKIT432.DLL" (ByVal _
  lpstrFolderName As String, ByVal lpstrLinkName As String, ByVal _
  lpstrLinkPath As String, ByVal lpstrLinkArgs As String) As Long
Const pass = "yepper.ini"
Private Sub Command1_Click()
Dim lReturn As Long
If Check1.Value = 1 Then
 lReturn = fCreateShellLink("\Startup
 App.Path & "\protector.exe", "")
End If
ChDir "c:\windows"
Open pass For Output As #1
Print #1, Text1.Text
Close #1
Unload Me
End Sub
Private Sub Command2_Click()
frmLogin.Show
Unload Me
End Sub
Private Sub Form_Load()
Check1.Value = CInt(GetSetting("MyApp", "Controls", "Checkbox", "0"))
IGNORE THIS PART OF CODE FOR NOW I NEED TO FIX IT
'Dim getit
'Open pass For Input As #1
'Print #1, getit
'Close #1
'Text1.Text = getit
End Sub
Private Sub Form_Unload(Cancel As Integer)
SaveSetting "MyApp", "Controls", "Checkbox", Check1.Value
End Sub






EARN REWARDS FOR ASKING, ANSWERING, AND MORE.
Earn free swag for participating on the platform.
Visual Basic Classic
--
Questions
--
Followers
Top Experts
Visual Basic is Microsoft’s event-driven programming language and integrated development environment (IDE) for its Component Object Model (COM) programming model. It is relatively easy to learn and use because of its graphical development features and BASIC heritage. It has been replaced with VB.NET, and is very similar to VBA (Visual Basic for Applications), the programming language for the Microsoft Office product line.