Solved

Starting Screen Saver

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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Adding to a VBA? 6 78
passing a value with stream reader AFTER a ";" 3 74
IF ELSE Statement in Excel Macro VBA 16 75
Formula problem with Excel attachment 6 39
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 …
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

830 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