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

    Screencapture over network

    Okay I have a program that will screen capture someone else on my network (program running on their machine) every 10 minutes and save the image to a directory on my computer.

    I have one problem, if there screen saver is on, it will produce an error.

    How should I handle this?
    Disable screen saver?
    How do I know if screen saver is active?
    ___________________________________________

    Also, is there a way to know if a certain application is running? For instance, send me a screen capture if Word 97 is open.



  2. #2
    Join Date
    May 2000
    Location
    New York, NY, USA
    Posts
    2,878

    Re: Screencapture over network

    Disable screen saver?


    Private Declare Function SystemParametersInfo Lib "user32" Alias "SystemParametersInfoA" (ByVal uAction As Long, ByVal uParam As Long, ByVal lpvParam As Long, ByVal fuWinIni As Long) As Long
    Private Const SPI_SETSCREENSAVEACTIVE = 17

    Private Sub cmdDisabled_Click()
    ToggleScreenSaverActive (False)
    cmdEnabled.Enabled = True
    cmdDisabled.Enabled = False
    End Sub

    Private Sub cmdEnabled_Click()
    ToggleScreenSaverActive (True)
    cmdEnabled.Enabled = False
    cmdDisabled.Enabled = True
    End Sub

    Private Sub Form_Load()
    cmdEnabled.Enabled = True
    cmdEnabled.Enabled = False
    End Sub

    Public Function ToggleScreenSaverActive(Active As Boolean) As Boolean
    Dim lActiveFlag As Long
    Dim retvaL As Long
    lActiveFlag = IIf(Active, 1, 0)
    retvaL = SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, lActiveFlag, 0, 0)
    ToggleScreenSaverActive = retvaL > 0
    End Function


    Also, is there a way to know if a certain application is running? For instance, send me a screen capture if Word 97 is open.

    You can find the window by window caption (or part of it). So you will check if word is active and do whatever you need.

    Iouri Boutchkine
    [email protected]
    Iouri Boutchkine
    [email protected]

  3. #3
    Join Date
    Mar 1999
    Location
    Nepal
    Posts
    540

    Re: Screencapture over network

    What method are you using to capture the screen?

    If you use the

    SendKeys "{PRTSC}"

    to capture the screen, you'll get the snapshot even if a screensaver is running.


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