vbadelphicode-conversion

VBA object to delphi declaration


I have the below VBA code from a vendor website. I managed to import the TLB libraries into a Delphi project and made references to the corresponding unit files. However, I'm struggling to convert the below VBA specific object declaration to Delphi. How do I do this?

Dim app As Attachmate_Reflection_Objects_Framework.ApplicationObject
Dim terminal As Attachmate_Reflection_Objects_Emulation_IbmHosts.ibmTerminal
Dim view As Attachmate_Reflection_Objects.view
Dim frame As Attachmate_Reflection_Objects.frame
          
Set app = GetObject("Reflection Workspace")
      
'Get handles to the frame, view, and terminal objects
Set frame = app.GetObject("Frame")

Set view = frame.SelectedView
Set terminal = view.Control

Solution

  • At the end of the Generated Typelibrary is normally a Section with Co Classes. This are the ones you can Use the replace the

    Set app = GetObject("Reflection Workspace")
    

    with something like:

    MyDelphiComClass := CoReflection_Workspace.Create;
    

    i did not read it, but this seems to have some knowledge in it:Building a COM Client Application

    At a first glance it looks somewhat complete.