Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Starting Screen Saver

Posted on 1998-08-30
2
Medium Priority
?
151 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 360 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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…
Suggested Courses

610 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