Generate DataFlex source for ActiveX controls via Command Lineby Wil van Antwerpen
Created: 2016-04-05
The problemif you happen to be one of those persons that develops ActiveX controls and consume those from within DataFlex then you probably recognize the following work flow.
What's wrong with that you might wonder? Well.. if you forget to close the DataFlex Studio then new changes made to your control are -for whatever reason- missed. Yep, you'll end up wondering why it didn't see the change. Next locating your control in that List isn't exactly easy as they tend to be very long and there's no search function built into it. The command line versionSo what did I do? The way that the Studio generates the source for your ActiveX controls is actually done via .... wait for it .... Com Automation. You can find it in your list of Com Automation controls in the Studio. It is called "DataFlex COM Class Generator" and is supplied to you via the comclsgen.dll in your DataFlex Studio bin folder. You have to generate the DataFlex source of that automation control yourself. The reason is that this class generator is VERSION specific. So you should only generate classes for the same DataFlex version. With that generated ComClsGen.pkg file in hand you can then compile the command line version of the program I attached to this post. You use the program like follows: ComCLSGenCLI.exe MyControl.ocx "C:\DataFlex Projects\Demo Application\AppSrc\cComMyControl.pkg" As a result you can now trigger generating the new DataFlex package source in your building events from the tools that you build the ActiveX in. Download![]() FAQQ. I tried to compile the tool, but I am missing the package ComClsGen.pkg so cannot compile. A. Correct, the Com Class generator is a DataFlex version specific control, so I cannot supply the package. You have to generate it yourself. For that go to
Q. My com control generates multiple classes. Something goes wrong with the naming of some of those classes. A. Yes, that's a known issue. So far I really only needed to generate 1 class and have not added the code to handle multiple classes. Quick testing however showed that it sometimes actually works fine. If not then look at the line: // If you have more as one class in here you want to adjust it! Move (sClassPrefix+sClassNames) to sClassNames Check what is in the sClassNames variable and adjust the values to your needs. Q. I developed a COM Automation control and it doesn't work? A. Note that this tool was built for ActiveX controls, not automation controls. And as it was made very quickly for my own use, it is not as extensive as it could have been. So at the moment it only enumerates the list of controls that you would see in the Studio under "Import COM ActiveX" not "Import COM Automation". It is easy enough to change though. Just change the line: Move OLELibTypeControl to ControlType into: Move OLELibTypeAutomation to ControlType and it should work for automation controls. ForumRelevant threads at the forum are: http://support.dataaccess.com/Forums/showthread.php?57440-Fully-automated-COM-class-generation and http://support.dataaccess.com/Forums/showthread.php?58642-Generate-DataFlex-source-for-ActiveX-control-via-Command-Line |
|||||||||||
Copyright © 1999 - 2025 VDF-GUIdance on all material published, for details see our Disclaimer. |