code:
1
2
3
| Compile error: Only public user defined types defined in public object modules can be used as parameters or return types for public procedures of class modules or as fields of public user defined types |
Zou er dit iemand kunnen vertalen in het nederlands?
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
| Class:
------
Public Function GetPacket%(Buffer As WSABUF)
Dim dwBytesRet&, dwFlags&
If (WSARecv(sock, Buffer, 1, dwBytesRet, dwFlags, Null, Null) = SOCKET_ERROR) Then
Dim buf As String * 200
Call MsgBox("WSARecv failed. Code " & WSAGetLastError(), vbCritical, "Alert!")
End If
Buffer.len = dwBytesRet
GetPacket = 0
End Function
Module:
-------
Public Type WSABUF
len As Long '/* the length of the buffer */
buf As Long '/* the pointer to the buffer */
End Type |
Dat was een stuk van die code... Ik krijg die fout regelmatig, maar nu MOET ik wsabuf doorgeven. Enig idee hoe dat te doen?
Dan nog iets totaal anders:
code:
1
2
3
4
5
| Public Sub Initialize(wsb&) Dim wab As WSABUF: Call memcpy(wab, wsb, 8) ' copy the wsb that comes in to a new location (so we can edit it) Call memcpy(Buffer.buf, wab.buf, wab.len) 'copy the buffer to the new location Buffer.len = wab.len End Sub |
Enige uitleg:
wsb is een pointer (long dus) naar een geheugenruimte die WSABUF voorstelt. Buffer is van het type long+string.
Now advanced coders!!!