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

How to hack scx?

Status
Not open for further replies.

pcwc66

IS-IT--Management
Dec 14, 2001
163
US
I have seen a strange scx corruption. The scx has been hacked by changing some properties values and methods programmtically. After the hacking, the scx has not been compiled.

If I open the scx using the form designer, I can see some codings are corrupted. However, if I close the form, issue the command compile form in the command window, the corrupted codings are fixed.

The strange thing is that if I open the scx using the form designer (I can see some methods are corrupted) and make some changes in a method which is not corrupted (I have not tried different ways such as changing property, changing methods which are corrupted). Then save the form. Issue the command compile form in the command window will not fix the corrupted methods anymore.

Since I have encountered this strange corruption, I have the following questions:

1. If I hack a scx by using the scx and replace some values in column properties and methods, does closing the scx by issuing "use" will compile the scx or not? My guess is not.

2. Do I need to compile the scx after the hacking or it is only necessary if methods are changed? My guess only if methods are changed.

3. When form designer opens a scx, the coding we see is from the column methods or objcode or somewhere else?

4. Does saving a scx in form designer compile the scx? My guess is yes.

5. Is there a free utility which can show difference between scx? So, I can use it to compare the difference before and after hacking.


Thank you for any help.
 
You should issue a "compile form frmName" after hacking the scx.

i.e.

use form.scx alias sourcescx in 0
select sourcescx

* do some hacking
*""
*""

use && close the screen dbf

compile form form.scx

Darrell
 
As for hacking the SCX, you can change the property values and even add properties at will and the scx will work fine, however if you change any methods you will see that the code is broken in weird places when you try to view the events in the designer. The reason for this is that the scx has some sort of pointers in it that refer to where one method ends and another begins...it is based on the number of characters or bytes. So if you had some code like:

Return .F.

..in a method then you could change it to

Return .T. and all would be fine, however if you changed it to:

Return "Hello World"

...then it would be messed up. So, where does the scx hold this information? In the OBJCODE field. Replace the entire OBJCODE field with "" after you are done or recompile the scx (which really just replaces the OBJCODE field with new info). If you look at the OBJCODE field and the information it contains you will see that it is compiled code. OBJCODE is really what gets run when you run a form, not the actual stuff you type into the events and methods...it is generated by the VFP compiler.

That's what I know about it anyways, having hacked a few SCX files from time to time.

Slighthaze = NULL
[sub]craig1442@mchsi.com[/sub][sup]
"Whom computers would destroy, they must first drive mad." - Anon​
[/sup]
 
Hi Slighthaze,

Thank you for the info. It explains why Form Designer will show some corrupted coding but recompile form can fix it if the form is not nodified and saved.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top