Jump to content
Sign in to follow this  

Screen Save Program

Recommended Posts


I have been trying to make a screen save that moves an image around the screen.

I got a basic one from code that has been posted on the forums and come up with 2 problems/questions.

#1 how can I get the GUIGetMsg() to read all inputs as this on;y works with the mouse move and the <Esc> key right now.

#2 Is there any way to get this program to work on multi monitors as it only works on the primary display right now.

#include <guiconstants.au3>

Global $IMAGE_HSPEED = 1
Global $IMAGE_VSPEED = 1
Global $IMAGE_X     = 25
Global $IMAGE_Y     = 25
Global Const $IMAGE_WIDTH = 200
Global Const $IMAGE_HEIGHT = 100
Global Const $MAX_X       = @DesktopWidth
Global Const $MAX_Y       = @DesktopHeight
GLobal Const $MIN_X       = 0
Global Const $MIN_Y       = 0
GUICreate("", @DesktopWidth, @DesktopHeight, 0, 0, $WS_POPUP)
Global $IMAGE = GUICtrlCreatePic("logo.jpg", $IMAGE_X, $IMAGE_Y, $IMAGE_WIDTH, $IMAGE_HEIGHT)
while (GUIGetMsg() = 0)
    ControlMove("", "", $IMAGE, $IMAGE_X, $IMAGE_Y)

Func UpdateSprites()
    if ($IMAGE_X >= ($MAX_X-$IMAGE_WIDTH)) Then $IMAGE_HSPEED *= -1
    if ($IMAGE_X <= ($MIN_X)) Then $IMAGE_HSPEED *= -1
    if ($IMAGE_Y >= ($MAX_Y-$IMAGE_HEIGHT)) Then $IMAGE_VSPEED *= -1
    if ($IMAGE_Y <= ($MIN_Y)) Then $IMAGE_VSPEED *= -1


Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.