Page 1 of 1

FWH / xHB and ActiveX

Posted: Wed Sep 21, 2011 9:10 am
by dpaterso
Hi everyone.

I guess one could call this 'a blast from the past'!!! LOL!!!

I don't expect anyone to remember me i.e. the last time I posted here and was involved in the IT Business was around 2006. I do see, however, that Mr. James Bott is still around (who helped me out tremendously when I first started programming with FWH / xHB). Geez James: you must have written some wonderful applications in all these years!!!

I'm also quite 'jealous' to see (from reading through the forums) all the new functionality of FWH / xHB in the new versions!!! I'm embarrassed to admit that I still have FWH / xHB - January 2007!!! LOL!!! But seeing as I sort of 'changed career direction' I've had no reason to keep up to date nor have I had reason to write software (at least not standalone software applications anyway). But, as 'luck' would have it, I now do have a small piece of software that I would like to write and this is the reason 'I'm back' and have a few questions to ask.

Anyone that has any experience with writing software using FWH / xHB with ActiveX would you mind taking a look at this link:

http://www.deltastock.com/english/platf ... ex-api.asp

A SHORT explanation: I need to write a small piece of software using the API described. There are examples given but they're in C#, Java, and VB NONE of which I have a CLUE about (well I have had occasion to do some very simple things in C# but nothing that one could call 'C# programming'). All I know is that (I don't even know the correct terminology to use here) the API depends on (or is) an ActiveX Control. By the way (and if it makes any difference): all the libraries etc. i.e. the 'main' software application is written in C#.

First question regarding the above (if anybody can make sense of the examples): is it possible to obtain the figures using the functions detailed on the link using FWH/ xHB???

Second question: is it possible for me to accomplish this with my current version of FWH / xHB (let me note that I have tried to compile the sample programs that use TActiveX() and I simply get runtime errors (Microsoft) with every one of them (the samples that open an Adobe .PDF file and a Flash Video as but two examples). They compile no problem but won’t run.

Third question: what is the current (latest) version of FWH and xHB and, given that my versions are so ‘old’ (like me i.e. the last few years have taken ‘years off of my life’): do I qualify for the ‘upgrade from an older version of FWH and xHB’ price or do I have to ‘start over’ i.e. purchase entire NEW versions??? (Not to come across as a ‘beggar’ but I really do need to just write one simply utility that is not even for commercial distribution so ‘here’s to hoping’ that I don’t have to pay the full price for entire NEW versions).

So that’s it.

It sort of ‘feels like home’ posting here again for some reason!!! LOL!!!

Regards,

Dale Paterson.

Re: FWH / xHB and ActiveX

Posted: Wed Sep 21, 2011 9:49 am
by Antonio Linares
Dear Dale,

Nice to see you here again :-)

have you downloaded such ActiveX (demo version) ? We can try to make it work here and see the results. Please email it to me alinares@fivetechsoft.com Thanks

Of course that you are entitled to order a FWH upgrade. FiveWin users are always welcome no matter how many years pass by (yes, time flies :-)

best regards,

Re: FWH / xHB and ActiveX

Posted: Wed Sep 21, 2011 10:23 am
by dpaterso
Hi Antonio,

Well: I see that FiveTech Support is as good as ever!!!

Thanks for the prompt response.

I'll download the demo and send the file to you but I'm not sure that's going to be of any help i.e. it requires that another piece of software (the trading platform software) is running in order for this ActiveX Control (or whatever it's called) to be created / accessible so that would mean that you'd have to download the demo version of the trading platform software as well and install it and I don't expect you to go to all of that trouble.

If you have access to VB though: the example that is in the demo .zip file is a VB Project. Would that help any (just by looking at the code)???

Regards,

Dale.

Re: FWH / xHB and ActiveX

Posted: Wed Sep 21, 2011 10:43 am
by dpaterso
Hello again.

In addition to my previous reply (above) I should have included this link as well:

http://www.deltastock.com/english/platf ... erence.asp

It's a link that tells you what functions are 'callable' once you've created this ActiveX Control or ActiveX Object (and there are some code samples below the list of 'callable' functions which, as I noted, are for VB, C#, and Java).

I can get the (their) demo to work no problem but the demo (as I noted) is written in VB and that's NOT something I'm about to start learning NOW!!! LOL!!!

I've already written my application in my version of FWH / xHB. All I want to do now is automatically retrieve figures via the API / ActiveX Control / Object (see: I'm not even sure of the terminology).

I just figured that it HAS to be possible with FWH / xHB (alright maybe NOT with my 'old' versions but still possible) given that, as I understand it, ActiveX is supposed to be 'language independant' (as I understand it anyway).

Regards,

Dale.

Re: FWH / xHB and ActiveX

Posted: Wed Sep 21, 2011 5:02 pm
by Antonio Linares
Dale,

Those VB examples can easily be ported to Harbour :-)

Example 1 - VB

Code: Select all

dim o, retVal, err2
Set o = CreateObject ("DSAPI_Client.clientAPI")
err2 = o.CreateClientAPI()
if err.Number = 0 and err2 <> 0 Then
    retVal = o.NewOrder("EUR/USD",1000,1.3444,0,1,"B","1")
    msgbox o.GetErrDescription(retval)
else
    msgbox (cstr(err.number) & " " & err.Description) 
end if
Example 1 - Harbour

Code: Select all

   local o := CreateObject("DSAPI_Client.clientAPI")
   local nErr2 := o:CreateClientAPI()

   if nErr2 <> 0 // don't know where err comes from! It may be VB error object
      MsgInfo( o:GetErrDescription( o:NewOrder( "EUR/USD",1000,1.3444,0,1,"B","1") ) )
   endif
 

Re: FWH / xHB and ActiveX

Posted: Wed Sep 21, 2011 6:04 pm
by ukservice
Dale,

You can also hire Daniel Garcia Gil services to port this code to FWH.

Re: FWH / xHB and ActiveX

Posted: Wed Sep 21, 2011 7:40 pm
by dpaterso
WOW!!!

Thanks Antonio. As easy at that (although I've not tried it yet but it gives me a 'base' to work from tomorrow). I'm guessing I don't have to worry 'TActiveX' in FWH or anything like that??? It's easy when you know how I guess!!! LOL!!!

'ukservice':

Thanks for the information (or 'offer' if that's you personally). I've already written my little app in FWH / xHB. All I'm wanting to do now is interface it with the other software (the trading platform) so that I don't have to manually input the exchange rates into my app (it's just quicker really, more accurate, and a nice little 'project' for me). So I'll play around with Antonio's example and input and see if I can get the exchange rates 'on the fly'. That's all I really need.

Having said the above though: I think it's time for me to upgrade to the current version of FWH and XHB. For one thing: I see there are MANY new and wonderful functions in the latest version of FWH and secondly the latest version of xHB no longer has a 'test' or 'demo' or 'pre-release' version of Visual xHarbour (my old Borland Resource Workshop is 'a bit long in the teeth' now it would seem). Put another way: after looking at all the new functions in both the latest versions of FWH and xHB my interest in programming has been somewhat rekindled and THIS time around I have a lot of free time on my hands!!! LOL!!!

Once again: thank you both (and hello James and Enrico if you see this post and some others that I know I had dealings with in the past that i THINK I recognise their names and that helped me out when I moved from CA-Clipper to FWH and xHB).

Regards,

Dale Paterson.

Re: FWH / xHB and ActiveX

Posted: Wed Sep 21, 2011 9:22 pm
by Enrico Maria Giordano
dpaterso wrote:Once again: thank you both (and hello James and Enrico if you see this post
Hi Dale! :-)

EMG

Re: FWH / xHB and ActiveX

Posted: Thu Sep 22, 2011 9:30 am
by dpaterso
Hi everybody.

Hello Enrico. Nice to hear from you and thanks for the greeting.

Antonio:

I’m astonished!!! It ‘works like a charm’ (and here I thought this was going to be one HUGE ‘mission’ to get working).

Alright: some of the functions don’t appear to work and I think it’s got to do with the (my) syntax.

Put it this way:

On this link (already posted above but just to make things easier) all the available functions are listed (and the error codes to which you referred to are listed beneath the functions by the way):

http://www.deltastock.com/english/platf ... erence.asp

What’s odd is that I can get the functions that were intended for use for Scripting Languages to return the correct values (as string values). What I cannot seem to get to work are the functions that were intended for use for NON Scripting Languages and I have a feeling it has something to do with this statement (found on the above page next to each function to be used for a NON Scripting Language):

All the functions that are to be used with NON Scripting Languages contain this instruction:

‘Returns the current account balance in the specified currency
The error information is returned in errNumber. It should be
defined in advance and passed by reference to the function.’


I think my problem lies with the ‘passed by reference to the function’ part. What does that mean??? I’ve looked (in my ‘old’ CA-Clipper Manuals and Norton Guide: remember those things??? LOL!!!) as to how to pass a CA-Clipper variable to a function by reference using the ‘@’ symbol but it doesn’t seem to be working for me here with this stuff.

Not REALLY a big deal though i.e. as I noted for some reason I can get the functions that are available for Scripting Languages to return the correct value(s) as a string(s) and I can then extract the values from that (those) string(s). I’m just curious as to what it is that I’m doing wrong.

But yes (and on a personal note and TOTALLY off topic):

It’s been a LONG time and time does INDEED ‘fly by’!!! LOL!!! Sometimes I look at the software that I was writing with FWH and xHB and I’m ashamed that I never completed it. There’s STILL, even after all these years, a market for this software here in South Africa (and probably throughout Africa as a whole). As a matter of fact: if there’s anyone that’s ‘bored’ and wishes to take on a project I’d be only to happy to give to you all my source code and what I’ve already done and maybe by means of collaboration we could complete the system (just as long as I don’t have to code it or write the help screens and manuals)!!! LOL!!! It’s was supposed to be a very basic Fleet Management System and a ‘stripped down and simpler rewrite’ of a much larger and (what was) a well known but very ‘untidy’ and ‘overcomplicated’ Fleet Management System that sold for a ‘small fortune’ that I took over from another company when in my IT Business. The idea was to take ‘the best bits’ from the original ‘untidy’ and ‘overcomplicated’ (and expensive) Fleet Management System, rewrite it in FWH / xHB, and instead of selling and installing and supporting one or two hugely expensive systems of the original ‘untidy’ and ‘overcomplicated’ (and expensive) Fleet Management System (that was really aimed at HUGE corporate transport companies) per month: to complete and sell this ‘stripped down’ and ‘simple rewrite’ with the ‘best bits’ to hundreds, if not thousands, of smaller transport operators for a fraction of the price of the original version and as an ‘off the shelf’ or ‘downloadable’. But: I got sidetracked and involved in the stock market and, well, as I said, sometimes I look at what I’d done and it’s shameful that I never completed it (although I DO KNOW FOR SURE that James Bott would NOT sanction my ‘design’)!!! LOL!!! (I remember having that conversation years ago with him)!!! LOL!!!

To be QUITE honest though: that’s always been a problem with me and writing software (aside from the fact that I got sidetracked this time around). I’ve NEVER REALLY been able to ‘totally complete’ an application!!! For some or the other reason: it’s the INITIAL CHALLENGE that’s always gotten me interested and started and once I’ve got to a point where I’ve sort of ‘mastered’ the general concept and it’s then just gotten to the point of duplicating functions and changing variable and function names for the different modules it simply gets boring for me and my interest wanes. And NEVER ask me to write a MANUAL or a HELP FILE!!! LOL!!! The little projects (like this one that I’m working on now) are different i.e. they’re simple little utilities that are quick and simple to write and whatever documentation is necessary cannot be longer than one page!!! LOL!!! THAT type of thing I have no problem with.

Anyway: there’s an idea for someone that may be interested.

I DID, at one point, try to get this done (the rewrite) with a good friend of mine but he’s a C# programmer and knew nothing about the transport industry and although he’s an EXCELLENT programmer: because we were not ‘speaking the same programming language’ it just became too difficult to collaborate so the project AGAIN got ‘canned’.

Anyway: sorry for the long post (and the off topic and personal notes) but like I said: it’s funny but posting here again ‘feels like home’!!! LOL!!!

Regards,

Dale Paterson.

Re: FWH / xHB and ActiveX

Posted: Thu Sep 22, 2011 10:56 am
by Antonio Linares
Dale,

You are right about the use of the operator ‘@’, it is the way to go. The problem may come from the Harbour or xHarbour used version as the OLE support is a stuff that has been improved along the time.

My advise is to try your code with a more recent Harbour or xHarbour version. Time to upgrade... :-)

Re: FWH / xHB and ActiveX

Posted: Fri Sep 23, 2011 3:16 pm
by James Bott
Welcome back Dale. Its nice to see you here again.

I do remember having some discussions about interface design. This is one of my favorite topics.

Regards,
James

Re: FWH / xHB and ActiveX

Posted: Sun Sep 25, 2011 6:33 am
by dpaterso
Good morning everyone.

And hello James. It's nice to hear from you. Interface design is (was???) always one of my favorite topics as well (as long as a piece of software LOOKS good then I make the assumption that it's a good piece of software)!!! LOL!!! In hindsight (and after reading your much appreciated greeting after all of these years) I was thinking WHY the differences of opinion back then and I've come up with this: there is 'Third World Interface Design' and 'International Interface Design'!!! LOL!!! THAT was what I was getting at all those years ago (I've only just managed to put it into words). And when a friend of mine, some time ago, offered to take on the rewrite of my 'stripped down' fleet management system (noted in a previous post on this thread and is still on offer to anyone that’s interested in taking on the project in FWH / XHB) using Visual C# I was AGAIN reminded of this issue. While he did a fantastic LOOKING job of the start-up module in Visual C# (that's as far as we got) and while it looked 'beautiful' (to me anyway) I can tell you that the target customer market here would NEVER have coped with (nor been interested in finding out how to use) this new 'stripped down' fleet management system with it's new 'beautiful' ‘International Interface Design’)!!! LOL!!! And that's STILL applicable here in South Africa to this day (at least for the target customer market here for this product)!!! LOL!!!

Anyway: the above was just to 'touch base' with you again (that's apparently so 80's to say now I’m told i.e. 'touch base' although I personally have always HATED the phrase)!!! LOL!! And of course the above is TOTALLY OFF-TOPIC!!!

So to get ON-TOPIC:

I was merrily programming away yesterday to my heart’s content and ever so proud of my finished product (it’s a just a small utility that saves me time and hopefully will save time for some of my ‘minions’ that I ‘mentor’ in the field of trading equity futures and commodities). The ActiveX ‘stuff’ was working absolutely perfectly (thanks again Antonio) and I was EVER so proud of myself. BUT THEN ‘a little inner voice’ said to me: what will happen if this utility is run on a workstation that does NOT have the API installed (or available or whatever the word is). So I uninstalled the ‘main’ software (the trading platform) from another of my workstations and ran my new ‘beautiful’ utility and SURE ENOUGH I got a runtime error the description of which was ‘Error description: Error TOleAuto/1 CO_ECLASSTRING: TOLEAUTO:NEW’. Basically (and from my understanding) it means that the CreateObject( ‘Object_Name’) could not be created and failed.

NO RROBLEM though i.e. by going through the FWH / xHB Samples I sorted the problem out thus (right at the beginning of my code):


***
#Include 'FiveWin.ch'
***

***
Function Main( )

Public oDSAPIObject
Public nDSAPICreated
Public cDSAPIQuotePrice := 0, cDSAPIBIDPrice := 0, cDSAPIASKPrice := 0, nDSAPIAveragePrice := 0
Public nDSAPIRate := 0
Public lDSAPIAvailable := .T.

Try

oDSAPIObject := CreateObject( ‘DSAPI_Client.clientAPI’ )
nDSAPICreated := oDSAPIObject:CreateClientAPI( )

Catch

lDSAPIAvailable := .F.

End

Rest of application follows…
***

To be honest: I didn’t even know the command words ‘Try’ and ‘Catch’ even EXISTED until yesterday!!! LOL!!!

But HERE IS THE QUESTION:

Although I’ve solved my problem (and this may be more of a ‘Windows question’ than a FWH / xHB question): where does one FIND if these ActiveX ‘things’ are installed on a workstation and if they’re available and if they can be created and what their names are (sorry but I hope that question makes sense).

In other words (in my case): when installing the ‘main’ application (the trading platform in my case) obviously the ActiveX ‘thing’ gets installed and ‘exists’ somewhere. Where would one find out or be able to see a list of all of the installed or available ActiveX ‘things’ on a workstation??? Is it possible???

Given that my utility is working PERFECTLY (thanks again Antonio) it just got me to thinking: WHAT IF (for whatever weird reason in the future) I decided that I waned to write something else that involved ActiveX ‘stuff’. How would I know whether the ActiveX ‘thing’ was available or not??? As I DID point out at the very beginning of this thread: the standard code samples provided with FWH / xHB (my ‘aged’ versions anyway) for opening Excel, Word, a Flash Player, etc. using ActiveX ‘things’ don’t work on my workstations (although I don’t get runtime errors from FWH / xHB but rather those ‘Microsoft Error Messages’).

Just curious really and would appreciate some input (I still enjoy ‘learning’ you know)!!! LOL!!!

By the way: when I refer to ActiveX ‘things’ what is the CORRECT terminology for these ‘things’??? I don’t want to sound like a TOTAL idiot the next time I post about ActiveX!!! LOL!!!

Regards,

Dale.

Re: FWH / xHB and ActiveX

Posted: Mon Sep 26, 2011 2:11 pm
by James Bott
Dale,

I expect you could read all the available ActiveX objects from the registry as all have to be registered, but I am not sure how valuable this information would be as you already know the names of the ones your app needs and all other are irrelevant. You have already found a good way to look for the ones you need in your app.

Regarding interface design there is no one design that works for all situations. Each application has to work for a specific situation. Then there is the challenge of developing an interface that works for diverse users from novice to expert. What is needed for a novice is too cumbersome for an expert. Just like programming itself, I love the challenge of developing the interface--it is a puzzle.

Regards,
James