-
May 30th, 2023, 05:15 AM
#1
Thread Starter
Frenzied Member
[RESOLVED] Parse Frm&Frx and display UI elements dynamically on a VB6-Form
I'm working on a FormViewer that parses Frm&Frx and displays UI elements(controls) dynamically on a VB6-Form. Even third-party controls can be parsed and displayed on the Form. The display looks exactly the same as VB6-IDE's FormDesigner. I know it's not an easy thing to do, I'd like to get some ideas or tips from the forum. Any advice and guidance would be appreciated.
Recently, I have some trouble surfing the Internet, so I may not be able to reply to the information of the forum in time, but I can use my phone to browse some forum information.
Last edited by SearchingDataOnly; May 31st, 2023 at 06:03 AM.
-
May 30th, 2023, 08:38 AM
#2
Re: Parse Frm and Frx and display UI elements in a running VB6-Form
Hello SDO,
This is something I've tried to do a few times, and failed. Also, in the past, LaVolpe tried to do it, and I don't believe he ever succeeded.
Let me summarize, in my words, what I think you're asking: While running (possibly either IDE or compiled), you'd like to get the "initial" property settings of a form in the project. In other words, you'd like to "get" the properties seen in the IDE while in design-time (but while we're running).
They're certainly there. Otherwise, how would the form know how to position and size itself when loading (and set any/all other properties)? So, they're obviously somewhere.
The problem is, I've never seen anyone "fetch" them.
Now, just to be clear, we're not talking about something like: Form1.Left or Form1.Width, etcetera.
Sure, if they haven't been changed, those can certainly "get" them. But, if they've been changed in code, then fetching the properties like that are not what will be in the design-time properties window. So, where are those "initial" properties? IDK, and I'd love to know how to fetch them.
------------------
LaVolpe tried to figure this out when he was working on dynamic DPI-aware stuff, trying to re-size the forms when DPI was changed in Windows. His problem was, if we're going back to 100%, he'd rather use those "initial" sizes, and not some resized values, to avoid rounding errors when going back and forth.
------------------
Personally, I can think of several good uses for them ... possibly allowing a "reset" button on a form that is sizable, but also with an initial size that makes sense for certain things. Sure, in that instance, I could just save the initial size, but it's already saved somewhere, but not a place I know how to get it from.
-------------------
And sure, we could write some class that fetches all the properties during load, and then we could "attach" that class to every form. But again, that just seem like bloat, when the information is already there somewhere.
-------------------
ADDED: And basically, it's the same problem when thinking about controls. Light-weight controls may be even more difficult.
Last edited by Elroy; May 30th, 2023 at 09:05 AM.
Any software I post in these forums written by me is provided "AS IS" without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. To all, peace and happiness.
-
May 30th, 2023, 11:14 AM
#3
Hyperactive Member
Re: Parse Frm and Frx and display UI elements in a running VB6-Form
sorry I misunderstood
I am very interested in your projects, hopefully it will take a little while
-
May 30th, 2023, 11:41 AM
#4
Re: Parse Frm and Frx and display UI elements in a running VB6-Form
twinbasic,It can import the VB6 project, indicating that it has solved the problem.If you try to send him an email, can he send you some code?
-
May 30th, 2023, 11:44 AM
#5
Re: Parse Frm and Frx and display UI elements in a running VB6-Form
It has always been imitated and never surpassed.
-
May 31st, 2023, 06:18 AM
#6
Thread Starter
Frenzied Member
Re: Parse Frm and Frx and display UI elements in a running VB6-Form
Originally Posted by Elroy
Hello SDO,
This is something I've tried to do a few times, and failed. Also, in the past, LaVolpe tried to do it, and I don't believe he ever succeeded.
Let me summarize, in my words, what I think you're asking: While running (possibly either IDE or compiled), you'd like to get the "initial" property settings of a form in the project. In other words, you'd like to "get" the properties seen in the IDE while in design-time (but while we're running).
They're certainly there. Otherwise, how would the form know how to position and size itself when loading (and set any/all other properties)? So, they're obviously somewhere.
The problem is, I've never seen anyone "fetch" them.
Now, just to be clear, we're not talking about something like: Form1.Left or Form1.Width, etcetera.
Sure, if they haven't been changed, those can certainly "get" them. But, if they've been changed in code, then fetching the properties like that are not what will be in the design-time properties window. So, where are those "initial" properties? IDK, and I'd love to know how to fetch them.
------------------
LaVolpe tried to figure this out when he was working on dynamic DPI-aware stuff, trying to re-size the forms when DPI was changed in Windows. His problem was, if we're going back to 100%, he'd rather use those "initial" sizes, and not some resized values, to avoid rounding errors when going back and forth.
------------------
Personally, I can think of several good uses for them ... possibly allowing a "reset" button on a form that is sizable, but also with an initial size that makes sense for certain things. Sure, in that instance, I could just save the initial size, but it's already saved somewhere, but not a place I know how to get it from.
-------------------
And sure, we could write some class that fetches all the properties during load, and then we could "attach" that class to every form. But again, that just seem like bloat, when the information is already there somewhere.
-------------------
ADDED: And basically, it's the same problem when thinking about controls. Light-weight controls may be even more difficult.
The information you provided is very useful, thank you very much, Elroy.
I modified my question:
Parse Frm&Frx and display UI elements dynamically on a VB6-Form.
IMO, if I can parse the contents of the Frx file exactly correctly, then I should be able to find a way to complete my project.
Olaf seems to have written a class cParseFRX, but I haven't tested it yet. You also seem to have written a tool for parsing Frx, and when I find it, I'll test it carefully.
As xiaoyao said, since twinBasic can convert VB6 projects 100%, it means that there must be a way to solve my problem, and I'll continue to explore all possible solutions.
Last edited by SearchingDataOnly; May 31st, 2023 at 06:23 AM.
-
May 31st, 2023, 08:23 AM
#7
Re: Parse Frm and Frx and display UI elements in a running VB6-Form
Originally Posted by SearchingDataOnly
As xiaoyao said, since twinBasic can convert VB6 projects 100%, it means that there must be a way to solve my problem, and I'll continue to explore all possible solutions.
I almost responded to this when he said it. But converting source code vs digging out compiled properties of an executable are two very different things.
--------------------
Also, a FRX file is just binary data associated with a FRM file. The offsets into the FRX file for those binary chunks are in the FRM file. That binary data can be pretty much anything.
Last edited by Elroy; May 31st, 2023 at 08:26 AM.
Any software I post in these forums written by me is provided "AS IS" without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. To all, peace and happiness.
-
May 31st, 2023, 08:56 AM
#8
Re: Parse Frm&Frx and display UI elements dynamically on a VB6-Form
I read a forum on a Russian website today.They said that the source code of VB6 is estimated to be 600,000 lines.So it should not be easy to achieve.
-
Jun 2nd, 2023, 11:02 PM
#9
Thread Starter
Frenzied Member
Re: Parse Frm and Frx and display UI elements in a running VB6-Form
Originally Posted by Elroy
I almost responded to this when he said it. But converting source code vs digging out compiled properties of an executable are two very different things.
--------------------
Also, a FRX file is just binary data associated with a FRM file. The offsets into the FRX file for those binary chunks are in the FRM file. That binary data can be pretty much anything.
Thank you, Elroy.
I found your thread 'Structure of FRX files', and I found Olad and DreamManor's thread in your thread. I have a memory like a fish.
However, it doesn't seem like an easy task to dynamically display ActiveX UI elements on a VB6-Form.
Last edited by SearchingDataOnly; Jun 2nd, 2023 at 11:07 PM.
-
Jun 6th, 2023, 04:01 AM
#10
New Member
Re: [RESOLVED] Parse Frm&Frx and display UI elements dynamically on a VB6-Form
from MSDN library for vb.forms(object)
For Each Control in Form1.Controls
Control.Visible = False
Next Control
So using this logic, you could pull the properties using something like this.
-
Jun 12th, 2023, 02:51 AM
#11
New Member
Re: [RESOLVED] Parse Frm&Frx and display UI elements dynamically on a VB6-Form
Code:
Private Sub Timer1_Timer()
Debug.Print Me.Name
Dim Ctrl As Control
For Each Ctrl In Form1.Controls
Debug.Print "Control Name : " & Ctrl.Name & vbCrLf & "["
On Error Resume Next
Debug.Print "Left : " & Ctrl.Left
On Error Resume Next
Debug.Print "Top : " & Ctrl.Top
On Error Resume Next
Debug.Print "Height : " & Ctrl.Height
On Error Resume Next
Debug.Print "Width : " & Ctrl.Width
On Error Resume Next
Debug.Print "Value : " & Ctrl.Value
On Error Resume Next
Debug.Print "Text : """ & Ctrl.Text & """"
Next Ctrl
End Sub
-
Jun 12th, 2023, 04:24 AM
#12
Re: [RESOLVED] Parse Frm&Frx and display UI elements dynamically on a VB6-Form
The question was about parsing the *.FRM and .FRX, not about getting the properties during runtime
-
Jun 12th, 2023, 11:03 PM
#13
Re: [RESOLVED] Parse Frm&Frx and display UI elements dynamically on a VB6-Form
twinbasic addin by vbs,vb6 · Issue #1094 · twinbasic/twinbasic
https://github.com/twinbasic/twinbasic/issues/1094
I don't know when your script IDE can be tested publicly. It's time to give it a name. It's also a good mode for people to use while developing.
-
Jun 15th, 2023, 08:54 AM
#14
Thread Starter
Frenzied Member
Re: [RESOLVED] Parse Frm&Frx and display UI elements dynamically on a VB6-Form
Originally Posted by xiaoyao
I don't know when your script IDE can be tested publicly. It's time to give it a name. It's also a good mode for people to use while developing.
My FormDesigner is still 3 weeks away from completion. After that, I'll start developing the Code-Debugger. Once this is done, I'll release the first beta version for my scripting language IDE. I hope to achieve this goal by the end of this year.
Last edited by SearchingDataOnly; Jun 15th, 2023 at 08:59 AM.
-
Jun 15th, 2023, 12:04 PM
#15
Re: [RESOLVED] Parse Frm&Frx and display UI elements dynamically on a VB6-Form
Originally Posted by SearchingDataOnly
My FormDesigner is still 3 weeks away from completion. After that, I'll start developing the Code-Debugger. Once this is done, I'll release the first beta version for my scripting language IDE. I hope to achieve this goal by the end of this year.
i hope to try next week,can test some
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|