# Winsock 的传档问题

Posted by CK on March 10, 1999 at 13:15:06:

这是 Server 端送档的程式, 我 Client 该怎么接档呢???? 因为我自己试了后图片不是出来全黑就是花的....

Private Declare Function SetBitmapBits Lib "gdi32" (ByVal hBitmap As Long, ByVal dwCount As Long, lpBits As Any) As Long
Private Declare Function CreateDC Lib "gdi32" Alias "CreateDCA" (ByVal lpDriverName As String, ByVal lpDeviceName As String, ByVal lpOutput As String, lpInitData As Form2) As Long
Private Declare Function DeleteDC Lib "gdi32" (ByVal hdc As Long) As Long
Private Declare Function StretchBlt Lib "gdi32" (ByVal hdc 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 nSrcWidth As Long, ByVal nSrcHeight As Long, ByVal dwRop As Long) As Long
Private Declare Function GetBitmapBits Lib "gdi32" (ByVal hBitmap As Long, ByVal dwCount As Long, lpBits As Any) As Long
Dim byteAry() As Byte
Dim byteAry1() As Byte
Dim byteAry2() As Byte
Dim totbyte As Long, I As Long, J As Long

Dim Devmodeset As Form2
Dim Screenhdc As Long
Dim Rval As Long
Dim X1&, X2&, X3&, X4&, Y1&, Y2&, Y3&, Y4&
X1 = 0: Y1 = 0: X2 = 640: Y2 = 480
X3 = 0: Y3 = 0: X4 = 640: Y4 = 480
Screenhdc = CreateDC("display", "", "", Form2)
Rval = StretchBlt(Picture1.hdc, X1, Y1, X2, Y2, Screenhdc, X3, Y3, X4, Y4, &HCC0020)
Rval = DeleteDC(Screenhdc)
Picture1.Refresh
totbyte = X2 * Y2

ReDim byteAry(totbyte)
Rval = GetBitmapBits(Picture1.Image, totbyte, byteAry(0))

Winsock1(1).SendData byteAry
DoEvents

End Sub

Follow Ups:

- Re: Winsock 的传档问题 guppy 12:23:42 3/11/99 (1)
  - Re: Winsock 的传档问题 CK 05:16:29 3/13/99 (0)