From a webbpage I login to TS with MsRdpClient as follows:
.......
MSRdpClient.CreateVirtualChannels "Name"
MsRdpClient.Connect
MsRdpClient.SendOnVirtualChannel "Name", "text"
.......
I get an error on connecting ("undefined error"). When I comment out the
line with
"SendOnVirtualChannel " I get no error. What is wrong with it?
Sandra - 22 Dec 2005 09:46 GMT
The only thing I want to do is to to send some text when connecting from web
(MsRdpClient) to TS that can be read by the application started on TS .
Now I call "SendOnVirtualChannel" on
"MsRdpClient_OnConnected", and I get no error any longer.
But I still can't read anything in the server application , the function
returns
an empty string.
hChannel =
WTSVirtualChannelOpen(WTS_CURRENT_SERVER_HANDLE,WTS_CURRENT_SESSION,"Name")
'''''(here I get a handle, hChannel > 0).
If hChannel <> 0 Then
WTSVirtualChannelRead _
hChannel,WTS_TIMEOUT_MS,sBuffer,WTS_BUFFER_SIZE,lBytesRead
WTSVirtualChannelClose hChannel
End If
'''''''(sBuffer is "" and lByteRead=0)
Any idea? Do I have to start the application before I send text on the
channel?
(I am testing with IIS and TS on XP PC).
> From a webbpage I login to TS with MsRdpClient as follows:
> .......
[quoted text clipped - 6 lines]
> line with
> "SendOnVirtualChannel " I get no error. What is wrong with it?
Sandra - 22 Dec 2005 10:21 GMT
Yes, I needed to open the channel with the application first, before sending
text on channel from client.
> The only thing I want to do is to to send some text when connecting from web
> (MsRdpClient) to TS that can be read by the application started on TS .
[quoted text clipped - 33 lines]
> > line with
> > "SendOnVirtualChannel " I get no error. What is wrong with it?
ThomasTran - 27 Dec 2005 15:45 GMT
The application on the server has to initialize the communication, you can
not send the text from the client
to the server like that, because it can not know when to read the text from
the VC .
Ex: From the server you send a command to client
1 - Server send to client : "Send me something"
2 - On the client side, when receiving this msg (with the event), you call
SendOnVirtualChannel function
3 - On the server, read the text from the virtual channel .
If you use VB, you have to convert from / Unicode, because from the client
(OCX) the SendOnVirtualChannel function sends text as Unicode, but functions
in wtsapi32.dll use byte/char buffer .
Good luck
> From a webbpage I login to TS with MsRdpClient as follows:
> .......
[quoted text clipped - 6 lines]
> line with
> "SendOnVirtualChannel " I get no error. What is wrong with it?