🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: be.comp.programming
Article #15646

Re: screenshot?

#15646
From: BuiZe
Date: Wed, 06 Sep 2000 17:49
96 lines
4330 bytes
hij bedoelde toch wel CODE denk ik, en geen utility

voor VB kan ik je onderstaande Sub geven ; zet alles in een module

CaptureScreen 0,0,800,600
zet de huidige scherminhoud in het klembord


--------------------------------------------------------------------

Option Explicit

Private Const CCHDEVICENAME = 32
Private Const CCHFORMNAME = 32
Private Const SRCCOPY = &HCC0020 ' (DWORD) destination = source

Private Type DEVMODE
    dmDeviceName As String * CCHDEVICENAME
    dmSpecVersion As Integer
    dmDriverVersion As Integer
    dmSize As Integer
    dmDriverExtra As Integer
    dmFields As Long
    dmOrientation As Integer
    dmPaperSize As Integer
    dmPaperLength As Integer
    dmPaperWidth As Integer
    dmScale As Integer
    dmCopies As Integer
    dmDefaultSource As Integer
    dmPrintQuality As Integer
    dmColor As Integer
    dmDuplex As Integer
    dmYResolution As Integer
    dmTTOption As Integer
    dmCollate As Integer
    dmFormName As String * CCHFORMNAME
    dmUnusedPadding As Integer
    dmBitsPerPel As Long
    dmPelsWidth As Long
    dmPelsHeight As Long
    dmDisplayFlags As Long
    dmDisplayFrequency As Long
End Type

'API
Private Declare Function ReleaseDC Lib "user32" (ByVal hWnd As Long, _
ByVal hdc As Long) As Long
Private Declare Function OpenClipboard Lib "user32" (ByVal hWnd As Long) As
Long
Private Declare Function EmptyClipboard Lib "user32" () As Long
Private Declare Function SetClipboardData Lib "user32" (ByVal wFormat As
Long, _
ByVal hMem As Long) As Long
'if you have problems with this function add the Alias "SetClipboardDataA"
Private Declare Function CloseClipboard Lib "user32" () As Long
Private Declare Function SelectObject Lib "gdi32" (ByVal hdc As Long, _
ByVal hObject As Long) As Long
Private Declare Function DeleteDC Lib "gdi32" (ByVal hdc As Long) As Long
Private Declare Function BitBlt Lib "gdi32" (ByVal hDestDC As Long, ByVal x
As Long, _
ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC
As Long, _
 ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As Long
Private Declare Function CreateDC Lib "gdi32" Alias "CreateDCA" (ByVal
lpDriverName _
 As String, ByVal lpDeviceName As String, ByVal lpOutput As String,
lpInitData As_
DEVMODE) As Long
Private Declare Function CreateCompatibleBitmap Lib "gdi32" (ByVal hdc As
Long, _
ByVal nWidth As Long, ByVal nHeight As Long) As Long
Private Declare Function CreateCompatibleDC Lib "gdi32" (ByVal hdc As Long)
As Long

'Screen Capture Procedure, coordinates are expressed in pixels
Public Sub CaptureScreen(Left As Long, Top As Long, Width As Long, Height As
Long)
    Dim srcDC As Long
    Dim trgDC As Long
    Dim BMPHandle As Long
    Dim dm As DEVMODE

    srcDC = CreateDC("DISPLAY", "", "", dm)
    trgDC = CreateCompatibleDC(srcDC)
    BMPHandle = CreateCompatibleBitmap(srcDC, Width, Height)
    SelectObject trgDC, BMPHandle
    BitBlt trgDC, 0, 0, Width, Height, srcDC, Left, Top, SRCCOPY
    OpenClipboard Screen.ActiveForm.hWnd
    EmptyClipboard
    SetClipboardData 2, BMPHandle
    CloseClipboard
    DeleteDC trgDC
    ReleaseDC BMPHandle, srcDC
End Sub
Technical Details
Message-ID: <nsvt5.214587$DJ4.2653995@afrodite.telenet-ops.be>
Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-02!sn-east!sn-xit-uk!supernews.com!193.162.153.122.MISMATCH!news.tele.dk!193.190.198.17!newsfeeds.belnet.be!news.belnet.be!afrodite.telenet-ops.be!not-for-mail
References: <5ktt5.211510$DJ4.2591530@afrodite.telenet-ops.be> <8p5v3j$s55$1@news1.skynet.be>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: fcea4,2d098102d0c5b5cc
X-Google-Attributes: gidfcea4,public
X-Google-ArrivalTime: 2000-09-06 10:49:45 PST
Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-02!sn-east!sn-xit-uk!supernews.com!193.162.153.122.MISMATCH!news.tele.dk!193.190.198.17!newsfeeds.belnet.be!news.belnet.be!afrodite.telenet-ops.be!not-for-mail
Reply-To: "BuiZe" <buize@buize.com>
From: "BuiZe" <buize@buize.com>
Newsgroups: be.comp.programming
References: <5ktt5.211510$DJ4.2591530@afrodite.telenet-ops.be> <8p5v3j$s55$1@news1.skynet.be>
Subject: Re: screenshot?
Lines: 99
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2919.6600
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6600
Message-ID: <nsvt5.214587$DJ4.2653995@afrodite.telenet-ops.be>
Date: Wed, 06 Sep 2000 17:49:07 GMT
NNTP-Posting-Host: 213.224.106.221
X-Trace: afrodite.telenet-ops.be 968262547 213.224.106.221 (Wed, 06 Sep 2000 19:49:07 MET DST)
NNTP-Posting-Date: Wed, 06 Sep 2000 19:49:07 MET DST
Organization: Pandora - Met vlotte tred op Internet