2 Replies - 914 Views - Last Post: 14 October 2008 - 01:04 AM

#1 Xenon   User is offline

  • Connection failed
  • member icon

Reputation: 9
  • View blog
  • Posts: 1,595
  • Joined: 12-September 05

Starting a Screen saver using VB6 code

Posted 25 October 2005 - 01:08 AM

Description: declare the following code in a standard module and then call the call the Sub StartScreenSaver() using a command buttoninstantly call your screensaver ( only if the screensaver is enabled) by code. no need to wait for the time interval set by the PC.
 '***************************************************************************
' * Paste the lines below into a standard module, and call the 'StartScreensaver'    *
' * routine to start the screen saver (if the user has selected one)        *
' ***************************************************************************
Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" _
   (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, _
    ByVal lParam As Long) As Long

Public Const WM_SYSCOMMAND = &H112&
Public Const SC_SCREENSAVE = &HF140&



Public Sub StartScreensaver()
  Dim lRet As Long
  
  lRet = SendMessage(Form1.hWnd, WM_SYSCOMMAND, SC_SCREENSAVE, 0&)
End Sub

'*************************************
' Add this code to the command button*
'*************************************
Private Sub Command1_Click()
Call Module1.StartScreensaver
End Sub




Is This A Good Question/Topic? 0
  • +

Replies To: Starting a Screen saver using VB6 code

#2 aritraneogy   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 0
  • Joined: 31-August 08

Re: Starting a Screen saver using VB6 code

Posted 31 August 2008 - 09:12 AM

will you pleasewrite the code of exiting from screen saver using password
Was This Post Helpful? 0
  • +
  • -

#3 solidsydney   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 0
  • Joined: 14-October 08

Re: Starting a Screen saver using VB6 code

Posted 14 October 2008 - 01:04 AM

'*************************************************************************** ' * Paste the lines below into a standard module, and call the 'StartScreensaver' * ' * routine to start the screen saver (if the user has selected one) * ' *************************************************************************** Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" _ (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, _ ByVal lParam As Long) As Long Public Const WM_SYSCOMMAND = &H112& Public Const SC_SCREENSAVE = &HF140& Public Sub StartScreensaver() Dim lRet As Long lRet = SendMessage(Form1.hWnd, WM_SYSCOMMAND, SC_SCREENSAVE, 0&) End Sub '************************************* ' Add this code to the command button* '************************************* Private Sub Command1_Click() Call Module1.StartScreensaver End Sub
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1