Results 1 to 13 of 13

Thread: preview on the Screensaver won't act right

  1. #1

    Thread Starter
    Frenzied Member wengang's Avatar
    Join Date
    Mar 2000
    Location
    Beijing, China
    Posts
    1,604
    Hey guys.
    this is kind of a repost of an earlier question.
    (Thanks Sam)
    I am wondering why when I put my screensaver form in the preview window where the Screen saver is selected, i get these problems:
    1. Both the Settings... button and the Preview button have to be clicked several times before I can get them to run.
    2. The preview screen doesn't behave like the form does when the actual screen saver runs.

    On this second problem, what i mean is, if I point the preview to a third form with just an image, then it does fine. but when i point it to the original SS form, which is a slideshow of images, i dont get the same thing in the preview window, but just the form background without the images.


    Anybody know why on either of these?

    Thanks

  2. #2
    Hyperactive Member
    Join Date
    Mar 2000
    Location
    India
    Posts
    298
    Hi wengang,

    Im trying to create my own screensaver, but am stuck when it comes to previewing it. Could u help me out, maybe (if it isn't a problem) post ur code so that I can have a look?

    Thanx.

  3. #3
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    If you move/click mouse or keyboard then your app will close right? What's happening is that your app fires these events because you moved the mouse or something. To avoid it to close immediately you just make a timer:

    Code:
    Private StartupTimer as Long
    
    Sub Form_Load
       StartupTimer=Timer
    End sub
    
    Sub Form_Mousemove(...
       If Timer-StartupTimer>0.5 then unload me
    end sub
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  4. #4

    Thread Starter
    Frenzied Member wengang's Avatar
    Join Date
    Mar 2000
    Location
    Beijing, China
    Posts
    1,604
    Rammy, it's really not hard at all. I forgot the thread number but i just asked a couple of days ago. Do a search of this forum with the following words:

    picture preview screensaver

    The thread that was started by me has the entire code for creating the screensaver.

    Kedaman, thanks for the help on that. I think that is exactly what i needed.



  5. #5

    Thread Starter
    Frenzied Member wengang's Avatar
    Join Date
    Mar 2000
    Location
    Beijing, China
    Posts
    1,604
    Kedaman, having said that, i do have a few questions, if you have a minute.

    My screensaver only unloads with a mouse click on the form, nothing else.
    I think maybe this timer wouldnt apply?
    Also, what goes in the (...
    index?

    Also, i added in these pieces of code in the appropriate places, (adding the mousemove sub contents to my form_click sub instead) and it has no effect on the problem.

    Clicking the buttons on the control panel's settings and preview options for screensaver, it feels like a race with the ss form to get a response. Several constant clicks and i can get it.

    any thoughts?

  6. #6
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Sorry i don't have my VB on this computer so i just put those (...) there. no index needed, just the event arguments.

    Put your the line for the ontimerunload thing in your mousedown event instead, but i'm not sure what problem you had.

    what you could do is let the app write down a log of what parameters is pased to it, command function you know, open a file with append and print them there. And also the mousedown events.
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  7. #7

    Thread Starter
    Frenzied Member wengang's Avatar
    Join Date
    Mar 2000
    Location
    Beijing, China
    Posts
    1,604
    yes. what i have is pretty basic. a settings page that lets users choose directories, background color, timing, etc.

    All is written to a file.
    then the screen saver form opens the file, reads the directories, gets the jpgs out of all of them and randomly displays them in a slideshow.

    The problem is still here and very basic.
    I want to put an image in the little preview window, but every time i put something there, the settings and preview buttons stop responding unless i click them over and over.

    Second problem is that the screen saver itself runs with no problem at all , but when i make it a daughter to the little preview window, it only shows the form and background color, but no images flashing.

    I still haven't got this....


    so, what do you think?

  8. #8
    Frenzied Member
    Join Date
    Mar 2000
    Posts
    1,089
    It could be a problem with the resizing of the form when you put it in the preview window, I've forgotten exactly what code I gave you, try using this to show the form(in preview mode)
    Code:
    Form1.Show
    SetParent Form1.hWnd, hWndPreview
    Form1.WindowState = vbMaximized
    that will maximise the form again in the smaller window, I'm now sure if this was the code I gave you or not, If it was, or it still doesn't work then try changing the size of the form and running the screensaver normally (so instead of it running maximized over the whole screen make it run in a small window and see what it does, then change the code for the screen saver so that it will run normally in a little window and set it back to running normally in fullscreen mode, then it should work properly in preview mode.

  9. #9

    Thread Starter
    Frenzied Member wengang's Avatar
    Join Date
    Mar 2000
    Location
    Beijing, China
    Posts
    1,604
    Hey Sam

    Thanks again.

    still, the problem is the same as mentioned just above.

    as for the last part, i can't quite follow what you mean.

    i tried just something simple, i created a third form called frmPreview, on which i just wrote the name of the screensaver on a label and then placed this in the /p code.
    Of course, it shows up in the preview window, but causes the same problem (about the buttons).

    So, what's next?

  10. #10

    Thread Starter
    Frenzied Member wengang's Avatar
    Join Date
    Mar 2000
    Location
    Beijing, China
    Posts
    1,604
    okay guys.
    I've written the simplest screensaver possible in order to test this problem. And, i still get the problem with the buttons. So, if anybody is willing, please copy this code and run it yourself to see if you get the same results (i've run this on 2 machines already). Thanks.

    This only has one form (frmMain.frm) and one Module(Module1.bas) , and of course one picture in the app.path.(eol.jpg)

    CODE FOR THE SCREENSAVER FORM:
    (one imagebox (image1 set stretch to true))
    Private Sub Form_Load()
    frmMain.Width = Screen.Width
    frmMain.Height = Screen.Height
    Image1.Left = 0
    Image1.Top = 0
    Image1.Width = Screen.Width
    Image1.Height = Screen.Height
    strFilename = App.Path & "\eol.jpg"
    Image1.Picture = LoadPicture(strFilename)
    End Sub
    Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
    Select Case KeyCode
    Case vbKeySpace: StopSS
    End Select
    End Sub
    Private Sub StopSS()
    Unload Me
    End
    End Sub


    AND the code for the Module:

    Private Declare Function SetParent Lib "user32" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long
    Sub Main()
    Dim strCmdLine As String
    Dim strArguments As String
    Dim hWndPreview As Long
    strArguments = Trim(Command$)
    If App.PrevInstance = True Then End
    strCmdLine = Left(Command, 2)
    If strCmdLine = "/p" Then
    hWndPreview = Trim(Right(strArguments, Len(strArguments) - 2))
    Call SetParent(frmMain.hWnd, hWndPreview)
    frmMain.Show
    ElseIf strCmdLine = "/c" Then
    MsgBox ("There are no configuration settings for this screensaver.")
    Else
    Call Load(frmMain)
    frmMain.Show
    End If
    End Sub


    So if anybody has a little free time on your hands, could you please run this and let me know if you get the problem?

    Thanks so much.



  11. #11
    Hyperactive Member
    Join Date
    Mar 2000
    Location
    India
    Posts
    298
    Hi,

    while on the subject of screensavers.....Im trying to create my own, (as I've mentioned before).....have started with a real simple one...I'm just displaying a couple of bitmaps repeatedly using a timer. I have an Image control on my form....and I'm changing the picture property of the image control in the timer's Timer event.

    The problem I'm facing is that when I try to end my application using the form's mousemove event, it works only if I move my mouse over the form and not the image control. Is there a way aroung this??? an API or anything????

    Thanx in advance.

  12. #12
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Rammy, you should call the forms mousemove event from the image mousemove event, and the same thing with mousedown and keydown events if you want it to unload att clicking or pressing keys.

    wengang, too bad i don't have more than vb3 on this comp, but i'll try
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  13. #13
    Hyperactive Member
    Join Date
    Mar 2000
    Location
    India
    Posts
    298
    thanx kedaman,
    think my brain's stopped of late.....forgot that the image has a mousemove event as well!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width