Solved

Starting Screen Saver

Posted on 1998-08-30
2
144 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
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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
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…

747 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now