Hi All,
I’m using PB 12.5 Build 2511 on Windows 10.
I've been using SocketTools' File Transfer Control 8.0 since a long time ago and have been using its ActiveX control with PB with no problems until now. Well, sort of because now I'm trying to do something new.
The way I normally use the control in PB is by declaring an OLEObject variable and calling the pertinent methods from the object. Here is a code example of how I use it and works ok (I excluded error handling):
OleObject lole_ftp
lole_ftp = create OleObject
lole_ftp.ConnectToNewObject("SocketTools.FileTransfer.8")
lole_ftp.Initialize('<product key>')
lole_ftp.ServerName = ‘…’
lole_ftp.ServerPort = 21
lole_ftp.UserName = ‘…’
lole_ftp.Password = ‘…’
lole_ftp.TimeOut = 30
lole_ftp.Options = 1
lole_ftp.Connect()
lole_ftp.GetFile('c:\somefile.zip', 'somefile.zip')
lole_ftp.Disconnect()
lole_ftp.Reset()
Destroy lole_ftp
All this works perfectly, but the thing is, now I want to access the ActiveX control events so I can write some script and show a progress bar of the copy process. I understand I cannot do this by using the current method so I read PB's documentation and learned that I have to create an OLE control inside a Window so that the control events get exposed. I did this and now I can see the OnProgress event which according to the manufacturer’s documentation gets fired once a second or so.
So I inserted a line of code to update a progress static text (see image) but the code in the event doesn’t gets executed even though the file gets copied. It could be a fault in the ActiveX control but I seriously doubt it because the control has been in the market for many years and it even includes code examples for doing this using Visual Basic 6 and C++. PowerBuilder is mentioned as a language that can use the control but there are no examples using it for this case.
Any help would be greatly appreciated.
Ricardo
Request clarification before answering.
Hi Ricardo;
1) You do not need to build a visual OLE container. You can build a non-Visual one instead using the Standard Class User Object painter (File=>New in the IDE).
2) You may need to read the documentation from SocketTools and see what events the OCX sends you. These may only appear once you map in some User Events that correspond to the Message ID's the OCX might send you.
3) You can definitely run the SocketTools OCX visually as well if it supports that mode. Just make sure that you build a proper ancestor for this using the Standard Visual class User Object painter (File=>New).
Regards ... Chris
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Chris,
1) This strategy is the one I currently use, although I built a Custom Class instead of a Standard Class inherited from the oleobject type which is what I believe you are suggesting. But the result is the same. I do not have access to the ActiveX events. So I do need to create a visual object inside a window so I can have access to the events. In fact, when I do so I get to see the events (see same image).
2) I'll check this.
3) I don't see the reason to create an ancestor although it surely is a good practice. But inserting the control directly in the Window should work. Unless there is a technical difficulty I'm unaware of.
Ricardo
Hi Ricardo;
It all depends as well whether the SocketTools OCX exposes any events to you. It may not.
You might want to try this control. It does expose events to PB during FTP operations ....
http://www.dart.com/winsock-activex-tcp-control.aspx
HTH
Regards ...Chris
It all depends as well whether the SocketTools OCX exposes any events to you. It may not.
I mentioned in my original post that the ActiveX control has methods and events (see image), and what I want to do is access the later so I can write code that gets executed when the events are fired by the control.
| User | Count |
|---|---|
| 5 | |
| 4 | |
| 4 | |
| 3 | |
| 2 | |
| 2 | |
| 2 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.