Вопрос
Как на VB сделать снимок экрана и сохранить его в файл?
Ответ
Можно вот так:
Declare Function GetDesktopWindow Lib "user32.dll" () As Long
Declare Function GetDC Lib "user32.dll" (ByVal hWnd As Long) As Long
Declare Function ReleaseDC Lib "user32.dll" (ByVal hWnd As Long, ByVal hDC As
Long) As Long
Declare Function BitBlt Lib "GDI32.dll" (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
SUB SaveScreen
ScaleMode = vbPixels
Move 0, 0, Screen.Width + 1, Screen.Height + 1
dwRop = &HCC0020
hwndSrc = GetDesktopWindow()
hSrcDC = GetDC(hwndSrc)
Call BitBlt(hDC, 0, 0, ScaleWidth, ScaleHeight, hSrcDC, 0, 0, dwRop)
Call ReleaseDC(hwndSrc, hSrcDC)
SavePicture frmSCREEN.Image, scrfile$
END SUB
frmSCREEN — форма которую следет сделать невидимой.
Пример взят из рассылки сайта VBnet.ru
Пеганов Анатолий Юрьевич
Copyright 2000-2004 Сообщество Чайников
Контактная информация