Leemi
Mon May 02 16:26:42 CDT 2005
Hi SJT:
No, I do not have any samples of a VFP exe responding to a VB .Net event.
If no one on this forum has any examples, you might try posting this
question to the VFP user group on www.universalthread.com. You have to
sign up for membership (it is free), and then you can post the question.
BTW, have you tried placing SYS(1104) function in the VFP code before and
after calling the VB. Net object? It might help.
This posting is provided "AS IS" with no warranties, and confers no rights.
Sincerely,
Microsoft FoxPro Technical Support
Lee Mitchell
*-- VFP9 HAS ARRIVED!! --*
Read about all the new features of VFP9 here:
http://msdn.microsoft.com/vfoxpro/
*--Purchase VFP 9.0 here:
http://www.microsoft.com/PRODUCTS/info/product.aspx?view=22&pcid=54787e64-52
69-4500-8bf2-3f06689f4ab3&type=ovr
Keep an eye on the product lifecycle for Visual FoxPro here:
http://support.microsoft.com/default.aspx?id=fh;[ln];lifeprodv
- VFP5 Mainstream Support retired June 30th, 2003
- VFP6 Mainstream Support retired Sept. 30th, 2003
>Lee,
>I have tried this in both VFP7 and VFP9 and both exhibit the same behavior.
>In VFP I am using the following code behind a simple form button to
>instantiate the vb.net form:
>PUBLIC x,frmShell as "testfoxclass2.frmshell",oEvents
>x=CREATEOBJECT("testfoxclass2.frmshell")
>frmShell=x.ReturnForm
>frmshell.show
>DO setevents
>Testfoxclass2 is a vb.net class with one form object. The returnform
>function just returns the .net form's object. In the .net form I raise an
>event in the form_closing method that the follwoing code in VFP responds
to.
>This is the code in the setevents.prg noted above.
oEvents = NEWOBJECT("myclass")
zz = EVENTHANDLER(frmShell, oEvents)
RETURN
DEFINE CLASS myclass AS session OLEPUBLIC
IMPLEMENTS IJEEvents IN "c:\documents and settings\thompssj\my
documents\visual studio projects\testfoxclass2\bin\testfoxclass2.tlb"
PROCEDURE IJEEvents_ShellClosed() AS VOID
frmshell = .NULL.
RELEASE frmshell
x=.NULL.
RELEASE x
oevents = .NULL.
RELEASE oevents
ENDPROC
PROCEDURE IJEEvents_ButtonClicked() AS VOID
MESSAGEBOX(".net form button clicked")
ENDPROC
PROCEDURE IJEEvents_RunForm() AS VARIANT
* add user code here
ENDPROC
ENDDEFINE
>I have run this through the VFP debugger and it is dropping into the
>>IJEEvents_ShellClosed() procedure in VFP just fine. I seem to be
releasing
>all the objects, but the VFP exe still errors upon exit.
>Seems like I must be missing somthing somewhere. Any samples anywhere of a
>VFP exe responding to a vb.net event?
>"Lee Mitchell" wrote:
> Hi SJT:
>
> What version of VFP are you using? Do you have the most recent VFP
Service
> Pack installed?
>
> I hope this helps.
>
> This posting is provided "AS IS" with no warranties, and confers no
rights.
>
> Sincerely,
> Microsoft FoxPro Technical Support
> Lee Mitchell
>
> *-- VFP9 HAS ARRIVED!! --*
> Read about all the new features of VFP9 here:
>
http://msdn.microsoft.com/vfoxpro/
>
> *--Purchase VFP 9.0 here:
>
http://www.microsoft.com/PRODUCTS/info/product.aspx?view=22&pcid=54787e64-52
> 69-4500-8bf2-3f06689f4ab3&type=ovr
>
> Keep an eye on the product lifecycle for Visual FoxPro here:
>
http://support.microsoft.com/default.aspx?id=fh;[ln];lifeprodv
> - VFP5 Mainstream Support retired June 30th, 2003
> - VFP6 Mainstream Support retired Sept. 30th, 2003
>
> >I am getting a dreaded C000005 at address 79221bd8 after running a
simple
> vfp
> >exe that opens a simple .net form and responds to an simple event. The
> event
> >is being handled fine by VFP, but upon exit the windows error is
> displayed.
> >What is strange is that when this simple app runs in the VFP IDE it
works
> >just fine. No errors. Running it standalone produces the error.
>
> >Does anyone here have some experience/sample code in responding to a
> vb.net
> >dll's events in a VFP executable? I would sure appreciate some help
here.
> >Again the code is working just fine; .net dll is being created and .net
> form
> >is running in new thread, I am implementing an eventhandler in VFP
> correctly
> >since the event fired by the .net form is being responded to by VFP. It
> just
> >blows when exiting back to Win XP.
>
> >Thanks.
> >SJT