I am trying to capture an event when the screensaver starts. I have code
working on Windows XP etc when the Password/Welcome Screen is enabled
[Workstation is Locked]. Using the Fast User Switching Notifications.
However I am unable to detect the screensaver starting when the screensaver
password option is disabled. When using the WndProc Overrides I am unable to
capture the screensaver event unless the application is active [Our software
often sits in the Windows system tray].
Thank you in advance for any help that is given. I am attempting to use a
Hook to capture the WM_GETMESSAGE Hook using VB.NET my code is as follows:
'--------------------------------------------------------
Imports System.Windows. Forms
Imports System.Runtime. InteropServices
Public Class Screensaver
Dim hp As New HookProc(Addres sOf KeyboardProc)
Public Const WH_GETMESSAGE = 3
Public Const HC_ACTION = 0
Private m_ScreensaverHo ok As IntPtr
Private Declare Auto Function UnhookWindowsHo okEx Lib "user32" Alias
"UnhookWindowsH ookEx" (ByVal hHook As IntPtr) As Integer
Private Declare Auto Function SetWindowsHookE x Lib "user32" (ByVal
idHook As Integer, ByVal lpfn As HookProc, ByVal hMod As Long, ByVal
dwThreadId As Integer) As IntPtr
Private Declare Auto Function CallNextHookEx Lib "user32" (ByVal curHook
As IntPtr, ByVal nCode As Integer, ByVal wParam As Integer, ByVal lParam As
Integer)
Private Delegate Function HookProc(ByVal code As Integer, ByVal wParam
As Integer, ByVal lParam As IntPtr) As IntPtr
' Events
Public Event Screensaver(ByV al m As Message)
Public Sub SetHook()
Dim hInstance As Long =
System.Runtime. InteropServices .Marshal.GetHIN STANCE(System.R eflection.Assem bly.GetExecutin gAssembly.GetMo dules()(0)).ToI nt32()
Dim hThreadId As Integer = AppDomain.GetCu rrentThreadId()
'Dim hThreadId As Integer = 0
m_ScreensaverHo ok = SetWindowsHookE x(WH_GETMESSAGE , hp, hInstance,
hThreadId)
End Sub
Public Sub Unhook()
If m_ScreensaverHo ok.ToInt32 <> 0 Then
UnhookWindowsHo okEx(m_Screensa verHook)
End Sub
Private Function KeyboardProc(By Val nCode As Integer, ByVal wParam As
Integer, ByVal lParam As IntPtr) As IntPtr
If (nCode < HC_ACTION) Then
Return CallNextHookEx( m_ScreensaverHo ok, nCode, wParam,
lParam.ToInt32)
ElseIf (nCode = HC_ACTION) Then
Dim m As Message
m = CType(Marshal.P trToStructure(l Param, GetType(Message )),
Message)
Debug.WriteLine ("Screensave r")
RaiseEvent Screensaver(m)
End If
End Function
End Class 0 4182 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: klappnase |
last post by:
Hello everyone,
does anyone know a way to stop the screensaver under linux from
starting up while a certain process is running?
I need this because I experience a memory leak while recording
wav-files every time the screensaver starts.
It is a Tkinter application, btw.
Any help would be very appreciated.
Thanks
|
by: DanielB |
last post by:
Does anyone know what the command line argumentto launch a
screensaver's options/configuration dialog is on Windows XP Pro?
From most of the example source code I can find on the web, it would
seem to be '/c' but that does not seem to work for the screensaver I
have written. I've tested my code and if '/c' is the first argument
then the options dialog is launched but Windows XP does not seem to be
supplying the '/c' argument when I...
|
by: Paul Smith |
last post by:
I have been given an unusual task to create a Windows Service to do something
periodically to make the screensaver timer reset. We have a general policy
of locking computers automatically after 10 minutes of inactivity. This
windows service would be used on some machines to prevent the lock from
occurring every 10 minutes.
I have tried to reposition the mouse pointer with the Cursor class in a
service, but it does not work -- always...
|
by: Vaughn |
last post by:
I'm working on a simple screensaver (it just displays a different image
every 5 seconds) but I'm having trouble displaying an image in my form using
the BackGroundImage property. I was trying to use an ImageList with 4 items
so my code in the ScreenSaverForm_Load event handler looked like this:
int iImageShown = 0;
int iImageCount = imageList_saver.Images.Count-1;
Cursor.Hide();
TopMost = true;
while (n != 1) //my infinite loop ; is...
|
by: wushupork |
last post by:
I have written a screensaver application in C# .NET and have noticed
that whenever the animation loop is running - CPU usage always spikes
up close to 100%. My application uses a paint thread which is set at
100ms.
the program looks sort of like this:
// constructor
public Form1()
{
| |
by: Simon Mercer |
last post by:
I have been trying to build a screensaver that will connect to a database
and display specific data depending on the user that is logged in. I have
managed to get a simple data access screensaver to work, however, i can't
get the application to work with some prebuilt assemblies i have. Also,
when the screensaver is running under the windows screensaver settings it
also will not access the config file.
Any pointers would be greatly...
|
by: sanjana |
last post by:
hi i want to fire an event if the screen saver starts up
i have done it using a timer tick event where i have used the api
function to detect if screensaver has started..but this means
continuous polling at each timer click..
private void tick(object sender, System.EventArgs e)
{
const int SPI_GETSCREENSAVERRUNNING = 114;
int screenSaverRunning = -1;
// is the screen saver running?
|
by: Boris Fortes |
last post by:
I need to unhook event receiver as result of native C++ event.
It unhooks successfully, but __raise does not return and throws access
violation.
Visual Studio 2003
How to reproduce:
Consol Win32 exe project
|
by: Luke |
last post by:
I am trying to capture an event when the screensaver starts. I have code
working on Windows XP etc when the Password/Welcome Screen is enabled
. Using the Fast User Switching Notifications.
However I am unable to detect the screensaver starting when the screensaver
password option is disabled. When using the WndProc Overrides I am unable to
capture the screensaver event unless the application is active .
Thank you in advance for any...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |