PARAMETERS iFilename,oFilename,RCNON, iThreadNum >LOCAL lcDllName > >* Other code goes here > >lcDllName = "ps2pdf-" + TRANSFORM(iThreadNum) + ".dll" >IF NOT FILE(lcDllName) > lcDllName = "ps2pdf.dll" && Fallback on original DLL if we're past our copies >ENDIF > >* Declare the functions >DECLARE INTEGER _apCreate@0 IN (lcDllName) AS apCreate >DECLARE _apClose@4 IN (lcDllName) AS apClose INTEGER id >DECLARE INTEGER _apConvert@4 IN (lcDllName) AS apConvert INTEGER id >DECLARE INTEGER _apSetFunc@24 IN (lcDllName) AS apSetFunc INTEGER id, INTEGER code, INTEGER nOptVal1, INTEGER nOptVal2, STRING pOptVal1, STRING pOptVal2 >DECLARE INTEGER _apGetFunc@24 IN (lcDllName) AS apGetFunc INTEGER id, INTEGER code, INTEGER nOptVal1, INTEGER nOptVal2, STRING pOptVal1, STRING pOptVal2 >>
Parallel.SetWorkerCount(Parallel.CPUCount * 2)
>C:\> cd c:\vfp\ >C:\vfp\> git clone https://github.com/RickCHodgin/guithread.git >C:\vfp\> _>
Jun.19.2013 -- This program is currently undergoing a massive revision. >If you need to access a prior stable version, clone the repository and execute: > git reset --hard de02495229ddc96acbf0a1718f72a4eaf5173c38>
>>Local loMyObject
>>loMyObject = CreateObject("MyObject")
>>loMyObject.Mainprocess()
>>Return
>>
>>DEFINE CLASS MyObject AS Custom
>>PROCEDURE Mainprocess
>>Local Parallel as Parallel
>>Parallel = NewObject("Parallel", "ParallelFox.vcx")
>>Parallel.SetWorkerCount(Parallel.CPUCount)
>>Parallel.StartWorkers()
>>
>>SCAN
>>iFilename=ALLTRIM(Fullpath)
>>oFilename=ALLTRIM(Newpath)
>>RCNON=Recno()
>>Parallel.CallMethod("ps2pdf", This.Class, This.ClassLibrary,,,iFilename,oFilename,RCNON)
>>ENDSCAN
>>ENDPROC
>>
>>** Convert ps files to PDF Using ps2PDF.Dll
>>PROCEDURE ps2PDF
>>PARAMETERS iFilename,oFilename,RCNON
>>DECLARE INTEGER _apCreate@0 IN ps2pdf.dll AS apCreate
>>DECLARE _apClose@4 IN ps2pdf.dll AS apClose INTEGER id
>>DECLARE INTEGER _apConvert@4 IN ps2pdf.dll AS apConvert INTEGER id
>>DECLARE INTEGER _apSetFunc@24 IN ps2pdf.dll AS apSetFunc INTEGER id, INTEGER code, INTEGER nOptVal1, INTEGER nOptVal2, STRING pOptVal1, STRING pOptVal2
>>DECLARE INTEGER _apGetFunc@24 IN ps2pdf.dll AS apGetFunc INTEGER id, INTEGER code, INTEGER nOptVal1, INTEGER nOptVal2, STRING pOptVal1, STRING pOptVal2
>>#define AP_Set_Output 3000
>>#define AP_Set_Input 3001
>>id=apCreate()
>>IF (id # 0)
>>apSetFunc(id, AP_Set_Input , 0, 0,iFilename, 0) &&input file.
>>apSetFunc(id, AP_Set_Output, 0, 0,oFilename, 0) &&output format and file.
>>apConvert(id)
>>apClose(id)
>>Sys(2335, 1) && disable unattended mode, allow UI
>>WAIT WINDOW 'Converting to PDF..'+ALLTRIM(STR(RCNON)) NOWAIT
>>ENDIF
>>ENDPROC
>>
>>
>>
>>
>>
>>
>>Harsh