View previous topic :: View next topic |
Author |
Message |
CodeScript Moderator Team
Joined: 08 Jun 2003 Posts: 1060 Location: India
|
Posted: Mon Aug 04, 2003 7:00 pm Post subject: Temporarily disable Screen saver |
|
|
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
Give your application a professional look with the VDSGUI Extension |
|
Back to top |
|
|
FreezingFire Admin Team
Joined: 23 Jun 2002 Posts: 3508
|
Posted: Mon Aug 04, 2003 7:19 pm Post subject: Re: Temporarily disable Screen saver |
|
|
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? _________________ FreezingFire
VDSWORLD.com
Site Admin Team |
|
Back to top |
|
|
Garrett Moderator Team
Joined: 04 Oct 2001 Posts: 2149 Location: A House
|
Posted: Mon Aug 04, 2003 10:18 pm Post subject: |
|
|
I'd rather use the api directly myself also. If you're willing to share that,
I'd be greatful
-Garrett _________________ 'What you do not want done to yourself, do not do to others.' - Confucius (550 b.c. to 479 b.c.) |
|
Back to top |
|
|
Tommy Admin Team
Joined: 16 Nov 2002 Posts: 746 Location: The Netherlands
|
|
Back to top |
|
|
CodeScript Moderator Team
Joined: 08 Jun 2003 Posts: 1060 Location: India
|
Posted: Tue Aug 05, 2003 9:05 am Post subject: Re: Temporarily disable Screen saver |
|
|
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
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 |
|
|
Tommy Admin Team
Joined: 16 Nov 2002 Posts: 746 Location: The Netherlands
|
|
Back to top |
|
|
CodeScript Moderator Team
Joined: 08 Jun 2003 Posts: 1060 Location: India
|
Posted: Tue Aug 05, 2003 3:16 pm Post subject: |
|
|
Oh I didnt know that. sorry. _________________ Regards
- CodeScript
Give your application a professional look with the VDSGUI Extension |
|
Back to top |
|
|
FreezingFire Admin Team
Joined: 23 Jun 2002 Posts: 3508
|
Posted: Tue Aug 05, 2003 4:02 pm Post subject: Re: Temporarily disable Screen saver |
|
|
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 |
|
|
CodeScript Moderator Team
Joined: 08 Jun 2003 Posts: 1060 Location: India
|
Posted: Tue Aug 05, 2003 5:08 pm Post subject: |
|
|
Sorry FF you mistaken there I am yet to write a Script for that. I always like to share code - nothing secret about it . 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
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 |
|
|
FreezingFire Admin Team
Joined: 23 Jun 2002 Posts: 3508
|
Posted: Tue Aug 05, 2003 5:10 pm Post subject: |
|
|
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 |
|
|
CodeScript Moderator Team
Joined: 08 Jun 2003 Posts: 1060 Location: India
|
Posted: Wed Aug 13, 2003 4:22 pm Post subject: |
|
|
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 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
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 |
|
|
Dr. Dread Professional Member
Joined: 03 Aug 2001 Posts: 1065 Location: Copenhagen, Denmark
|
Posted: Wed Aug 13, 2003 6:53 pm Post subject: |
|
|
Seems to work just fine
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 |
|
|
Dr. Dread Professional Member
Joined: 03 Aug 2001 Posts: 1065 Location: Copenhagen, Denmark
|
Posted: Wed Aug 13, 2003 7:01 pm Post subject: |
|
|
BTW, while you were doing this, did you come across another API function that could turn off
screen power? Slam
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 |
|
|
Dr. Dread Professional Member
Joined: 03 Aug 2001 Posts: 1065 Location: Copenhagen, Denmark
|
Posted: Wed Aug 13, 2003 7:02 pm Post subject: |
|
|
Hey thought about another one also: what about one that would activate the screen saver right away?
Dread _________________ ~~ Alcohol and calculus don't mix... Don't drink and derive! ~~
String.DLL * advanced string processing |
|
Back to top |
|
|
Tommy Admin Team
Joined: 16 Nov 2002 Posts: 746 Location: The Netherlands
|
|
Back to top |
|
|
|