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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MessageBox maths function

Status
Not open for further replies.

sarahknz

Programmer
Mar 22, 2004
26
NZ
I want to store the modules that a user has installed into a single variable and encrypt it. I figured that it might be neat and tidy to use the maths function from messagebox.

So, I'd look at the total and take out 256 for module a, 32 for module b etc.

Does anyone have a function for doing this already?
Is there a better way?

thanks

Sarah

 
I don't know what you mean by a math function of a messagebox!?

If you are referring to the nDialogBoxType parameter
and the way it uses bits to represent certain options,
then you may want to look at bitset/bittest and bitor/bitand functions.

If not, please explain a little bit more what you want to achieve.

Bye, Olaf.
 
Hi,

Are you suggesting that you get the user to enter a number and if it could contain 256 you would enable module a and if it would support 32 then module b was ok?

Regards

Griff
Keep [Smile]ing
 
You are going to need to make the activation code a whole lot more complicated - or your users will work it out.

Look at the MS site for GUID numbers, then use a fixed segment of one of the eight to tell you where to look for your number - and code your module permission in there.

Snag is, where do you record the result in the final destination workstation, registry? HDD? what do you have in mind?

Regards

Griff
Keep [Smile]ing
 
I store it in the database and it's encrypted like anything - here's an example of how the number 1 looks when I've finished with it:

w2rJxeH

and I'm going to make it dependant on their username too - nothing is "unhackable" but I think this should do.

I'll look at that GUID stuff too, though

One of the issues is that I generate the codes in fp2.6 and in PHP but I validate in vfp so the method needs to be flexible.

Sarah

 
We use a variant of this to set menu access for different user types. What you want is the bit manipulation capabilities. While you can use an integer value and get up to 32 bits, we needed many more, so we use a character string (254) times the eight bits for a total of 2032
"flags" or modules.

This is easy in VFP using Substr(), Stuff(), CHR(), ASC() to handle the characters and BITTEST(), BITSET() and BITCLEAR() for the bits inside the characters. In FPD/W, of course the character handling is the same, but there are no BIT...() functions. So you either need to code them yourself or you can get some similar functions in FPATH.PLB/.FLL.

Rick
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top