What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Skype & Technology » Tech Talk » Help disabling Windows Screensaver

Pages: (2): « First [ 1 ] 2 » Last »
Help disabling Windows Screensaver
Author: Message:
Salem
Senior Member
****

Avatar

Posts: 769
Reputation: 16
37 / Male / Flag
Joined: May 2004
O.P. Help disabling Windows Screensaver
Hi There

I'm seriously looking for help on how to disable the windows screensaver whenever the application i created is opened and then have the screensaver enabled again when my application is closed. My program is being written in Visual Basic. I'm fairly new to VB (hav only been programming with it for about a year now) so any help will be appreciated, although the more detailed the help the better (would be better if visual basic code is provided).

For the person who provides the most effective VB code i'd be willing to reward you with a Gmail (1GB) e-mail account, and i'd give you credit in my program (the program will be publically available on the web in 2005). You will also be given beta testing privilages for the product this code will go towards

Thanx in advance

EDIT: Id also like to notify everyone here that I've posted the same request on another forum offering the same reward. Whichever one works first and the best will receive the reward. The winner will be informed by PM.



edited by: RileyM at 10:29 (GMT) on New Years' Eve 2004. Reason for editing: to notify posters that this request was posted at another forum as well

This post was edited on 12-31-2004 at 10:32 AM by Salem.
[Image: salem874.smart.jpg][Image: card.png]
Was i Helpful?[/url]
12-30-2004 07:03 PM
Profile PM Find Quote Report
Mike
Elite Member
*****

Avatar
Meet the Spam Family!

Posts: 2795
Reputation: 48
32 / Male / Flag
Joined: Mar 2003
Status: Online
RE: Help disabling Windows Screensaver
Try this :)

Put this on the top of the form code
code:
'<<< CONSTANTS >>>
Private Const SPI_SETSCREENSAVEACTIVE As Long = 17

Private Const SPIF_UPDATEINIFILE = &H1
Private Const SPIF_SENDWININICHANGE = &H2


'<<< DECLARES >>>
Private Declare Function SystemParametersInfo _
                Lib "user32" _
                Alias "SystemParametersInfoA" _
                (ByVal uAction As Long, ByVal uParam As Long, _
                ByRef lpvParam As Any, ByVal fuWinIni As Long) As Long

To enable/disable the screensaver:
code:
   Dim lRet As Long
   
   lRet = SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, 0, ByVal 0, SPIF_UPDATEINIFILE)
Change the bolded part to 0 if you want to disable it and to 1 if you want to enable it :)
YouTube closed-captions ripper (also allows you to download videos!)
12-30-2004 10:37 PM
Profile E-Mail PM Web Find Quote Report
Salem
Senior Member
****

Avatar

Posts: 769
Reputation: 16
37 / Male / Flag
Joined: May 2004
O.P. RE: RE: Help disabling Windows Screensaver
quote:
Originally posted by Mike2
Try this :)

Put this on the top of the form code
code:
'<<< CONSTANTS >>>
Private Const SPI_SETSCREENSAVEACTIVE As Long = 17

Private Const SPIF_UPDATEINIFILE = &H1
Private Const SPIF_SENDWININICHANGE = &H2


'<<< DECLARES >>>
Private Declare Function SystemParametersInfo _
                Lib "user32" _
                Alias "SystemParametersInfoA" _
                (ByVal uAction As Long, ByVal uParam As Long, _
                ByRef lpvParam As Any, ByVal fuWinIni As Long) As Long

To enable/disable the screensaver:
code:
   Dim lRet As Long
   
   lRet = SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, 0, ByVal 0, SPIF_UPDATEINIFILE)
Change the bolded part to 0 if you want to disable it and to 1 if you want to enable it :)


i got this error when running the program. sorry for the psot saying i couldnt see bold. when i posted it i saw the bold and then deleted the psot immediately sorry.

RileyM

.jpg File Attachment: vb screensaver disable error.jpg (44.52 KB)
This file has been downloaded 203 time(s).
[Image: salem874.smart.jpg][Image: card.png]
Was i Helpful?[/url]
12-30-2004 10:56 PM
Profile PM Find Quote Report
Mike
Elite Member
*****

Avatar
Meet the Spam Family!

Posts: 2795
Reputation: 48
32 / Male / Flag
Joined: Mar 2003
Status: Online
RE: Help disabling Windows Screensaver
Yeah, you put this code in the form_load event, command1_click event etc :)
YouTube closed-captions ripper (also allows you to download videos!)
12-30-2004 10:57 PM
Profile E-Mail PM Web Find Quote Report
Salem
Senior Member
****

Avatar

Posts: 769
Reputation: 16
37 / Male / Flag
Joined: May 2004
O.P. RE: RE: Help disabling Windows Screensaver
quote:
Originally posted by Mike2
Yeah, you put this code in the form_load event, command1_click event etc :)


oh, so i must put it on a button, not form load. and the other code also in the button?
[Image: salem874.smart.jpg][Image: card.png]
Was i Helpful?[/url]
12-30-2004 11:01 PM
Profile PM Find Quote Report
DJeX
Veteran Member
*****

Avatar


Posts: 1138
Reputation: 11
– / Male / –
Joined: Jul 2003
RE: Help disabling Windows Screensaver
Put this code above all other code in the form. (very top)

code:
'<<< CONSTANTS >>>
Private Const SPI_SETSCREENSAVEACTIVE As Long = 17

Private Const SPIF_UPDATEINIFILE = &H1
Private Const SPIF_SENDWININICHANGE = &H2


'<<< DECLARES >>>
Private Declare Function SystemParametersInfo _
                Lib "user32" _
                Alias "SystemParametersInfoA" _
                (ByVal uAction As Long, ByVal uParam As Long, _
                ByRef lpvParam As Any, ByVal fuWinIni As Long) As Long


Now you can put this code in the form_load:

code:
Dim lRet As Long
   
   lRet = SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, 0, ByVal 0, SPIF_UPDATEINIFILE)

This post was edited on 12-30-2004 at 11:08 PM by DJeX.
[Image: top.gif]
12-30-2004 11:07 PM
Profile PM Web Find Quote Report
Salem
Senior Member
****

Avatar

Posts: 769
Reputation: 16
37 / Male / Flag
Joined: May 2004
O.P. RE: RE: Help disabling Windows Screensaver
quote:
Originally posted by DJeX
Put this code above all other code in the form. (very top)

code:
'<<< CONSTANTS >>>
Private Const SPI_SETSCREENSAVEACTIVE As Long = 17

Private Const SPIF_UPDATEINIFILE = &H1
Private Const SPIF_SENDWININICHANGE = &H2


'<<< DECLARES >>>
Private Declare Function SystemParametersInfo _
                Lib "user32" _
                Alias "SystemParametersInfoA" _
                (ByVal uAction As Long, ByVal uParam As Long, _
                ByRef lpvParam As Any, ByVal fuWinIni As Long) As Long


Now you can put this code in the form_load:

code:
Dim lRet As Long
   
   lRet = SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, 0, ByVal 0, SPIF_UPDATEINIFILE)


sorry if im a bit confused. when u say put it at right at the top of them form do you mean on a button? And put the dim IRet part on form load?

dont i need to put anything in a module?

RileyM

This post was edited on 12-30-2004 at 11:17 PM by Salem.
[Image: salem874.smart.jpg][Image: card.png]
Was i Helpful?[/url]
12-30-2004 11:17 PM
Profile PM Find Quote Report
DJeX
Veteran Member
*****

Avatar


Posts: 1138
Reputation: 11
– / Male / –
Joined: Jul 2003
RE: Help disabling Windows Screensaver
Humm well now that I look at his code I see its a bit dodgy.

I attached a VB project that will enable or disable the screen saver with command buttons.

It can easly be edited to enable or disable on form load.

Give it a try.

.zip File Attachment: screen saver disable enable.zip (1.55 KB)
This file has been downloaded 216 time(s).
[Image: top.gif]
12-30-2004 11:24 PM
Profile PM Web Find Quote Report
Salem
Senior Member
****

Avatar

Posts: 769
Reputation: 16
37 / Male / Flag
Joined: May 2004
O.P. RE: RE: Help disabling Windows Screensaver
quote:
Originally posted by DJeX
Humm well now that I look at his code I see its a bit dodgy.

I attached a VB project that will enable or disable the screen saver with command buttons.

It can easly be edited to enable or disable on form load.

Give it a try.


Thanks for that. I've put it in my program and havent received any error messages yet(Y). I'm knackered, so wil test it tomorrow and will get back to you. If everything works i'll PM you to sort out you Gmail invite and how you like to be credited, in my program.

Thnx agen
RileyM:D
[Image: salem874.smart.jpg][Image: card.png]
Was i Helpful?[/url]
12-30-2004 11:53 PM
Profile PM Find Quote Report
Salem
Senior Member
****

Avatar

Posts: 769
Reputation: 16
37 / Male / Flag
Joined: May 2004
O.P. RE: RE: Help disabling Windows Screensaver
quote:
Originally posted by DJeX
Humm well now that I look at his code I see its a bit dodgy.

I attached a VB project that will enable or disable the screen saver with command buttons.

It can easly be edited to enable or disable on form load.

Give it a try.


Sorry it did not work.

i created menu a menu where it will allow the user to select whether he/she wants the screensaver disabled.

i've placed the code behind the Enabled button in nthe menu's click event when i want to enable the screensaver and i placed the code behind the disable button on the menu when it should disable the screensaver. unfortunately, both wehn the menu should enable and disable the screensaver the screensaver was displayed anyway.

any ideas?

RileyM
[Image: salem874.smart.jpg][Image: card.png]
Was i Helpful?[/url]
12-31-2004 10:16 AM
Profile PM Find Quote Report
Pages: (2): « First [ 1 ] 2 » Last »
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On