Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

GETWORDCOUNT () IN VFP 6.0 ?

A_Radiolog_inFoxPro

IS-IT--Management
Mar 29, 2020
40
1
0
6
CY
Dear All , is being a while , nice makeover but I prefer the old-fashioned style better ,

Nevertheless.

As I understand the command GETWORDCOUNT() is only available on VFP 9.0 and not in VFP 6.0

Is there an easy way to replicate somehow easily what this command does in VFP 6.0 ?

What I want to do is just isolate the computer name ( Hostname ) from SYS(0) so that I can limit a very specific functionality on some specific PCs.

Thank you in advance

The RAD.
 
Solution
well a quick test reveals ?getwordcount("Blah blah") does not work in 6.0
Well yes that was determined already. (by me :D)

Nevertheless Mr. Olaf already shed light on my issue :D
with the following single line :D
"GETENV("COMPUTERNAME")" and you have ONLY the hostname :D so no need to manipulate the string :D

Thank you in advance

Consider the issue resolved :D
well a quick test reveals ?getwordcount("Blah blah") does not work in 6.0
Well yes that was determined already. (by me :D)

Nevertheless Mr. Olaf already shed light on my issue :D
with the following single line :D
"GETENV("COMPUTERNAME")" and you have ONLY the hostname :D so no need to manipulate the string :D

Thank you in advance

Consider the issue resolved :D
 
Solution
I dnt have VFP6 anymore. But what will You do with GETWORDCOUNT(). This only delivry the amound of words and not the word at all.
does VFP6 have already
Code:
?GETWORDNUM(SYS(0),1)
*or
?GETWORDNUM(SYS(0),1,"#")
*or
?LEFT(SYS(0),AT(" ",SYS(0)))
 
All the function is doing is counting the number of words by "spaces". You could create a function:


Code:
FUNCTION GETWORDCOUNT
PARAMETER lcString

lnWordCount = AT(" ",lcString)+1
Return lnWordCount

The reason for the +1 is the last word doesn't get counted because it will have a "." at the end of a sentence, or just end of line with nothing after, so just add 1 to it.

Now in VFP6 put that in your main procedure file, use GETWORDCONT() just like it existed in VFP6.
 
Dear All , is being a while , nice makeover but I prefer the old-fashioned style better ,

Nevertheless.

As I understand the command GETWORDCOUNT() is only available on VFP 9.0 and not in VFP 6.0

Is there an easy way to replicate somehow easily what this command does in VFP 6.0 ?

What I want to do is just isolate the computer name ( Hostname ) from SYS(0) so that I can limit a very specific functionality on some specific PCs.

Thank you in advance

The RAD.
VFP6 comes with foxtools.fll, and this FLL has a function called Words.
Set library to foxtools.fll
?Words(lcText)
 
Dear All , is being a while , nice makeover but I prefer the old-fashioned style better ,

Nevertheless.

As I understand the command GETWORDCOUNT() is only available on VFP 9.0 and not in VFP 6.0

Is there an easy way to replicate somehow easily what this command does in VFP 6.0 ?

What I want to do is just isolate the computer name ( Hostname ) from SYS(0) so that I can limit a very specific functionality on some specific PCs.

Thank you in advance

The RAD.

VFP6 comes with a utility called Foxtools.FLL.

Set Libary to Foxtools.fll additive
?Words(lcText)
 
What I want to do is just isolate the computer name ( Hostname ) from SYS(0)
Well, that's working without word count nor getwordnum, as you already discovered, you have GETENV("COMPUTERNAME")

On the other end of it, the computername is not necessarily the host name a computer has on the internet, it's just a name for the LAN, not necessarily the whole internet. I wonder what that part of it is about, maybe the LAN name of a computer is useful for you, I wonder what for you need it, though.

so that I can limit a very specific functionality on some specific PCs
Well, in that regard doing it by computer name is not very efficient, even if you could limit the users ability to change the computer name.

To only allow a feature to be used on some computers, the usual thing to do is using a serial number, but anything you choose is possible to be changed, so the only way you can control this is by making the verification with a server only you have under control, the client then needs to pass a verification on that server. Even that has it's problems as traffic to your server (like a http request, for example) could be redirected to a local server replacement - a proxy acting as your server. So even establishing some verification scheme involving a server can be sabotaged. Especially if it becomes known the response just has to be yes, no matter how strong cryptographic verfication schemes are used.

The best software or feature protection can be granted by a hardware dongle. It's most convenient for a client to keep and reuse, whenever a computer change is necessary and still is something harder to crack by something like a proxy. Hackers also try to attack dongles, but dongles got more complex than just providing a valid answer to the right input to allow usage, according to a vendor, who held a hacker contest they couldn't crack their latest dongle to claim a 20,000 EUR reward. Not advertising here, but if you're serious you could find it.

Anyway, depends on your outset, whether the computername is good enough. In your own LAN you could quite easily disable users to change it to gain the feature. If you want a customer installing your software to bind a feature to a computername, that doesn't prevent them to name multiple computers the same. If you don't tell them and simply store the computername somewhere for your verification then that's the weak point of that secret, isn't it? So even such things that you keep secret are not unable to be broken. Another point is that the check in your software could be circumvented and VFP can be decimpiled, even with protection like that of refox.
 
Last edited:
All that said, the best prevention of feature availability is to only have the code for the feature on PCs that are allowed to use it. The problem then is that of it being an obvious additional DLL, EXE or APP file that has that feature and could be added elsewhere. Making two EXEs with and without the feature still allow it to be copied elsewhere.

But one certain advantage is, that the feature doesn't exist at all before it's bought.
 

Part and Inventory Search

Sponsor

Back
Top