![]() |
|||||||
![]() |
Dfm2API Utility
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Component | Release | History | |
| Controls | |||
| 1 | Animate | 1.2 |
1.0 With data initialization |
| 2 | Bevel | 1.0 | 1.0 Supported through WM_PAINT message |
| 3 | BitBtn | 1.0 | 1.0 It does not exist a standard Glyph Button control. Will be substituted with an Uncommon Control |
| 4 | Button | 1.0 | 1.0 With data initialization |
| 5 | CheckBox | 1.0 | 1.0 With data initialization |
| 6 | ComboBox |
1.1 |
1.0 With data initialization 1.1 Better "height" property handling |
| 7 | DateTimePicker | 1.2.2 |
1.0 With data initialization (partial) |
| 8 | Edit | 1.0 | 1.0 With data initialization |
| 9 | GroupBox | 1.0 | 1.0 With data initialization |
| 10 | Header | 1.1 | 1.0 With data initialization (partial) 1.1 Better "width" property handling and added "Alignment" support |
| 11 | HotKey | 1.0 | 1.0 Only Resource Script File |
| 12 | Image | 1.2.2 | 1.0 With data initialization (partial) 1.2.2 Added Stretch property (processed through WM_PAINT message) 1.2.2 Added transparencies (white color mapped to transparent) |
| 13 | ImageList | 1.2 |
1.1 I have finally discovered how the data are stored!!! Coming
soon!!!! |
| 14 | Label | 1.0 | 1.0 With data initialization |
| 15 | ListBox | 1.1 | 1.0 With data initialization 1.1 Better "height" property handling |
| 16 | ListView | 1.2 |
1.0 With data initialization (partial: columns text but not items
text) |
| 17 | Memo | 1.0 | 1.0 With data initialization |
| 18 | MonthCalendar | 1.2.2 | 1.0 With data initialization (partial) 1.2.2 Improved data initialization |
| 19 | PageControl | 0.0 | OK, sooner or later I will do it! I've received so many E-Mails asking for it, that now I know that I MUST do it. |
| 20 | Panel | 1.0 | 1.0 With data initialization |
| 21 | ProgressBar | 1.0 | 1.0 With data initialization |
| 22 | RadioButton | 1.0 | 1.0 With data initialization |
| 23 | RadioGroup | 1.0 | 1.0 With data initialization |
| 24 | RichEdit | 1.0 | 1.0 With data initialization |
| 25 | ScrollBar | 1.2.2 | 1.0 With data initialization 1.2.2 Improved data initialization (range and border) |
| 26 | SpeedButton | 1.0 | 1.0 With data initialization |
| 27 | SpinEdit | 1.0 | 1.0 With data initialization |
| 28 | StatusBar | 1.0 | 1.0 With data initialization (partial) 1.1.1 Fixed bug with "deleted" panels |
| 29 | ToolBar | 1.0 | 1.0 Only Resource Script File |
| 30 | TabControl | 1.2.2 | 1.0 With data initialization (partial) 1.2 Added (simplified) ImageList support!! 1.2.2 Improved tab size |
| 31 | TrackBar | 1.2.2 | 1.0 With data initialization 1.2.2 Improved (ThumbLength, Line and Page properties handling added) |
| 32 | TreeView | 1.2 |
1.0 Only Resource Script File |
| 33 | UpDown | 1.0 | 1.0 With data initialization (partial) 1.1.1 (build 111) New bug added!! (Fixed in next release). Will cause wrong alignment. |
| Menus | |||
| 34 | MenuItem | 1.0 | 1.0 With "response table" |
| 35 | MainMenu | 1.0 | 1.0 With "response table" |
| 36 | PopupMenu | 1.0 | 1.0 With "response table" |
| Common Dialogs | |||
| 37 | FontDialog | 1.0 | 1.0 With data initialization (partial) In progress: LogFont data initialization |
| 38 | FindDialog | 1.1 | 1.0 With data initialization (partial) 1.1 With complete data initialization |
| 39 | ReplaceDialog | 1.1 | 1.0 With data initialization (partial) 1.1 With complete data initialization |
| 40 | ColorDialog | 1.1 | 1.0 With data initialization (partial) 1.1 With improved data initialization |
| 41 | OpenDialog | 1.1 | 1.0 With data initialization (partial) 1.1 With complete data initialization |
| 42 | SaveDialog | 1.1 | 1.0 With data initialization (partial) 1.1 With complete data initialization |
Note that not all the properties are converted into resources/ line of
code, but I think that the most important ones are treated.
Imagine that you need to design a DialogBox for a MFC, OWL or WinAPI application. What you have to do is simply to design it as a VCL Form, and then convert it with the Dfm2API utility. You’ll obtain an .RC file, that’s (more or less) exactly what you need (a resource script file, defined at the OS level), and a .CPP and .HPP file. The .RC file contains all the statements that are required to generate a .RES file that can be linked to a Win32 module, while the .CPP and .HPP files are responsible to create the proper DIALOGPROC and to initialize the controls that populates the DialogBox (this second steps is done for WinAPI applications). You can see an example here.
These are some suggestions:
1) Buy C/C++ Users Journal August 2000 issue, for several reasons:
a. There is an explanation
of the code that you can download from http://www.cuj.com/
b. It is important to read
papers that treats VCL
c. You make me happy
2) Submit some code (that you just can download from CUJ site
3) Find bugs
4) Send me a lot of money
5) Go to the survey page
If you design a form like the following one (click over the image to see it at full size):
and then you convert it with Dfm2API (release 1.2.1), you’ll obtain the following DialogBox (click over the image to see it at full size):
As you can see, even if there are small differences, they are quite similar. Also a lot of controls are initialized, with no need to write code, because Dfm2API did it for you. The main differences are:
The jumping red animal is an Animation control captured in a different
frame with respect to the previous one. So, the behaviour is correct!
Despite these differences (some of them are already fixed or will be soon),
I think that this tool does much more than one could expect. I've received
so many E-Mails that I'll surely continue to develop and update it (also
because I'm using it everyday, also with different releases, such as the
VCL2OWL one!). Anyway, I haven't received any code proposal, and for this
reason I don't think that I'll release the sources any more.
Click here to give a look at the automatically generated source code file from the proviously described Form (release 1.0).
|
Version
|
Build
|
Date
|
Description
|
|
1.2.2
|
164
|
28 September 2001
|
Partially updated the engine to support more features. Improved Animate, Image, DateTimePicker and MonthCalendar controls. Fixed Form automatic resizing. It's a minor release, but I wanted to give the idea that I'm still working on it. As I've done some changes to the engine, let's consider it a release candidate (more than a beta). There are some menu items that are disabled because I'm still working on them. Anyway, there are some interesting new features that someone asked me, so I decided to release it. |
|
1.2.1
|
160
|
10 May 2001
|
Fixed minor bugs, improved (not completed) compatibility with VisualC and Windows CE. Improved UNICODE support. |
|
1.2.0
|
153
|
17 January 2001
|
Fixed minor bugs, support for ImageLists in TreeViews,
ListViews and TabControls. Improved ListView and TreeView behavior. Fixed minor bug with TStatusBar. New user interface (it's just the beginning). Added preview window for some controls. Improved Form automatic resizing options |
|
1.1
|
65
|
28 December 2000
|
Added support for C++ Builder 5 and Delphi 5. Improved support for Common Dialogs. Minor changes. I'm actually debugging a major upgrade. I hope to have time to release it in late January. |
|
1.0
|
1
|
1 August 2000
|
Released with source code to C/C++ Users Journal. |
The project with the source code relative to release 1.0 is available
at CUJ site.
You can download the main releases here.
I've almost fixed the overall Form resizing: the default one generates
DialogBoxes whose size differs from the original Form by less than 0.4%.
As you probably know VCL Forms use a different sizing approach with respect
to SDK DialogBoxes. I think I have understood the reason of the few remaining
pixels. You can, of course, adapt the resizing feature at your wish, thus
getting the best results. Actually I've improved VisualC compatibility
and UNICODE and Windows CE support (since 1.2.1). I'm also
working on the automatic generation of simple example programs for BCB,
VC and GCC and more aspects related to UI.
I'm also working at PropertyPages and PageControls. (~1.5.0)
© Copyright (2000), Luigi Bianchi
Last Update:
September 28, 2001