Click here to Skip to main content
15,903,203 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
GeneralRe: Crossing the UI sync context with a datasource Pin
Eddy Vluggen9-Aug-12 23:01
professionalEddy Vluggen9-Aug-12 23:01 
GeneralRe: Crossing the UI sync context with a datasource Pin
JoeRip9-Aug-12 23:46
JoeRip9-Aug-12 23:46 
GeneralRe: Crossing the UI sync context with a datasource Pin
JoeRip10-Aug-12 16:16
JoeRip10-Aug-12 16:16 
GeneralRe: Crossing the UI sync context with a datasource Pin
Ed Hill _5_11-Aug-12 6:14
Ed Hill _5_11-Aug-12 6:14 
GeneralRe: Crossing the UI sync context with a datasource Pin
JoeRip10-Aug-12 18:47
JoeRip10-Aug-12 18:47 
QuestionIf proccess is running then start coding ! Help Needed Pin
jitforce25858-Aug-12 8:09
jitforce25858-Aug-12 8:09 
AnswerRe: If proccess is running then start coding ! Help Needed Pin
jitforce25858-Aug-12 8:58
jitforce25858-Aug-12 8:58 
QuestionA Way Capturing Straight the Active Windows Only ?? Pin
jitforce25858-Aug-12 4:30
jitforce25858-Aug-12 4:30 
Hi Everyone,

I did a search on capturing screen shots in vb.net and I was wondering if there is a straight forward way to capture the active window? Or do I need to first get the handle of the active window, get the position and size and then capture it? I do not want to use any type of sendkeys method or use the clipboard. I want to save it to jpg format.

Thanks!

Done so far but its capturing the entire window is

Module patternAload

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

Declare Function GetForegroundWindow Lib "user32" Alias "GetForegroundWindow" () As Integer

Const SRCCOPY As Integer = &HCC0020

Private oBackground As Bitmap
Private FW, FH As Integer

Public Sub CaptureScreen()

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

Dim fgw As Long = GetForegroundWindow()

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, 40, 40, FW, FH, hSDC, 0, 0, SRCCOPY)




hBMP = SelectObject(hMDC, hBMPOld)






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

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

DeleteObject(hBMP)

End Sub
AnswerRe: A Way Capturing Straight the Active Windows Only ?? Pin
Pete O'Hanlon8-Aug-12 4:48
mvePete O'Hanlon8-Aug-12 4:48 
GeneralRe: A Way Capturing Straight the Active Windows Only ?? Pin
jitforce25858-Aug-12 5:05
jitforce25858-Aug-12 5:05 
GeneralRe: A Way Capturing Straight the Active Windows Only ?? Pin
Pete O'Hanlon8-Aug-12 5:10
mvePete O'Hanlon8-Aug-12 5:10 
GeneralRe: A Way Capturing Straight the Active Windows Only ?? Pin
jitforce25858-Aug-12 5:34
jitforce25858-Aug-12 5:34 
GeneralRe: A Way Capturing Straight the Active Windows Only ?? Pin
jitforce25858-Aug-12 6:10
jitforce25858-Aug-12 6:10 
GeneralRe: A Way Capturing Straight the Active Windows Only ?? Pin
Pete O'Hanlon8-Aug-12 7:28
mvePete O'Hanlon8-Aug-12 7:28 
GeneralRe: A Way Capturing Straight the Active Windows Only ?? Pin
jitforce25858-Aug-12 8:07
jitforce25858-Aug-12 8:07 
Question.net framework 4 takes much time than 2.0. Why? Pin
ruby_e_s8-Aug-12 2:26
ruby_e_s8-Aug-12 2:26 
AnswerRe: .net framework 4 takes much time than 2.0. Why? Pin
Pete O'Hanlon8-Aug-12 2:47
mvePete O'Hanlon8-Aug-12 2:47 
GeneralRe: .net framework 4 takes much time than 2.0. Why? Pin
ruby_e_s8-Aug-12 21:28
ruby_e_s8-Aug-12 21:28 
GeneralRe: .net framework 4 takes much time than 2.0. Why? Pin
Pete O'Hanlon8-Aug-12 23:19
mvePete O'Hanlon8-Aug-12 23:19 
GeneralRe: .net framework 4 takes much time than 2.0. Why? Pin
ruby_e_s8-Aug-12 23:36
ruby_e_s8-Aug-12 23:36 
GeneralRe: .net framework 4 takes much time than 2.0. Why? Pin
Pete O'Hanlon8-Aug-12 23:48
mvePete O'Hanlon8-Aug-12 23:48 
GeneralRe: .net framework 4 takes much time than 2.0. Why? Pin
ruby_e_s9-Aug-12 0:01
ruby_e_s9-Aug-12 0:01 
GeneralRe: .net framework 4 takes much time than 2.0. Why? Pin
Pete O'Hanlon9-Aug-12 0:06
mvePete O'Hanlon9-Aug-12 0:06 
GeneralRe: .net framework 4 takes much time than 2.0. Why? Pin
ruby_e_s9-Aug-12 0:10
ruby_e_s9-Aug-12 0:10 
GeneralRe: .net framework 4 takes much time than 2.0. Why? Pin
Pete O'Hanlon9-Aug-12 0:34
mvePete O'Hanlon9-Aug-12 0:34 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.