screenshot in GDI....

  • Thread starter Thread starter Supra
  • Start date Start date
S

Supra

using vb.net 2003. i got capturescreen working . what i wanted is how to
used mouse to specifying area of desktop . does ne 1 knows commands
it is like pointoclient....?
regards
 
* Supra said:
using vb.net 2003. i got capturescreen working . what i wanted is how
to used mouse to specifying area of desktop . does ne 1 knows commands

it is like pointoclient....?

I am not sure how this should work. When clicking to select a position
where the selected area starts, the window under the mouse pointer
receives the click event, so it's not that easy to provide a selection
mechanism.
 
make take a snapshot of the whole desktop, then use the mouse to select the
area of your bitmap and dispose of the rest.

Willl this work?

Shane
 
* "SStory said:
make take a snapshot of the whole desktop, then use the mouse to select the
area of your bitmap and dispose of the rest.

Yes, this will work. You can add a handler to a picturebox's 'MouseUp'
event and get the coordinates there ('e.X', 'e.Y').
 
ur ideas will work. all u have to do is used e.X and e.Y. i was
thinking specified area and then into bitmap or image .
regards
 
ur ideas will work. all u have to do is used e.X and e.Y. i was
thinking specified area and then into bitmap or image .
regards,
 
here is code:

Protected Sub CaptureScreen()

Dim hSDC, hMDC As Integer
Dim hBMP, hBMPOld As Integer
Dim r As Integer

hSDC = CreateDC("DISPLAY", "", "", "")
hMDC = CreateCompatibleDC(hSDC)

FW = GetDeviceCaps(hSDC, 8)
FH = GetDeviceCaps(hSDC, 10)
hBMP = CreateCompatibleBitmap(hSDC, FW, FH)

hBMPOld = SelectObject(hMDC, hBMP)
r = BitBlt(hMDC, 0, 0, FW, FH, hSDC, 0, 0, 13369376)
hBMP = SelectObject(hMDC, hBMPOld)

r = DeleteDC(hSDC)
r = DeleteDC(hMDC)

oBackground = Image.FromHbitmap(New IntPtr(hBMP))
DeleteObject(hBMP)

End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
CaptureScreen()
PictureBox1.Image = oBackground
End Sub
 
this code will work. i will have to copy from capturescreeen into
mouseup evernt and get e.X and e.Y into bitblt.
thank..
regsrds,
 
Back
Top