Chris
At 07:54 AM 8/30/2004, you wrote:
hi liste -
ich habe folgende, serialisierbare klasse- hauptaugenmerk liegt auf dem attribut "img" - ein byte-array.
Imports System.Drawing Imports System.Runtime.Serialization Imports System.Runtime.Serialization.Formatters
Public Class ScreenShot
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
Const SRCCOPY As Integer = &HCC0020
Private FW, FH As Integer
Public Shared img As Byte()
Public Sub CaptureScreen() Dim info As SerializationInfo
Dim hSDC, hMDC As Integer Dim hBMP, hBMPOld As Integer Dim r As Integer
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, 0, 0, FW, FH, hSDC, 0, 0, 13369376) hBMP = SelectObject(hMDC, hBMPOld)
r = DeleteDC(hSDC) r = DeleteDC(hMDC)
Dim oBackground As Bitmap oBackground = Image.FromHbitmap(New IntPtr(hBMP))
Dim formatter As New System.Runtime.Serialization.Formatters.Binary.BinaryFormatter() Dim ms As New System.IO.MemoryStream() formatter.Serialize(ms, oBackground) img = ms.GetBuffer() ms.Flush() End Sub
Public ReadOnly Property _getImage() As Byte() Get Return img End Get End Property End Class
jetzt will ich ein objekt dieser klasse via remoting �bergeben, und zwar so:
Dim getScreenShot As New Interfaces.ScreenShot() Try getScreenShot.CaptureScreen() remServer._giveScreenShot(getScreenShot) Catch e As Exception MessageBox.Show(e.ToString) End Try
der code oben ruft auf dem server die folgende funktion auf:
Public Sub _giveScreenShot(ByVal screenShot As Interfaces.ScreenShot) Implements IServer._giveScreenShot Dim _ms As New System.IO.MemoryStream()
_ms.Write(screenShot._getImage, 0, screenShot._getImage.Length)
Dim _bmp As New Bitmap(_ms) _ms.Close() Me._schoolMain.Screenshot.Image = CType(_bmp, Image)
End Sub
das problem, das ich habe: die _getImage Property meines screenShot-Objektes liefert "Nothing" zur�ck. also das byte-array scheint irgendwie auf dem remoting-weg verloren zu gehen. ich wei� nur nicht, warum- denn eigentlich habe ich doch alles richtig gemacht ...
wei� jemand weiter?
_______________________________________________ Vb.net Mailingliste, Postings senden an: [EMAIL PROTECTED] An-/Abmeldung und Suchfunktion unter: http://www.glengamoi.com/mailman/listinfo/vb.net
_______________________________________________ Vb.net Mailingliste, Postings senden an: [EMAIL PROTECTED] An-/Abmeldung und Suchfunktion unter: http://www.glengamoi.com/mailman/listinfo/vb.net
