Quantcast
Channel: Visual COBOL - Forum - Recent Threads
Viewing all articles
Browse latest Browse all 4356

RE: CCW type project, can also be called from Managed?

$
0
0

It is actually much easier to call the managed WinForm app from another managed program as you do not go through the extra COM Interop layer.

Add a new managed console project to your ManWin1 solution called ManCon1 and add a reference to the ManWin1 project by right-clicking on References-->Add Reference then choose Solution and select the ManWin1 project and save.

Then paste the following code into the new Program1.cbl that was created.

       program-id. Program1 as "ManCon1.Program1".

       data division.
       working-storage section.
       01  junk                        pic x(01).
       01  anInstance     type ManWin1.vcClass.
       01  passed-info.
           05  passed-info-1           pic x(20).
           
       procedure division.

           display spaces upon crt.
           display "ManCon1 managed Console Program..." at 0303.
           display
            "...calling (invoking class method in) ManWin1..." at 0503.
       
           set anInstance to new ManWin1.vcClass
           move "this is passed info" to passed-info.
           invoke anInstance::method1(passed-info)
           
           
           display "...back from ManWin1..." at 0703.
           display "Press Enter to exit..."  at 0803.
           accept junk at 0903.
           
           goback.

       end program Program1.

Viewing all articles
Browse latest Browse all 4356

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>