** This is a simple example DLL for use ** with the BASICSAMPLE.PRG file. ** Example Usage: ** loDLL = CREATEOBJECT("sample.EasyMTServer") ** loDLL.SomeLengthyProcess(_VFP) ** Note: You could also use the following ** in the event the DLL is not registered ** (assuming sample.dll exists in your path) ** loDLL = NEWOBJECT("EasyMTServer","sample.dll") DEFINE CLASS EasyMTServer As Session OLEPUBLIC PROCEDURE SomeLengthyProcess (toCallback) ** We'll declare the Windows API Sleep ** function, so we can ensure the ** process runs for 20 seconds. DECLARE Sleep IN WIN32API Long ** Create a variable for ** our FOR/ENDFOR loop. LOCAL lnCount As Integer ** Print a string to the main VFP window. FOR lnCount = 1 TO 20 ** Create a SYS(2015) value, and ** print it back to the VFP window. toCallback.DoCmd("? + ALLTRIM(SYS(2015))") ** Let's sleep for 1 second Sleep(1000) ENDFOR ** Write out a Done! toCallback.DoCmd("? + 'Done!'") CLEAR DLLS "Sleep" ENDPROC ENDDEFINE
From novice to tech pro — start learning today.