Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Hacking a menu system (Part II)
Message
 
To
04/05/2004 12:22:04
General information
Forum:
Visual FoxPro
Category:
Menus & Menu designer
Miscellaneous
Thread ID:
00900815
Message ID:
00900836
Views:
15
>Hi,
>
>I'm (still!) trying to catch the whole structure of a VFP app menu system (please see thread #899707). My first attempt was to loop thru its structure using common VFP's builtin functions, but that fails in many ways:
>
>- I cannot get deeper than first level menus (based of _MSysMenu)
>- There is not a function to return the 'MESSAGE' part of a Pad/Bar
>- There is no way to catch the "Skip For" part
>- and the list goes...
>
>The next approach that came to my mind was to hack the executable. For that purpose I just oppened an app's executable (using VFP's source code editor) and took a look around. Its structure, besides being unknown to me, seemed not so complicated and I could recognize many elements of the menu system in it. A sample of it looks like:
>
>.BUILD_MENU..NRETCODE
>.MAKELOGOFF..GDIRAGCOUSERDBF..GSESSIONz,..7….
>.T.....-....s......"..
>..\<Sistema......Alt+S...1...............s.....6.s..........".."...\<Sobre......
>.......................s.........."....\-
>..6.s..........".."...\<Log.de.Transações.Efetuadas.....6.s.........."
>.."...\<Usuários.Ativos.no.Sistema........s.........."....\-
>..K.s..........".."...Sai\<r...............................Alt+R.....Alt+R...p.1
>............^.cNull.=.MessageBox.(gAboutMessage,.(0+64+0),.
>".Sobre.o.PPD.-.Product.Planning.&.Distribution").
>[.1............I.Do.BrowseLog...In..InvMaqAudt..with..gMySelfUser,.Date.(),.gLongName
>,..T..?.1............-
>.Do.SeeActUsers.In..InvMaqAudt..with...T.,."S"...1............
>.Do.FimProg.
>.........º
>
>I changed all non-printable caracters (and some other crazy ones) by "." and inserted some carriage returns for the sake of readability.
>
>There are programs like Refox that hack an executable and can bring it to source code, so that's not an impossible task (please I'm not trying to "rewrite" a Refox here, just wanting to get thru the menu system). Also it is common practice hack forms, reports etc, so that's not a big deal, right?
>
>My question is: where can I find information regarding the executable structure, its sections, conventions and the like?
>
>TIA,
>
>Fernando

Hi Fernando!

This is not a direct answer, but it occurs to me that a completely different approach might be better. Create a table-driven menu generator of your own, something I did myself a few years back, but haven't played with in a long time. The basic idea is to represent the constituent menu options with separate memo fields, which can also support dynamic expressions, if you like. Menu commands are generated and macro-expanded on the fly, directly off of the metadata, so you can support user-adjustable menus in a pure runtime enviroment. Such a system could easily be extended to use alternate fields for different translations. In the end, I think this would be cleaner and simpler than the other approaches you are contemplating, and it would have greater general utility.

Mike
Montage

"Free at last..."
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform