Hi Borislav, Thabks for your reply.
I'd be a bit reluctant to try an 'unusual' solution.
Is there some inherent problem in using Ocx in a pgr file.
Do they have to be used on a form.
If this is rhe case, I could instantiate a form in a Prg file but just never show it ??
Regards,
Gerard
>>hI bORISLAV
>>Ver 8
>>Regards,
>>Gerard
>>
>>
>>>>Hi.
>>>>I want to use an OCX in a .prg file (specifically Mscomm32.ocx)
>>>>All examples that I have seen use the Addobject to add it to a form.
>>>>Can I use this in a Prg file.... and would apprciate any pointers at to the syntax of the command
>>>>Tanks in advance
>>>>Regards,
>>>>Gerard
>>>
>>>What version of VFP?
>
>Try:
>
>
>x = NEWOBJECT("myclass")
>y = CREATEOBJECT([MSCommLib.MSComm])
>EVENTHANDLER(y,x)
>
>
>
>
>DEFINE CLASS myclass AS session OLEPUBLIC
>
> IMPLEMENTS DMSCommEvents IN "c:\windows\system32\mscomm32.ocx"
>
> PROCEDURE DMSCommEvents_OnComm() AS VOID;
> HELPSTRING "Occurs whenever the value of the CommEvent property changes."
> * add user code here
> ENDPROC
>
>ENDDEFINE
>
>
>Never tested such approach though.