Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21238

[RESOLVED] Saving a capture of the form as a BMP file?

$
0
0
Hello there everyone. I am trying to capture a screen cap of student work,so teachers can look at it later.

I am trying to basically take a snap shot of the form, put it into a picture box called picture1, then save it.

This is the code I am using.

VB Code:
  1. Private Sub PrintButton_Click()
  2. Dim s As String
  3.  'you can also make the picbox visible=false
  4.  'or move it off screen
  5.  Picture1.AutoRedraw = True
  6.  s = "Form Picture dated: " & Now
  7.  Clipboard.Clear
  8.  DoEvents
  9.  Call keybd_event(VK_SNAPSHOT, AppScreen, 0&, 0&)
  10.  DoEvents
  11.  'get the form pic to Picture1
  12.  Set Picture1.Picture = Clipboard.GetData(vbCFBitmap)
  13.  'write the caption
  14.  With Picture1
  15.  
  16.  
  17.   Picture1.Height = 9960
  18.   Picture1.Width = 15030
  19.  End With
  20.  Picture1.Print s
  21. SavePicture Picture1.Image, App.Path & "\Literacy Station Picks - " & LiteracyStationWeekView.Caption & Format(Date, "dd-mm-yyyy") & " - " & Format(Time$, "hh-mm-ss") & ".bmp"
  22. End Sub

The thing is, the code works, as it will save the file as a BMP, but the thing is, it just takes a copy of the empty picture box. Is there another way to do this?

Thanks!

Viewing all articles
Browse latest Browse all 21238

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>