Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Feedback
Message
 
To
10/06/2004 14:00:03
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Title:
Miscellaneous
Thread ID:
00910724
Message ID:
00912636
Views:
11
Sylvain,
Thanks for following up. You mentioned this may also be ported to the internet in the future. If you compile the code into a vfp mtdll and call from ASP.NET or ASP, everything should work except the VFP Timer. However, we did find a replacement Timer that does work in VFP mtdlls. It was created by MSMVPs, is free, and is at:
http://download.com.com/3000-2401-889219.html?tag=lst-0-1
You should just be able to replace the vfp timer with the new timer...

>To do a quick follow-up, I finally incorporated your code in my project and it works like a charm. Thanks again for your help.
>
>>Try this on:
>>&& server objects (compile into COM-Exe)
>>
>>DEFINE CLASS oTestServer AS Session OLEPUBLIC
>>
>>    loCallback = .NULL. && saves reference to callback object
>>    lAdvised = .F. && is callbackobject set?
>>    HIDDEN loTimer
>>
>>    FUNCTION Init
>>	DECLARE INTEGER Sleep IN WIN32API INTEGER		
>>	THIS.loTimer = CREATEOBJECT('dirTimer',THIS)
>>    ENDFUNC
>>
>>    FUNCTION Destroy
>>	THIS.loTimer = NULL
>>	CLEAR DLLS	
>>   ENDFUNC
>>
>>   FUNCTION FireEvent AS VOID
>>      LPARAMETERS lcSomeValue
>>      IF THIS.lAdvised
>>         THIS.loCallBack.EventMethod(lcSomeValue)
>>      ENDIF
>>   ENDFUNC
>>
>>   FUNCTION Advise AS VOID
>>      LPARAMETERS loObj
>>      THIS.loCallback = loObj
>>      THIS.lAdvised = .T.
>>   ENDFUNC
>>
>>   FUNCTION UnAdvise AS VOID
>>      THIS.loCallback = .NULL.
>>      THIS.lAdvised = .F.
>>   ENDFUNC
>>
>>   FUNCTION SomeMethodThatFiresEvents AS Boolean
>>        && prepare something
>>        THIS.FireEvent('Task startet .. ')
>>        Sleep(5000)
>>        THIS.FireEvent('Task finished X percent ..')
>>        Sleep(5000)
>>        && do more
>>        THIS.FireEvent('Task fineshied XX percent ..')
>>        && ..
>>    ENDFUNC
>>
>>    FUNCTION DoSomeAsynWork AS Boolean
>>    	THIS.loTimer.Interval = 1
>>	RETURN .T.
>>    ENDFUNC
>>
>>ENDDEFINE
>>
>>DEFINE CLASS dirTimer AS Timer
>>
>>	Interval = 0
>>	loParent = NULL
>>
>>	FUNCTION Init
>>		LPARAMETERS loObj
>>		THIS.loParent = loObj
>>	ENDFUNC
>>
>>	FUNCTION Destroy
>>		THIS.loParent = NULL
>>	ENDFUNC
>>
>>	FUNCTION Timer
>>		THIS.Interval = 0
>>                && do some work
>>                Sleep(1000) && sleep to simulate some work ..
>>		THIS.loParent.FireEvent('Timer Fired')
>>	ENDFUNC
>>
>>ENDDEFINE
>>
>>&& client testprogram
>>startprocess.prg:
>>
>>PUBLIC loFoxServer, loEventhandler
>>
>>loFoxServer = CREATEOBJECT('testcom1.oTestServer')
>>loEventHandler = CREATEOBJECT('oTestCallback')
>>
>>loFoxServer.Advise(loEventHandler)
>>
>>DEFINE CLASS oTestCallback AS Session OLEPUBLIC
>>
>>    FUNCTION EventMethod
>>        LPARAMETERS lcSomeParam
>>        ? lcSomeParam
>>    ENDFUNC
>>
>>ENDDEFINE
>>
>>startasyn.prg:
>>
>>?loFoxServer.DoSomeAsynWork() && returns immediately ..
>>
>>&& simulate block situation
>>DECLARE INTEGER Sleep IN WIN32API INTEGER
>>Sleep(15000) && the event of ther server is fired when this runs
>>
>>
>>endprocess.prg:
>>
>>loFoxServer.Unadvise()
>>loFoxServer = NULL
>>loEventhandler = NULL
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform