Results 1 to 2 of 2

Thread: Monitoring my desktop

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2008
    Posts
    1

    Monitoring my desktop

    Hello !
    The last days I am wondering how to make screenshots of my pc every 5 minutes and then automatically put them in a zip folder. In C++ I read something about OpenGL, but could anyone tell me how to make this in VB (please don't tell me things like "try it with opengl" ^^) ? If it's possible to give me the source code, of course this would be the best (so i can learn of it). But if not, it's ok .

    Thank you very much !
    ,Greetz Static_void

  2. #2
    Frenzied Member Jim Davis's Avatar
    Join Date
    Mar 2001
    Location
    Mars base one Username: Jim Davis Password: yCrm33
    Posts
    1,284

    Re: Monitoring my desktop

    how to make screenshots of my pc
    You mean a screenshot of the desktop area? Use bitblt api, there are thousands of great examples of screenshot takers on psc, but i bet you can found them in here at the codebank also.

    There is a ZipLib dll that you can use to zip the file, but there you may have to know the actual headers and structure of a .zip file that i dont know much about it. Google it. But if you just want to 'zip' one single file to make it smaller, the ziplib does the job as well..

    http://www.zlib.net/ <- look for the (pre)compiled dll

    Code:
    Private Declare Function compress2 Lib "zlibwapi.dll" (dest As Any, destLen As Any, src As Any, ByVal srcLen As Long, ByVal Level As Integer) As Long
    Private Declare Function uncompress Lib "zlibwapi.dll" (dest As Any, destLen As Any, src As Any, ByVal srcLen As Long) As Long
    Code:
    Function Zip(ByVal Container As String, ByRef origSize as long) As String
      Dim CmpSize As Long
      Dim TBuff As String
      Dim orgSize As Long
      Dim RES As Long
      
      orgSize = Len(Container)
      TBuff = String(orgSize + (orgSize * 0.01) + 12, 0)
      CmpSize = Len(TBuff)
    
      RES = compress2(ByVal TBuff, CmpSize, ByVal Container, Len(Container), 9)
    
      Zip = Left$(TBuff, CmpSize)
    End Function 
    
    
    Function UnZip(ByVal Container As String, ByVal origSize as Long) As String
      Dim CmpSize As Long
      Dim TBuff As String
      Dim RES As Long
    
      TBuff = String(origSize + (origSize * 0.01) + 12, 0)
      CmpSize = Len(TBuff)
    
      RES = uncompress(ByVal TBuff, CmpSize, ByVal Container, Len(Container))
    
      UnZip = Left$(TBuff, CmpSize)
    End Function
    Dont forget to store the origSize (that is the len of the string you wanna zip), because the unZip have to define the correct buffer size to unpack the packed material. you can simply store this size information at the start of your file, that is 4 byte long.

    But i recommend you to convert the image to any common format, just like JPG or PNG. You can also downsample the size, and/or the bpp (bits per pixel) to make the image even smaller. Look around in the code banks for examples about image conversions. afaik by using gdiplus apis you can convert most of the image types. like gif/bmp/jpg/png/ and so on..

    You can also do some comparing, that what areas of the screen are modified, so you only have to store the modified areas, but its not as simple as im talking about it...

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