parsing .frm file for control names and nested level
-
Hi, i searched around the Net and Code Project for some existing parser, but so far unsuccessful. What I want to do is parse a Visual Basic .FRM (form) file and extract the control names defined within. I also want to determine if there are nested controls within. If possible, convert the listing and nested information into some format that can be easily worked with by other tools - like XML or some identifiable tree structure. For example (MyForm.frm):
Begin Control1Lib.Cntrl1 MyCntrl1
Height = 555
Left = 0
...
Begin Control2Lib.Cntrl2 MyNestedCntrl2
Height = 375
...
BeginProperty Font {aldfladlf-lsl-ladsjlfj}
...
EndProperty
End
EndThen the parser could tell me I have two controls (MyCntrl1, MyNestedCntrl2) and SHOW that MyNestedCntrl2 is nested inside MyCntrl1.
Examples:
Level ControlName
1.0 MyCntrl1
1.1 MyNestedCntrl2
2.0 MyCntrl2
2.1 Nested2_1
2.2 Nested2_2
3.0 MyCntrl3
3.1 Nested3_1
3.1.1 Nested3_1_1
3.1.1.1 Nested3_1_1_1
...XML example:
I am sure this is somewhere out on the Net where I can download, so can you point me to the place to research? Thank you much! JJ
-
Hi, i searched around the Net and Code Project for some existing parser, but so far unsuccessful. What I want to do is parse a Visual Basic .FRM (form) file and extract the control names defined within. I also want to determine if there are nested controls within. If possible, convert the listing and nested information into some format that can be easily worked with by other tools - like XML or some identifiable tree structure. For example (MyForm.frm):
Begin Control1Lib.Cntrl1 MyCntrl1
Height = 555
Left = 0
...
Begin Control2Lib.Cntrl2 MyNestedCntrl2
Height = 375
...
BeginProperty Font {aldfladlf-lsl-ladsjlfj}
...
EndProperty
End
EndThen the parser could tell me I have two controls (MyCntrl1, MyNestedCntrl2) and SHOW that MyNestedCntrl2 is nested inside MyCntrl1.
Examples:
Level ControlName
1.0 MyCntrl1
1.1 MyNestedCntrl2
2.0 MyCntrl2
2.1 Nested2_1
2.2 Nested2_2
3.0 MyCntrl3
3.1 Nested3_1
3.1.1 Nested3_1_1
3.1.1.1 Nested3_1_1_1
...XML example:
I am sure this is somewhere out on the Net where I can download, so can you point me to the place to research? Thank you much! JJ
First, not to piss on your parade route, but WHY? VB6 is long since dead and not supported by anyone any more. What tools do you think are going to want to know this stuff when nobody is developing new tools for VB6? Second, the FRM file is just a text file. There really isn't any parser out there that I can find (probably because VB6 has been outdated for 10 years now) Writing one should be pretty straight forward.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak -
First, not to piss on your parade route, but WHY? VB6 is long since dead and not supported by anyone any more. What tools do you think are going to want to know this stuff when nobody is developing new tools for VB6? Second, the FRM file is just a text file. There really isn't any parser out there that I can find (probably because VB6 has been outdated for 10 years now) Writing one should be pretty straight forward.
A guide to posting questions on CodeProject[^]
Dave KreskowiakTrue that, and that's basically why i want to achieve what I'm asking... I have some legacy application and there are some 3rd party controls that have long since been retired. I want a method to identify all the controls in my application and determine what needs attention. My take on this would be to write my own simple parser to:
1. search .FRM for "Begin" 2. for each "Begin", push onto a stack (var name, unique id, level++)
3. for each "End", pop from stack, print info (id++, level--, var name)(you can see my c++ tendencies) It seemed quicker to ask the community before setting off and writing. Cheers.
-
True that, and that's basically why i want to achieve what I'm asking... I have some legacy application and there are some 3rd party controls that have long since been retired. I want a method to identify all the controls in my application and determine what needs attention. My take on this would be to write my own simple parser to:
1. search .FRM for "Begin" 2. for each "Begin", push onto a stack (var name, unique id, level++)
3. for each "End", pop from stack, print info (id++, level--, var name)(you can see my c++ tendencies) It seemed quicker to ask the community before setting off and writing. Cheers.
The logic seems reasonable. I'd start writing because you'll probably spend just as much effort to find something that does it for you.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak