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 


VDS Screensaver (displays BMP pics)...

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Visual DialogScript 3 Source Code
View previous topic :: View next topic  
Author Message
Mac
Professional Member
Professional Member


Joined: 08 Jul 2000
Posts: 1585
Location: Oklahoma USA

PostPosted: Tue Jul 30, 2002 5:52 pm    Post subject: VDS Screensaver (displays BMP pics)... Reply with quote

Thought I'd post this in case someone finds it useful.
It's a VDS screensaver that does NOT need external
DLLs.

Name the file "Picsaver.dsc". Compile it and change
the exe name to "Picsaver.scr", then copy it to the
Windows folder. You can preview it, and it has it's
own "settings" window.

NOTE: To stop it you must move the mouse. Keyboard
presses have no effect.
Code:

rem -- A screensaver that changes bmp pics --

rem -- Windows sends these parameters to the screensaver:
rem -- If the display properties window is open, Windows
rem -- constantly calls the screensaver with "/p 2212"
rem -- Preview button= "/p"
rem -- Settings button= "/c"
rem -- Normally sends "/s" when starting the screensaver.

rem -- Kill the "/p 2212" parameter.
if @equal(%1, "/p")
   if %2
      EXIT
   end
end

rem -- Allow only 1 instance of program --
if @winexists("Mac's Picture Screensaver")@winexists("Mac's Picture Screensaver Setup")
   EXIT
end

OPTION SCALE, 96
OPTION PRIORITY, IDLE
%%Ini_File = @windir()\PicSaver.ini

rem -- Setup for screensaver --
if @equal(%1, "/c")
   INIFILE OPEN, %%Ini_File
     %d = @iniread(OPTIONS,dir)
     %t = @iniread(OPTIONS,delay)
   DIALOG CREATE, "Mac's Picture Screensaver Setup",-1,0,300,90,NOSYS,ONTOP
     DIALOG ADD,BUTTON,Dir,1,5,150,22,"Choose Image Directory"
     DIALOG ADD,BITBTN,Exit,1,156,139,22,,"Exit Setup"," Exit "
     DIALOG ADD,TEXT,Status1,28,5,,,%d
     DIALOG ADD,BUTTON,Delay,45,5,150,22,"Set Image Display Time"
     DIALOG ADD,TEXT,Status2,72,5,,,"Images display for "%t" seconds"
   DIALOG SHOW
   :EVLOOP
     WAIT EVENT
     goto @event()
   :DirBUTTON
     %d = @dirdlg(Choose directory where BMP images are located...)
     if %d
        INIFILE WRITE, OPTIONS, dir, %d
        DIALOG SET, Status1, Please wait...
        WAIT 2
        DIALOG SET, Status1, %d
     end
     goto EVLOOP
   :DelayBUTTON
     %t = @input("Enter seconds to display images (120 max)")
     if @not(@numeric(%t))@greater(%t, 120)
        rem -- do nothing --
     else
        INIFILE WRITE, OPTIONS, delay, %t
        DIALOG SET, Status2, Please wait...
        WAIT 2
        DIALOG SET, Status2, Images display for %t seconds
     end
     goto EVLOOP
   :ExitBUTTON
   :CLOSE
     EXIT
     STOP
end

rem -- Open or Create default ini file --
LIST CREATE, 1
if @file(%%Ini_File)
   INIFILE OPEN, %%Ini_File
   LIST  FILELIST, 1, @iniread(OPTIONS,dir)\*.bmp
   %d = @iniread(OPTIONS,delay)
else
   LIST ADD, 1, "[NOTES]"
   LIST ADD, 1, "  You may add as many bmp pictures as you like, just"
   LIST ADD, 1, "  put them all in the same directory, and write the"
   LIST ADD, 1, "  full path to the directory after OPTIONS 'dir='"
   LIST ADD, 1, "  Example:  dir=c:\mydir
   LIST ADD, 1, "  The 'delay=number' is seconds that pic is displayed."
   LIST ADD, 1, ""
   LIST ADD, 1, "[OPTIONS]"
   LIST ADD, 1, "  dir="
   LIST ADD, 1, "  delay=10"
   LIST SAVEFILE, 1, %%Ini_File
   LIST CLEAR, 1
   %d = 10
end

%w = @sysinfo(SCREENWIDTH)
%h = @sysinfo(SCREENHEIGHT)

DIALOG CREATE, "Mac's Picture Screensaver",0,0,%w,%h,NOTITLE,ONTOP
  rem -- Load pics --
  %%numpics = 0
  if @greater(@count(1), 0)
     %%numpics = @diff(@count(1), 1)
     %x = 0
     REPEAT
       if @item(1, %x)
          DIALOG ADD,BITMAP,pic%x,0,0,%w,%h,@item(1, %x),STRETCH
          DIALOG HIDE, pic%x
       end
       %x = @succ(%x)
     UNTIL @not(@item(1, %x))
     DIALOG SHOW, pic1
  else
     DIALOG ADD,STYLE,Style1,,,,BLACK
     DIALOG ADD,TEXT,Background,0,0,%w,%h,"",Style1
  end
DIALOG SHOW
LIST CLOSE, 1

%%lastpic = 0
%%oldpos = @mousepos()
%d = @prod(%d, 10)
%p = 0
%x = 0

REPEAT
  %x = @succ(%x)
  WAIT .1
  %%newpos = @mousepos()
  if @greater(%x, %d)
     %x = 0
     GOSUB Get_Pic
  end
UNTIL @not(@equal(%%oldpos, %%newpos))
EXIT

:Get_Pic
  if @greater(%%numpics, 0)
     if @greater(%%numpics, %p)
        %p = @succ(%p)
     else
        %p = 0
     end
     DIALOG HIDE, pic%%lastpic
     DIALOG SHOW, pic%p
     %%lastpic = %p
  end
  exit

Cheers, Mac

_________________
VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Visual DialogScript 3 Source Code All times are GMT
Page 1 of 1

 
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