Results 1 to 16 of 16

Thread: screen saver

  1. #1

    Thread Starter
    Fanatic Member zmerlinz's Avatar
    Join Date
    May 2000
    Location
    in a world where the sun always shines on the bloody tv!!
    Posts
    604

    Unhappy

    hi,
    how do i make my project into a screen saver file so that windows wil recognise it and me able to run as a screen saver

    examples would be useful

    Cheers

    Merlin ?

    Some people have told me they don't think a fat penguin really embodies the grace of Linux, which just tells me they have never seen a angry penguin charging at them in excess of 100mph. They'd be a lot more careful about what they say if they had.
    -- Linus Torvalds

    [Galahtech.com] | [My Site] | [Fishsponge] | [UnixForum.co.uk]

  2. #2
    PowerPoster Fox's Avatar
    Join Date
    Jan 2000
    Location
    *afk*
    Posts
    2,088
    Rename the exe to scr

  3. #3

    Thread Starter
    Fanatic Member zmerlinz's Avatar
    Join Date
    May 2000
    Location
    in a world where the sun always shines on the bloody tv!!
    Posts
    604
    hi,

    i didn't think that it would work, ok so it does, but how do i get the setings button to do something and when i press preview it runs twice, i ideally would like it to run in that little windows.

    Any ideas


    Cheers

    Merlin ?

    Some people have told me they don't think a fat penguin really embodies the grace of Linux, which just tells me they have never seen a angry penguin charging at them in excess of 100mph. They'd be a lot more careful about what they say if they had.
    -- Linus Torvalds

    [Galahtech.com] | [My Site] | [Fishsponge] | [UnixForum.co.uk]

  4. #4
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Well do not know how you put it in that window (maybe setparent i'll chech out that later)

    but

    Screen Savers should always start in Sub Main like this:
    Code:
    Sub Main()
        Select Case Left(Command, 2)
            Case "/c"
                Form2.Show
            Case "/s", "/S", ""
                Load Form1
                'Do you SS startup things
                Do
                    'Do you SS loop things
                    DoEvents
                Loop While Forms.Count
            Case "/p"
                End
            Case Else
            If Len(Command) Then MsgBox Command: End
        End Select
        
    End Sub
    Where Form2 is your settings window, Form1 is your screensaver (or you can replace it with a formless screensaver)

    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.

  5. #5
    Guest
    Download screen saver source codes off of http://www.planet-source-code.com, I'm sure you'll find something useful there.

  6. #6
    Lively Member
    Join Date
    Jul 2000
    Posts
    72
    I have been working on my own Screen saver, but to know success, would Appreaciate a look at you code Merlin
    VB 6 Professional Edition

  7. #7
    Guest
    A useful lil thing I find for workin out screen saver stuff:

    Make a program with no form, but one module...the code:
    Code:
    Option Explicit
    
    Private Sub Main()
      MsgBox Command
    End Sub
    Compile it in your Windows directory giving it a ".scr" extension

    Now try running, configuring (etc) it with the Display Properties Control Panel...

    Everytime windows invokes the program it'll tell you what commands windows passed to it.

    You then have to make your screen saver parse these commands at startup to decide what it should do

  8. #8
    Frenzied Member wengang's Avatar
    Join Date
    Mar 2000
    Location
    Beijing, China
    Posts
    1,604
    Hey Matthew.

    It sounds like you've done a few screensavers.

    I am wondering, everytime I put events (show the form) in the /p case of the Commandline, the result is that i have to hit the settings or preview button several times before it will respond.

    I've even put a blank form with no code as the preview form in place of the screensaver, and get the same result.

    Any ideas?
    Wen Gang, Programmer
    VB6, QB, HTML, ASP, VBScript, Visual C++, Java

  9. #9
    Guest
    Erm...off the top of my head I don't know what would cause this. Post the relavent bits of code and I'll have a look.

  10. #10
    Guest
    I don't know if it makes any difference wengang, but Microsofts examples say to put the prefix SCRNSAVE: in front of the application title in the project properties window. Maybe it's just by convention or maybe it does something?

    Anyway, How do you get the preview to show in the litle monitor on the screensaver window? I know you have to respond to the /P switch, but what do you do with it?

  11. #11
    Junior Member
    Join Date
    Mar 1999
    Posts
    27

    Well...

    ...if I remember what I did... you need to get the hDC of the window (the one with the computer) - If you check out Spy++ or somethin' of the such, you need to get Display Properties | Screen Saver | "" (Static) - you need that static item's hDC - (which you can get with the GetDC API). All you need is the handle. Then all you have to do is BitBlt your screensaver (from a picture box, for example, to the screen). If you need some sample code, I can try to write some up for you... I hope I'm right, I'm not positive though - but it seems to work

    Good Luck!

  12. #12
    Guest
    I was afraid I might have to do it that way. But then, that's why I haven't implemented the "Preview" feature yet...

  13. #13
    Frenzied Member wengang's Avatar
    Join Date
    Mar 2000
    Location
    Beijing, China
    Posts
    1,604
    Matthew.
    Thanks. it's a generous offer. I had posted this code before but just couldn't get the preview window working. If you have time, please try this code yourself and see if you get the same results.

    It just needs one form frmMain and one Module with Sub Main

    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" 'or any jpg,gif,bmp
    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


    CODE FOR THE MODULE:

    Public Sub Main()
    If App.PrevInstance = True Then End
    Dim strArguments As String
    Dim hWndPreview As Long
    strArguments = Trim(Command$)
    Select Case Left(strArguments, 2)
    Case "/s"
    frmMain.Show
    Case "/p"
    hWndPreview = CLng(Trim(Right$(strArguments, Len(strArguments) - 2)))
    Call SetParent(frmMain.hWnd, hWndPreview)
    frmMain.Show
    Case "/c"
    frmDirectory.Show ' this I replaced w/ a MsgBox("NO CONFIG")
    End Select
    End Sub


    Well that's the whole thing. and of course it doesn't work. Without the /p events it's okay. With them, the buttons on control panel for screen saver, PREVIEW and SETTINGS, stop responding


    Really, thanks for taking a look at this. I really have pretty much given up solving it


    Wengang
    Wen Gang, Programmer
    VB6, QB, HTML, ASP, VBScript, Visual C++, Java

  14. #14
    Guest
    The code you've provided works fine for me, and your form appears in the preview window of the display properties.

    So i don't think it's a problem with your code.

    Does this happpen with any other screen savers?

  15. #15
    Frenzied Member wengang's Avatar
    Join Date
    Mar 2000
    Location
    Beijing, China
    Posts
    1,604
    Yes, this happens with every ss so far. Oh, the code above is missing the first line in the module:

    Declare Function SetParent Lib "user32" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long

    I re pasted this code to a new form and module and got the same thing. the form appears in the lower right corner of the preview window. But when I press the settings button, that screen clears and the image comes back up further down in the lower right corner. another time or two and it's gone. WHEN i changed the forms color to green, it showed up on the preview window as black. Also, pressing the settings button took about 5 times before the config message box came up. same results with preview screen. Have you tried that?

    Thanks again.
    Wen Gang, Programmer
    VB6, QB, HTML, ASP, VBScript, Visual C++, Java

  16. #16
    Frenzied Member wengang's Avatar
    Join Date
    Mar 2000
    Location
    Beijing, China
    Posts
    1,604
    okay, to update,
    nevermind about the green and black. I forgot that the picture itself is black. Then I set form top and left to 0 and that puts it starting in the right place, but I cant get it to size properly for that little window.

    also, settings and preview button problem still persists, so i did what you mentioned and added a Command$ message box. Well, when you click on settings or preview, the ss form loads again and always the first two characters of the Command$ are /p !!

    So, it seems that everything makes the preview form load and its constant loading is what interferes with the buttons?!

    Ideas?
    Wen Gang, Programmer
    VB6, QB, HTML, ASP, VBScript, Visual C++, Java

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