>IF IsClassRegistered( 'mswinsock.winsock' ) = .F. THEN && The mswinsck.ocx class is not in the registry so now check if the System folder exists IF Directory( 'C:\WINNT\System32' ) THEN lcPath = 'C:\WINNT\System32' lcPath1 = 'C:\WINNT\System' ELSE IF Directory( 'C:\WINDOWS\System32' ) THEN lcPath = 'C:\WINDOWS\System32' lcPath1 = 'C:\WINDOWS\System' ENDIF ENDIF fConditionalCopy( 'MFC30.dll', lcPath, lcPath1 ) fConditionalCopy( 'MFC40.dll', lcPath, lcPath1 ) fConditionalCopy( 'OLEPRO32.dll', lcPath, lcPath1 ) fConditionalCopy( 'MSVCRT40.dll', lcPath, lcPath1 ) fConditionalCopy( 'MSVCRT20.dll', lcPath, lcPath1 ) fConditionalCopy( 'mswinsck.ocx', lcPath ) && Register the winsock class && Removed the /N (NoWait) this means the action has to finish && before attempting to create an instance. RUN Regsvr32 /s mswinsck.ocx ENDIF && create my object oSocket = create( 'mswinsock.winsock' ) RETURN .T. ******************************************************* Function fConditionalCopy( tcFileName, tcPath1, tcPath2 ) ******************************************************* lcPathFile = tcPath1 + "\" + tcFileName && The system folder exists so now check to see if the dll's exist IF NOT FILE( lcPathFile ) THEN COPY FILE &tcFileName. TO &lcPathFile. ENDIF IF PCOUNT() > 2 THEN lcPathFile1 = tcPath2 + "\" + tcFileName IF NOT FILE( lcPathFile1 ) THEN COPY FILE &tcFileName. TO &lcPathFile1. ENDIF ENDIF RETURN .T. ENDFUNC && fConditionalCopy( tcFileName, tcPath1, tcPath2 )