local lox, llerror, lcerror llerror = .F. lcerror = on('error') on error llerror = .T. lox = getobject(,'MyCOMSrv.svcomm') if !empty(lcerror) then on error &lcerror endif if llerror then * we couldn't get a currently running instance of SVCOMM so * we need to create one lox = createobject('MyCOMSrv.svcomm') endif if vartype(lox) = "O" then lox.StartEXE() endifWhat this does is make sure if a user runs the application the an instance of the class is created and added to the Running Object Table (ROT) (see Note below). If you have code as you had then an instance is not created and you need to use CreateObject. This creates a spearate instance and the two do not communicate.
define class svcomm as custom olepublic oFormRef = .NULL. procedure startexe if isnull(THIS.oFormRef) then do form sv_test.scx name THIS.oFormRef linked read events else THIS.oFormRef.Show() endif endproc enddefineThis adds an object to the form to a property of your class. If one already exists because someone already created the COM object and ran the StartEXE method, then it simply displays the same form again. The point here is that if a user inputs something into the form, the same information is accessible via object.oFormRef.Control.Value in your code. You can then change it via code and the user will see the changed values on the displayed form.