Results 1 to 4 of 4

Thread: Com Automation Newbie

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Mar 2009
    Posts
    1,425

    Default Com Automation Newbie

    Just trying to learn a new skill. I would like to learn how to create a com automation (Dynamic DLL) and static dll that can be called from Dataflex. I have no experience in this area (C++ or dlls). I have downloaded Visual Studio 2019 and have worked through some basic examples from the internet on creating dlls. I have been working with the example in the Dataflex Reports for ELFs and have that working (with a minor problem posted in Reports). Does anyone have a sample of a simple com automation that they could send that I could look at in the Visual Studio and documentation that may help me understand all the settings and components that are needed? How about examples on the internet? However, I would need to know how to apply it to Dataflex.

    Also, should the ELFs (statically linked dlls) created for Dataflex Reports be able to be used in Dataflex with "External_Function"? When I tried it an error is generated indicating that there is "an invalid number of parameters".

    Thanks for any help you can provide. Always trying to improve my knowledge.

  2. #2
    Join Date
    Feb 2009
    Location
    South Florida
    Posts
    4,727

    Default Re: Com Automation Newbie

    DF dynamically links DLLs not statically.

    generally when you get the error on invalid number of arguments it means you are trying to use a DLL with the incorrect calling convention (if the parameters are defined correctly)
    Michael Salzlechner
    StarZen Technologies, Inc
    http.://www.starzen.com

    Development Blog
    http://www.salzlechner.com/dev

    DataFlex Package Manager (aka Nuget for DataFlex)
    http://windowsdeveloper.com/dfPackage

  3. #3
    Join Date
    Mar 2009
    Posts
    1,425

    Default Re: Com Automation Newbie

    For the ELF in the Dataflex Reports you must 'Use MFC in a static library" on the option "Use of MFC"' according to the example. Is this different?

    These are the ones that are generating the invalid number of parameters when trying them with the "External_Function" in DF. These functions use the standard calling convention.

  4. #4
    Join Date
    Feb 2009
    Location
    South Florida
    Posts
    4,727

    Default Re: Com Automation Newbie

    as far as DLLs if you use STDCALL calling convention it will work with all versions of DF

    you also have to watch parameter data types so they match properly. memory allocation is another thing to keep in mind. having a DLL function that passes a string back generally involves the calling code to reserve the block of memory and the DLL to copy data to that block and possibly return a size of the data returned but these things depend a lot on what you need

    COM components (active x controls or automation objects) are a bit easier. build a COM control and register it and then have DF import it.
    DF also has limitations in terms of data types but most of the generic types are supported
    Michael Salzlechner
    StarZen Technologies, Inc
    http.://www.starzen.com

    Development Blog
    http://www.salzlechner.com/dev

    DataFlex Package Manager (aka Nuget for DataFlex)
    http://windowsdeveloper.com/dfPackage

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •