Sinds kort probeer ik een programmatje (Client - server) op te zetten om een webcam op afstand te bekijken.
Op PS-code vond ik het volgende VBscript:
Download VB: http://users.pandora.be/rh_flyboy/webcam.zip
Code van het formulier:
Code van de dll:
Als ik de uitvoer van Clipboard.GetData bekijk, dan bekom ik integers zoals deze:
251989588
1795493265
-452653510
637865556
-2130375279
839192148
201657914
-804975015
1241845332
-1509618287
1241845210
Ik dacht eraan deze via winsock te versturen naar de client. Dit lukte wel.
Dan probeerde ik op de client deze via: winsock.getdata picOutput.Picture
Dit lukte echter niet.
Zijn deze cijfers dan een soort van verwijzigen naar geheugenplaatsen?
Alvast bedankt
Op PS-code vond ik het volgende VBscript:
Download VB: http://users.pandora.be/rh_flyboy/webcam.zip
Code van het formulier:
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
| Private Sub cmdStart_Click()
cmdStart.Enabled = False
cmdStop.Enabled = True
'Setup a capture window (You can replace "WebcamCapture" with watever you want)
mCapHwnd = capCreateCaptureWindow("WebcamCapture", 0, 0, 0, 320, 240, Me.hwnd, 0)
'Connect to capture device
DoEvents: SendMessage mCapHwnd, CONNECT, 0, 0
tmrMain.Enabled = True
End Sub
Private Sub cmdStop_Click()
cmdStart.Enabled = True
cmdStop.Enabled = False
tmrMain.Enabled = False
'Make sure to disconnect from capture source!!!
DoEvents: SendMessage mCapHwnd, DISCONNECT, 0, 0
End Sub
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
If cmdStop.Enabled = False Then
'Make sure to disconnect from capture source - if it is connected upon termination the program can become unstable
DoEvents: SendMessage mCapHwnd, DISCONNECT, 0, 0
End If
End Sub
Private Sub tmrMain_Timer()
On Error Resume Next
'Get Current Frame
SendMessage mCapHwnd, GET_FRAME, 0, 0
'Copy Current Frame to ClipBoard
SendMessage mCapHwnd, COPY, 0, 0
'Put ClipBoard's Data to picOutput
picOutput.Picture = Clipboard.GetData
'Clear ClipBoard
Clipboard.Clear
End Sub |
Code van de dll:
code:
1
2
3
4
5
6
7
8
9
| Public Declare Function SendMessage Lib "USER32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long Public Declare Function capCreateCaptureWindow Lib "avicap32.dll" Alias "capCreateCaptureWindowA" (ByVal lpszWindowName As String, ByVal dwStyle As Long, ByVal X As Long, ByVal Y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hwndParent As Long, ByVal nID As Long) As Long Public mCapHwnd As Long Public Const CONNECT As Long = 1034 Public Const DISCONNECT As Long = 1035 Public Const GET_FRAME As Long = 1084 Public Const COPY As Long = 1054 |
Als ik de uitvoer van Clipboard.GetData bekijk, dan bekom ik integers zoals deze:
251989588
1795493265
-452653510
637865556
-2130375279
839192148
201657914
-804975015
1241845332
-1509618287
1241845210
Ik dacht eraan deze via winsock te versturen naar de client. Dit lukte wel.
Dan probeerde ik op de client deze via: winsock.getdata picOutput.Picture
Dit lukte echter niet.
Zijn deze cijfers dan een soort van verwijzigen naar geheugenplaatsen?
Alvast bedankt