|
You last visited: Today at 23:25
Advertisement
[TUTORIAL]VB.NET Screen Capture [TUTORIAL]
Discussion on [TUTORIAL]VB.NET Screen Capture [TUTORIAL] within the Coding Tutorials forum part of the General Coding category.
02/14/2011, 20:12
|
#1
|
elite*gold: 0
Join Date: Feb 2011
Posts: 19
Received Thanks: 22
|
[TUTORIAL]VB.NET Screen Capture [TUTORIAL]
Hello this is a VB.NET tutorial (beginners) on how to make o program caprure screen!
Here we go:
Add this under 'Public Class Form1
Inherits System.Windows.Forms.Form
Private Declare Function CreateDC Lib "gdi32" Alias "CreateDCA" (ByVal lpDriverName As String, ByVal lpDeviceName As String, ByVal lpOutput As String, ByVal lpInitData As String) As Integer
Private Declare Function CreateCompatibleDC Lib "GDI32" (ByVal hDC As Integer) As Integer
Private Declare Function CreateCompatibleBitmap Lib "GDI32" (ByVal hDC As Integer, ByVal nWidth As Integer, ByVal nHeight As Integer) As Integer
Private Declare Function GetDeviceCaps Lib "gdi32" Alias "GetDeviceCaps" (ByVal hdc As Integer, ByVal nIndex As Integer) As Integer
Private Declare Function SelectObject Lib "GDI32" (ByVal hDC As Integer, ByVal hObject As Integer) As Integer
Private Declare Function BitBlt Lib "GDI32" (ByVal srchDC As Integer, ByVal srcX As Integer, ByVal srcY As Integer, ByVal srcW As Integer, ByVal srcH As Integer, ByVal desthDC As Integer, ByVal destX As Integer, ByVal destY As Integer, ByVal op As Integer) As Integer
Private Declare Function DeleteDC Lib "GDI32" (ByVal hDC As Integer) As Integer
Private Declare Function DeleteObject Lib "GDI32" (ByVal hObj As Integer) As Integer
Const SRCCOPY As Integer = &HCC0020
Private oBackground As Bitmap
Private FW, FH As Integer
Now add this sub anywhere to your project, just make sure it's not in another sub.
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
And if you want Button1 to capture the screen and save it to C:/picture.jpg you would do this:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
CaptureScreen()
oBackground.save("C:/picture.jpg")
End Sub
Hope it works.I will make many more tutorial on how to learn visual basic!leave a feedback if you have problems!
CREDITS GOES TO ME AND BOOMER!
POST THANKS IF I HELPED
|
|
|
02/24/2011, 16:53
|
#2
|
elite*gold: 0
Join Date: Oct 2010
Posts: 287
Received Thanks: 111
|
This is not a Tutorial, looks very like an HowTo. You dont describe your code snippets. Thats just Copy and Paste...
|
|
|
02/24/2011, 17:31
|
#3
|
elite*gold: 0
Join Date: Feb 2011
Posts: 19
Received Thanks: 22
|
so what?? if i tell what the code is you wont understand so take the code this way..
|
|
|
02/24/2011, 18:20
|
#4
|
elite*gold: 0
Join Date: Oct 2010
Posts: 287
Received Thanks: 111
|
I understand this code. I dont need you to explain this, but other ones wishes an explanation, maybe...
|
|
|
08/29/2012, 19:25
|
#5
|
elite*gold: 0
Join Date: Feb 2012
Posts: 23
Received Thanks: 21
|
... such pity... i only coded this thing with just 6 - 11 lines of codes...
|
|
|
06/25/2013, 11:50
|
#6
|
elite*gold: 0
Join Date: Jun 2013
Posts: 1
Received Thanks: 0
|
Thank you very much. It works well on my pc. What I really need is the picture of the VB form I am working on. Could you tell me how to do it, or could you offer a code? Thank you in advance.
|
|
|
|
Similar Threads
|
Tutorial ~ Screen erstellen
02/09/2011 - WarRock Guides, Tutorials & Modifications - 7 Replies
Hallo Elitepvpers,
Hier ein kleines Tutorial wie ihr einen "Screenshot" erstellt & anschauen könnt.
1) Ingame gehen & eine gute stelle suchen wo man einen Screen machen will.
2) PRTSC/Druck Taste betätigen (drücken).
3) WarRock Ordner->Screenshots.
http://www.forums9.ch/webtips/doku/PrintScreen/Pr intScreen003.JPG - Screen
|
[TUTORIAL] Starter friendly tutorial to searching for Nuke casting time [TUTORIAL]
02/09/2011 - 9Dragons - 12 Replies
If you already have Cheat Engine and know how to use it, skip to part 4 of the tutorial.
1. Introduction
This forum has helped me quite a bit, so I decided to give something back :)
Now I've noticed there are quite a few who ask for nuke casting time hacks / address', and I've also noticed, that there are quite a few who are REALLY annoyed with these questions, so I decided to write this so both sides can benefit from it.
2. Getting started
First off, you need to have Cheat Engine...
|
[Tutorial] how to start WH.dll on XP [screen]
03/16/2010 - CrossFire - 32 Replies
you MUST have:
faithDEV injector
WH.dll
a really speed click xD
NOW:
open faithDEV and browse the WH.dll
insert crossfire.exe as process name
|
Screen Capture oder so
03/23/2008 - Technical Support - 0 Replies
Hat jemand von euch ein Programm das alle 10 Sekunden oder mehr oder weniger ein Screen macht und in einen Eingestellten Ordner speichert?
Wäre nett wenn ich einen Link bekommen könnte ;) gegoogelt hab ich schon
ps : Ich will kein Video :p
|
All times are GMT +2. The time now is 23:25.
|
|