Solved

Starting Screen Saver

Posted on 1998-08-30
2
148 Views
Last Modified: 2010-04-30
Hi,
I am using VB5 and want to start the users screen saver
under _windows 98_ (the command should work under 95/NT too, but 98 is primary concern).  I had code before that started it under 95/NT, but under 98 it seems to put the computer in 'standby' mode or something.  I am sure it is just a case of know the correct API function and the value(s) to pass it.

Thanks,
oreg
0
Comment
Question by:oreg
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 1

Accepted Solution

by:
jf26028 earned 90 total points
ID: 1431942
Private 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

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


To start the screen saver, use the following code:

Dim result As Long
result = SendMessage(Form1.hWnd, WM_SYSCOMMAND, SC_SCREENSAVE,0&)      
0
 

Author Comment

by:oreg
ID: 1431943
Hi,

I am SOOO sorry it took so long to grade this...It was not working for me right away...I found out my problem was that I forgot a 'byval' in the last argument to sendmessage...sheesh, who would have thought that simply changing byval would have two very different, but safe (standby vs screen saver).

Thanks!
0

Featured Post

[Webinar] Code, Load, and Grow

Managing multiple websites, servers, applications, and security on a daily basis? Join us for a webinar on May 25th to learn how to simplify administration and management of virtual hosts for IT admins, create a secure environment, and deploy code more effectively and frequently.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Modifying Conditional Format from VBA code 3 79
vbModal 12 72
Set email body to html using vbscript 6 87
VB6 Enviroment 3 30
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

740 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question