- Код: Выделить всё
Option Explicit
Private Declare Function GetDesktopWindow Lib "user32" () As Long
Private Declare Function GetDC Lib "user32" (ByVal hWnd 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 Const SRCCOPY = &HCC0020
Private Sub Command1_Click()
Dim hDesk, hDeskDC
hDesk = GetDesktopWindow()
hDeskDC = GetDC(hDesk)
BitBlt picShot.hDC, 0, 0, Width, Height, hDeskDC, 0, 0, SRCCOPY
SavePicture picShot.Image, "C:\PicOut.bmp"
End Sub
- Код: Выделить всё
Dim MyPic As StdPicture
Dim FileName As String
FileName = FileDialog(Me, False, "Open Picture File", "Picture Files|*.jpg;*.jpeg;*.gif;*.bmp;*.wmp;*.rle;*.cur;*.ico;*.emf|All Files [*.*]|*.*")
If Len(FileName) > 0 Then
On Error Resume Next
Set MyPic = LoadPicture(FileName)
If Err.Number = 0 Then
Set m_Image = New cImage
m_Image.CopyStdPicture MyPic
If mnuAutosize.Checked Then SetFormSize m_Image
AdjustScrollBars m_Image
Me.Caption = App.Title & " - " & FileTitleOnly(FileName)
mnuSave(0).Enabled = True
Else
MsgBox "Can not load picture file" & vbCrLf & """" & FileName & """", vbExclamation, "File Load Error"
End If
Set MyPic = Nothing
End If
как не сохраняя и не загружая БМП можно напрямую переслать картинку на Dim MyPic As StdPicture
set mypic = ????
как обойти этот loadpicture и что он вообще делает? есть ему альтернатива?