Click here to Skip to main content
15,905,781 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: MMControl Help Pin
Red Sunday4-Aug-04 7:54
Red Sunday4-Aug-04 7:54 
GeneralRe: MMControl Help Pin
Dave Kreskowiak4-Aug-04 10:48
mveDave Kreskowiak4-Aug-04 10:48 
Generaloverwrite a mdb file Pin
kornstyle3-Aug-04 12:26
kornstyle3-Aug-04 12:26 
GeneralRe: overwrite a mdb file Pin
Dave Kreskowiak4-Aug-04 3:08
mveDave Kreskowiak4-Aug-04 3:08 
GeneralRe: overwrite a mdb file Pin
kornstyle4-Aug-04 3:54
kornstyle4-Aug-04 3:54 
GeneralPopulating dropdown in client side. Pin
mittalpa3-Aug-04 11:07
mittalpa3-Aug-04 11:07 
GeneralRe: Populating dropdown in client side. Pin
Dave Kreskowiak4-Aug-04 3:00
mveDave Kreskowiak4-Aug-04 3:00 
Generalscreen shot and Remoting Pin
tommy_tanaka3-Aug-04 8:17
tommy_tanaka3-Aug-04 8:17 
well - i have a problem with screenshotting and remoting.

what i do:

my server-application has an hashtable where it stores the client-objects and a pictureBox.

the client-object owns the function _captureScreen:
Public Function _captureScreen() As Image Implements IClient._captureScreen
Dim getScreenShot As ScreenShot
'myParent is the mainForm from which the client-object was created
myParent.status.Text = "Screenshot called"
myParent.Screen.Image = CType(getScreenShot.CaptureScreen(),System.Drawing.Bitmap)
Return CType(getScreenShot.CaptureScreen(),System.Drawing.Bitmap)
End Function

The class ScreenShot simply catch a bitmap of the actual screen. i got the code from the net:

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 oBackground As Bitmap

Private FW, FH As Integer

Public Function CaptureScreen() As Image

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)

oBackground = Image.FromHbitmap(New IntPtr(hBMP))

Return CType(oBackground, Image)

End Function

End Class


now, as soon as i call the client-function "_captureScreen" in my server-object:

Public Function _getClientScreenShort() As Image Implements
IServer._getClientScreenShot

Dim user As IClient

Dim capturedScreen As Image

'_clients is the hashtable
For Each user In _clients.Values

Try

capturedScreen = user._captureScreen

Catch e As Exception

Me._schoolMain.Info.Text = "Exception in Screenshot: " & e.ToString

End Try

Next

Return capturedScreen

End Function



now the following happens:

at client-site the status-text "screenshot called" is printed.
but after this, nothing happens. the picturebox of the client application stays empty.

the server-application even hangs up. (is a thread needed here???)


could someone help me out of my mess?

i hope i explained it understandable.

if not, just ask for more code or explaination.


thanks to all who took the time to read my thread.


greetings-

tom
GeneralHighlight a cell in DataGrid Pin
Richard Jones3-Aug-04 8:00
Richard Jones3-Aug-04 8:00 
Generalcommunication port Pin
x_no3-Aug-04 0:07
x_no3-Aug-04 0:07 
GeneralRe: communication port Pin
Dave Kreskowiak3-Aug-04 5:17
mveDave Kreskowiak3-Aug-04 5:17 
Generaladding a new node to XML config file Pin
Vineet Rajan2-Aug-04 20:57
Vineet Rajan2-Aug-04 20:57 
GeneralPlz Help me to fix overflow error Pin
Murtuza Husain Miyan Patel2-Aug-04 20:08
professionalMurtuza Husain Miyan Patel2-Aug-04 20:08 
GeneralRe: Plz Help me to fix overflow error Pin
Dave Kreskowiak3-Aug-04 5:21
mveDave Kreskowiak3-Aug-04 5:21 
GeneralRe: Plz Help me to fix overflow error Pin
Murtuza Husain Miyan Patel3-Aug-04 20:44
professionalMurtuza Husain Miyan Patel3-Aug-04 20:44 
GeneralRe: Plz Help me to fix overflow error Pin
Dave Kreskowiak4-Aug-04 2:57
mveDave Kreskowiak4-Aug-04 2:57 
GeneralRe: Plz Help me to fix overflow error Pin
Murtuza Husain Miyan Patel16-Aug-04 20:05
professionalMurtuza Husain Miyan Patel16-Aug-04 20:05 
GeneralRe: Plz Help me to fix overflow error Pin
Dave Kreskowiak18-Aug-04 1:42
mveDave Kreskowiak18-Aug-04 1:42 
GeneralRe: Plz Help me to fix overflow error Pin
Murtuza Husain Miyan Patel18-Aug-04 4:12
professionalMurtuza Husain Miyan Patel18-Aug-04 4:12 
Generaladding a form to windows service project Pin
Vineet Rajan2-Aug-04 18:31
Vineet Rajan2-Aug-04 18:31 
GeneralNetworked Application Pin
Alejandro K.2-Aug-04 5:05
Alejandro K.2-Aug-04 5:05 
GeneralRe: Networked Application Pin
Dave Kreskowiak2-Aug-04 10:58
mveDave Kreskowiak2-Aug-04 10:58 
GeneralConverting System Time to milliseconds Pin
Simon Kearn2-Aug-04 4:33
sussSimon Kearn2-Aug-04 4:33 
GeneralRe: Converting System Time to milliseconds Pin
Dave Kreskowiak3-Aug-04 5:45
mveDave Kreskowiak3-Aug-04 5:45 
GeneralRe: Converting System Time to milliseconds Pin
Simon Kearn5-Aug-04 0:05
sussSimon Kearn5-Aug-04 0:05 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.