Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hi,

 

Our Network Admins like to be able to see what students are doing whilst they are logged on. Using vb, can I write a program which will allow the Admins to be able to view on their screens what the student is viewing on theirs.

 

I.E. The student opens Word and types 'Hello World.'

 

At the same time, I want an Admin to be able to open a window which looks like the students. - Word opened with 'Hello World'.

 

Do you get what I mean? The Admin is monitoring the student by seeing exactly what they see from their terminal?

 

Sorry for more long-windedness (see some of my other posts!)

 

Thanks,

:) Mike :)

 

He who has a secret, must keep it secret he has a secret to keep......

Posted

You can use APIs to take a screenshot and then send it using a socket to the "Admin" computer. The APIs you'll need are:

Declare Function GetDesktopWindow Lib "user32.dll" () As IntPtr
Declare Function GetDC Lib "user32.dll" (ByVal hwnd As IntPtr) As IntPtr
Declare Function ReleaseDC Lib "user32.dll" (ByVal hwnd As IntPtr, ByVal hdc As IntPtr) As Int32
Declare Function BitBlt Lib "gdi32.dll" (ByVal hDestDC As IntPtr, ByVal x As Int32, ByVal y As Int32, _
ByVal nWidth As Int32, ByVal nHeight As Int32, ByVal hSrcDC As IntPtr, ByVal xSrc As Int32, _
 ByVal ySrc As Int32, ByVal dwRop As Int32) As Int32

I haven't got a working code sample at the moment, I can make one if you need it

.Net allows software to be written for any version of Windows and not break like Unmanaged applications unless using Unmanaged procedures like APIs. If your program uses large amounts of memory but releases it when something else needs it, then what's the problem?
Posted
I haven't got a working code sample at the moment, I can make one if you need it

 

Would you? I am a little bit miffed!

:) Mike :)

 

He who has a secret, must keep it secret he has a secret to keep......

Posted

To get the screenshot using the APIs:

Public Function GetDesktopScreenshot() As Bitmap
Dim Desk, DeskDC, BitmapDC As IntPtr
Dim Pic As Bitmap, PicDraw As Graphics

'Make a Bitmap the same size as the screen
Pic = New Bitmap(Screen.Bounds.Width, Screen.Bounds.Height, PixelFormat.Format16bppRgb565)
PicDraw = Graphics.FromImage(Pic) 'Get a Graphics Object
BitmapDC = PicDraw.GetHdc() 'Get a hDC from the Graphics Object

Desk = GetDesktopWindow() 'Get the desktop hWnd
DeskDC = GetDC(Desk) 'Get a hDC for the desktop

'Copy the desktop to the picture
BitBlt(BitmapDC, 0, 0, Screen.Bounds.Width, Screen.Bounds.Height, DeskDC, 0, 0, &HCC0020)

ReleaseDC Desk, DeskDC 'Release the Desktop hDC

PicDraw.ReleaseDC(BitmapDC) 'Release the Bitmap hDC
PicDraw.Dispose() 'Dispose the Graphic object

Return Pic
End Function

The above code isn't tested so tell me if there doesn't work.

 

The easiest way to send the picture would be to save it and read it in again as a string, but it uses less resources and can be reassembled faster at the other end if you just lock it and read the bitmap data in raw and send it.

.Net allows software to be written for any version of Windows and not break like Unmanaged applications unless using Unmanaged procedures like APIs. If your program uses large amounts of memory but releases it when something else needs it, then what's the problem?
Posted
Wouldn't this be like a remote administrative tool?

 

Yes, it is a remote admin. tool.

:) Mike :)

 

He who has a secret, must keep it secret he has a secret to keep......

Posted
Good point! I would like, however, to integrate this with some other bits and pieces I am writing. However, the source of VNC might give me some starting points! ;)

:) Mike :)

 

He who has a secret, must keep it secret he has a secret to keep......

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...