CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 8 of 8
  1. #1
    Join Date
    May 2001
    Posts
    155

    Screen Saver??????????

    How do i change an exe to a scr file without damaging it? I'm trying to create a screen saver, but i dont know how to change the extension, do i just change the extension when i compile it?? Help!


  2. #2
    Join Date
    Feb 2001
    Location
    Stamford CT USA
    Posts
    2,167

    Re: Screen Saver??????????

    Just rename it.

    -Cool Bizs

    Good Luck,
    -Cool Bizs

  3. #3
    Join Date
    May 2001
    Posts
    155

    Re: Screen Saver??????????

    Ok, i got that far, but when i put it in the system folder and then try to use it and preview it
    i don't get anything, nothing even loads!


    --Ant

  4. #4
    Join Date
    Feb 2001
    Location
    Stamford CT USA
    Posts
    2,167

    Re: Screen Saver??????????

    Just wondering, what happen when you doubleclick on your program (while the extension is still EXE)? Does it do what it supposed to do (not saying that you don't know what you're doing)? Screensaver application has to handle few instruction from the OS.

    <snipet from MSDN>
    Windows communicates with Screen Savers through command line arguments. The ScrnSave.lib library handles this for Screen Savers that are written to use it, but other Win32 Screen Savers marked 4.0 or higher must handle the following command line arguments:

    ScreenSaver - Show the Settings dialog box.
    ScreenSaver /c - Show the Settings dialog box, modal to the
    foreground window.
    ScreenSaver /p <HWND> - Preview Screen Saver as child of window <HWND>.
    ScreenSaver /s - Run the Screen Saver.
    In addition, Windows 95 Screen Savers must handle:

    ScreenSaver /a <HWND> - change password, modal to window <HWND>
    <HWND> is a HWND presented on the command line as an unsigned decimal number.
    </snipet>

    Another thing that you wanna be careful is if you're using the MouseMove() event to detect mouse activity, ensure to not do anything until the form is already up and running. When I wrote my Screensaver application I had to do the following:


    dim bReady as Boolean

    private Sub Form_Load()
    ' we're not ready yet - so disable SCREENSAVER functionality
    bReady = false

    ' maximize form
    me.WindowState = vbMaximized
    End Sub

    private Sub Form_Paint()
    ' this event will be called once the form is already up and running
    if (not bReady) then
    ' now enable it
    bReady = true
    end if
    End Sub

    private Sub Form_MouseMove(Button as Integer, Shift as Integer, X as Single, Y as Single)
    ' since there is a mouse activity - then end the app
    if (bReady) then End
    End Sub

    private Sub Form_KeyUp(KeyCode as Integer, Shift as Integer)
    ' since there is a keyboard activity - then end the app
    if (bReady) then End
    End Sub




    The reason is, when the form is maximized or minimized, it triggers the MouseMove() event but the thing is, you're just resizing your window. Without the flag, your application will end even before you start your application. Of course this is all assuming that you're using the same method as me

    -Cool Bizs

    Good Luck,
    -Cool Bizs

  5. #5
    Join Date
    May 2001
    Location
    selangor, malaysia
    Posts
    6

    Re: Screen Saver??????????

    just rename the filename from exe to scr... could be done in dos prompt easyly.... sorry for my english

    ren abc.exe abc.scr

    that's all


  6. #6
    Join Date
    Sep 2001
    Posts
    2

    Re: Screen Saver??????????

    I'm wondering if this is applicable for all Win32 Operating System.. I'm using win2k and I'm facing problem running the screensaver.. it works fine in the configuration and preview mode.. but not in the running mode.. Any idea what can be wrong??


    Alattas


  7. #7
    Join Date
    Jul 2000
    Location
    Milano, Italy
    Posts
    7,726

    Re: Screen Saver and exe

    May be you should read this (and download the source code provided at end of doc) to see how screenSavers can be build with vb :
    http://www.codeguru.com/vb/articles/htm/s_saver.shtml

    Special thanks to Lothar "the Great" Haensler, Tom Archer, Chris Eastwood, TCartwright, Bruno Paris, Dr_Micahel
    and all the other wonderful people who made and make Codeguru a great place.
    Come back soon, you Gurus.

    The Rater
    ...at present time, using mainly Net 4.0, Vs 2010



    Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
    all the other wonderful people who made and make Codeguru a great place.
    Come back soon, you Gurus.

  8. #8
    Join Date
    Feb 2001
    Location
    Stamford CT USA
    Posts
    2,167

    Re: Screen Saver??????????

    I did use it on NT4 and Win2K before. It worked fine for even Win9x (except mine needs NT security so did not write anything for Win9x).

    Can't say for sure what is wrong. You can email me your code and I'll check it out on my PC. Email me at [email protected]

    -Cool Bizs

    Good Luck,
    -Cool Bizs

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

Featured