?
Solved

Starting Screen Saver

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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
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…
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…
Suggested Courses
Course of the Month10 days, 23 hours left to enroll

770 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