forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Temporarily disable Screen saver
Goto page 1, 2  Next
 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Advanced VDS 5 Source Code
View previous topic :: View next topic  
Author Message
CodeScript
Moderator Team


Joined: 08 Jun 2003
Posts: 1054
Location: India

PostPosted: Mon Aug 04, 2003 7:00 pm    Post subject: Temporarily disable Screen saver Reply with quote

dsscrnsv.dll VDS 5.x interface by Codescript

http://codescript.vdsworld.com/VDS5src/Noscreensaver.zip

A simple example to use a freeware non VDS DLL to Disable Screen saver when your app is running and auto re-enable when your app closes.
You can also disable screen saver in general.
Why this dll and not plain API ?
Because then if your app crashes then screen saver continues to remain disabled.
See the attached .dsc file for more details.
You should place the dsscrnsv.dll and Noscreensaver.fil in the
same directory as your .dsc file and a line "#include Noscreensaver.fil"
at the top of your .dsc file.

To test it you may reduce the Screensver wait time to 1 minute and see
what happens

Codescript

_________________
Regards
- CodeScript
Arrow Give your application a professional look with the VDSGUI Extension
Back to top
View user's profile Send private message Visit poster's website
FreezingFire
Admin Team


Joined: 23 Jun 2002
Posts: 3508

PostPosted: Mon Aug 04, 2003 7:19 pm    Post subject: Re: Temporarily disable Screen saver Reply with quote

CodeScript wrote:

Why this dll and not plain API ?
Because then if your app crashes then screen saver continues to remain disabled.


This DLL wouldn't really be necessary since if your application crashes
you can use:

OPTION ERRORTRAP

Also could you post plain API if it wouldn't be too much trouble? Smile

_________________
FreezingFire
VDSWORLD.com
Site Admin Team
Back to top
View user's profile Send private message Visit poster's website
Garrett
Moderator Team


Joined: 04 Oct 2001
Posts: 2144
Location: A House

PostPosted: Mon Aug 04, 2003 10:18 pm    Post subject: Reply with quote

I'd rather use the api directly myself also. If you're willing to share that,
I'd be greatful Smile

-Garrett

_________________
'What you do not want done to yourself, do not do to others.' - Confucius (550 b.c. to 479 b.c.)
Necroprogramming FTW! - "Wait.. Is necroprogramming legal?"
http://www.freewarehome.com <-- Freeware listings since 1996
Back to top
View user's profile Send private message
Tommy
Admin Team


Joined: 16 Nov 2002
Posts: 737
Location: The Netherlands

PostPosted: Tue Aug 05, 2003 7:43 am    Post subject: Reply with quote

Also, of course, this DLL does exactly this too:

http://www.vdsworld.com/index.php?page=download&file=vdsxssd.dll
Back to top
View user's profile Send private message Send e-mail Visit poster's website
CodeScript
Moderator Team


Joined: 08 Jun 2003
Posts: 1054
Location: India

PostPosted: Tue Aug 05, 2003 9:05 am    Post subject: Re: Temporarily disable Screen saver Reply with quote

FreezingFire wrote:

This DLL wouldn't really be necessary since if your application crashes
you can use:
OPTION ERRORTRAP

Option error trap works with native VDS commands and if one doesn't get caught in an infinite loop. Furthermore while using API this is of no help i think as app crashes without warning !.
I don't think there is need for API code now that we have a nice dll.Tommy I am just wondering if your dll autoreenables screen saver in case of an app crash ?

_________________
Regards
- CodeScript
Arrow Give your application a professional look with the VDSGUI Extension


Last edited by CodeScript on Tue Aug 05, 2003 3:19 pm; edited 2 times in total
Back to top
View user's profile Send private message Visit poster's website
Tommy
Admin Team


Joined: 16 Nov 2002
Posts: 737
Location: The Netherlands

PostPosted: Tue Aug 05, 2003 10:45 am    Post subject: Reply with quote

Please realize that I'm not the author of this DLL, the author is Commercial Research
Ltd:

http://www.vdsworld.com/index.php?page=search&keywords=vdsxssd.dll
Back to top
View user's profile Send private message Send e-mail Visit poster's website
CodeScript
Moderator Team


Joined: 08 Jun 2003
Posts: 1054
Location: India

PostPosted: Tue Aug 05, 2003 3:16 pm    Post subject: Reply with quote

Embarassed Oh I didnt know that. sorry.
_________________
Regards
- CodeScript
Arrow Give your application a professional look with the VDSGUI Extension
Back to top
View user's profile Send private message Visit poster's website
FreezingFire
Admin Team


Joined: 23 Jun 2002
Posts: 3508

PostPosted: Tue Aug 05, 2003 4:02 pm    Post subject: Re: Temporarily disable Screen saver Reply with quote

CodeScript wrote:
I don't think there is need for API code now that we have a nice dll.


I don't want to drag around unnecessary DLLs for my scripts. If you don't
want to share the API code then I will write it myself.

Please don't take offence to this post but it's my opinion. What can be
done with VDS should be done with VDS.

_________________
FreezingFire
VDSWORLD.com
Site Admin Team
Back to top
View user's profile Send private message Visit poster's website
CodeScript
Moderator Team


Joined: 08 Jun 2003
Posts: 1054
Location: India

PostPosted: Tue Aug 05, 2003 5:08 pm    Post subject: Reply with quote

Sorry FF Embarassed you mistaken there I am yet to write a Script for that. I always like to share code - nothing secret about it .Very Happy After all i am not a sharware author (even not a software author in that sense - see my profile) There is not even a single question i asked for my personal benefit. Just to try help others a lttle if i can in the little freetime i have.
Don't take it in wrong way just my opinion.

_________________
Regards
- CodeScript
Arrow Give your application a professional look with the VDSGUI Extension


Last edited by CodeScript on Tue Aug 05, 2003 5:18 pm; edited 2 times in total
Back to top
View user's profile Send private message Visit poster's website
FreezingFire
Admin Team


Joined: 23 Jun 2002
Posts: 3508

PostPosted: Tue Aug 05, 2003 5:10 pm    Post subject: Reply with quote

OK, well your statement about how there was no need for an API anymore
because we have a "nice dll" kind of implied that you were not going to
post any code.

(edit: the reason for this tone I was taking was because I suspected the
DLL could be mailicious, but it is not malicious.)

_________________
FreezingFire
VDSWORLD.com
Site Admin Team


Last edited by FreezingFire on Sat Jul 03, 2004 7:02 pm; edited 1 time in total
Back to top
View user's profile Send private message Visit poster's website
CodeScript
Moderator Team


Joined: 08 Jun 2003
Posts: 1054
Location: India

PostPosted: Wed Aug 13, 2003 4:22 pm    Post subject: Reply with quote

Here is a script for Disabling/Enabling/getting_info_about Screensaver for VDS 5.
Written with text editor and untested.
Letme know if it works.
To prevent screen saver staying disabled if app crashes one can do this:

Write the Screen saver disable routine into a seperate exe.
Your main app runs this screen saver control App at it's startup.

In the screen saver control app :
Use a variable to store the initial state of Screen saver.
Disable screen saver.
Under a timer loop of say 1 sec check if the main app is still running(many ways to do that)
If the main app is no more running - either closed or crashed Wink restore the screensaver
to its original state and exit this secondary app.
Hope this avert the app crash problem.

You can split the code as an include file for easy use.
Code:

  DIALOG CREATE,ScreenSaverAPI Control By Codescript,-1,0,390,160
  DIALOG ADD,BUTTON,BUTTON1,45,77,81,35,Scr_Sav_Info
  DIALOG ADD,BUTTON,BUTTON2,74,77,81,35,Scr_Sav_Disable
  DIALOG ADD,BUTTON,BUTTON3,104,77,81,35,Scr_Sav_Enable
  DIALOG SHOW
 
 
:EVLOOP
WAIT EVENT
GOTO @EVENT()

:BUTTON1BUTTON
LOADLIB USER32
%I = @BINARY(DWORD,0)
%U = @LIB(USER32, SystemParametersInfoA,INT:,16,0,@ADDR("%I"),0)
%I = @VAL(%I)
IF @ZERO(%I)
 INFO ScreenSaver is Disabled
 ELSE
 INFO ScreenSaver is Enabled
 END
FREELIB USER32
GOTO EVLOOP

:BUTTON2BUTTON
LOADLIB USER32
%U = @LIB(USER32, SystemParametersInfoA,INT:,17,0,0,0)
FREELIB USER32
GOTO EVLOOP

:BUTTON3BUTTON
LOADLIB USER32
%U = @LIB(USER32, SystemParametersInfoA,INT:,17,1,0,0)
FREELIB USER32
GOTO EVLOOP

:CLOSE
EXIT


EDIT : Some typo and errors fixed
_________________________________________________________________________________

_________________
Regards
- CodeScript
Arrow Give your application a professional look with the VDSGUI Extension


Last edited by CodeScript on Thu Aug 14, 2003 3:34 am; edited 1 time in total
Back to top
View user's profile Send private message Visit poster's website
Dr. Dread
Professional Member
Professional Member


Joined: 03 Aug 2001
Posts: 1065
Location: Copenhagen, Denmark

PostPosted: Wed Aug 13, 2003 6:53 pm    Post subject: Reply with quote

Seems to work just fine Razz

Two small things though:

In the :BUTTON3BUTTON section there's a typo, LOSDLIB instead of LOADLIB.

And there's a missing END for the "IF @ZERO(%I)" statement.

Greetz
Dread

_________________
~~ Alcohol and calculus don't mix... Don't drink and derive! ~~

String.DLL * advanced string processing
Back to top
View user's profile Send private message
Dr. Dread
Professional Member
Professional Member


Joined: 03 Aug 2001
Posts: 1065
Location: Copenhagen, Denmark

PostPosted: Wed Aug 13, 2003 7:01 pm    Post subject: Reply with quote

BTW, while you were doing this, did you come across another API function that could turn off
screen power? Slam Idea

Or how about a blackout, i.e. a blank screen with no ssaver?

Greetz
Dread

_________________
~~ Alcohol and calculus don't mix... Don't drink and derive! ~~

String.DLL * advanced string processing
Back to top
View user's profile Send private message
Dr. Dread
Professional Member
Professional Member


Joined: 03 Aug 2001
Posts: 1065
Location: Copenhagen, Denmark

PostPosted: Wed Aug 13, 2003 7:02 pm    Post subject: Reply with quote

Hey thought about another one also: what about one that would activate the screen saver right away?

Cool
Dread

_________________
~~ Alcohol and calculus don't mix... Don't drink and derive! ~~

String.DLL * advanced string processing
Back to top
View user's profile Send private message
Tommy
Admin Team


Joined: 16 Nov 2002
Posts: 737
Location: The Netherlands

PostPosted: Wed Aug 13, 2003 10:17 pm    Post subject: Reply with quote

Dr. Dread wrote:
BTW, while you were doing this, did you come across another API function that could turn off
screen power? Slam Idea

Or how about a blackout, i.e. a blank screen with no ssaver?

Greetz
Dread


This vds-l topic is about turning off screen power:

http://vds-l.vdsworld.com/index.php?page=subject&subject=[code:1:73422530f3]%20Turning%20off%20laptop%20screens
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Advanced VDS 5 Source Code All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum




Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group