Summary: When you use Microsoft Visual FoxPro, you may make use of the COMRETURNERROR() function in your Visual FoxPro Component Object Model (COM) servers. However, COMRETURNERROR only works from method calls. There is no way that COM can return an error during object creation. As a result, you do not get a detailed error message if a problem occurs in the INIT of your object and you are using COMRETURNERROR only.

Resolution: Fixing PRB: COMRETURNERROR() Does Not Work if Errors Occur During Server Creation errors is a really difficult task for most computer users. To solve PRB: COMRETURNERROR() Does Not Work if Errors Occur During Server Creation problems effectively and efficiently, install a good PRB: COMRETURNERROR() Does Not Work if Errors Occur During Server Creation Error Removal Tool is a smart solution. This is definitely your ideal tool to solve PRB: COMRETURNERROR() Does Not Work if Errors Occur During Server Creation problem in the shortest time.

Download PRB: COMRETURNERROR() Does Not Work if Errors Occur During Server Creation Problems Fixer Now

In order to repair PRB: COMRETURNERROR() Does Not Work if Errors Occur During Server Creation error, install SmartPCFixer immediately. This system optimizer software is already proven to locate, identify, and remove PRB: COMRETURNERROR() Does Not Work if Errors Occur During Server Creation errors. Your computer should run faster and smoother after using this software.


Manual Resolutions

As a possible workaround for this issue, use an approach similar to the following when you develop your COM server:
  • Build this program code into an .exe file named GOOD_SERVER: ********* START CODE ***************** DEFINE CLASS SERVER AS CUSTOM OLEPUBLIC xError = .F. PROCEDURE INIT ERROR 21 ERROR 22 ERROR 23 ERROR 24 ENDPROC PROCEDURE ERROR LPARAMETERS nError, cMethod, nLine #DEFINE CRLF CHR(13) + CHR(10) LOCAL cErrStr, cErrTxtFile cErrTxtFile = ; JUSTPATH(SUBSTR(SYS(16),AT(' ',SYS(16),2))) + "\COMERR.TXT" cErrStr = "Error #: " + TRANS(nError) + CRLF + ; "Method Name: " + cMethod + CRLF + ; "On Line: " + TRANS(nLine) + CRLF + ; "Message: " + MESSAGE() + CRLF + ; "DateTime: " + TTOC(DATETIME()) + CRLF + CRLF IF "INIT" $ UPPER(cMethod) STRTOFILE(cErrStr, cErrTxtFile, .T.) THIS.xError = cErrStr ELSE COMRETURNERROR(cMethod, cErrStr) ENDIF ENDPROC ENDDEFINE ***************** END CODE ******************
  • Call the server by using the following code: ********* START CODE ***************** #DEFINE MB_ICONQUESTION 32 && Warning query #DEFINE MB_YESNO 4 && Yes and No buttons #DEFINE IDYES 6 && Yes button pressed #DEFINE CRLF CHR(13) + CHR(10) #DEFINE MB_OK 6 && OK button pressed PUBLIC goMyServer LOCAL lcComInitError, lnReleaseCom lcComInitError = "" lnReleaseCom = 0 goMyServer = CREATEOBJECT("GOOD_SERVER.SERVER") IF VARTYPE(goMyServer) # "O"
    MESSAGEBOX("Create Object Failed!")
    RETURN .F. ENDIF *!* Text in this property means we had an error (default is logical). IF VARTYPE(goMyServer.xError) = "C"
    lcComInitError = goMyServer.xError
    lnReleaseCom = MESSAGEBOX("The following error occurred:" + ;

    + CRLF + CRLF + lcComInitError + CRLF + CRLF + ;

    "Additional errors may have occurred. Check COMERR.TXT" + CRLF + ;

    "in the directory with the object for details. Release the object?", ;

    MB_ICONQUESTION + MB_YESNO, ;

    "Error Creating Object - Release It?")
    IF lnReleaseCom = IDYES

    RELEASE goMyServer

    MESSAGEBOX("Object Released",MB_OK,"COM ERROR")
    ELSE

    MESSAGEBOX("Object Remains",MB_OK,"COM ERROR")
    ENDIF
    RETURN .F. ENDIF *!* If goMyServer.xError is still .F., no INIT error occurred, *!* so do whatever... MESSAGEBOX("Object Created Successfully") RELEASE goMyServer ***************** END CODE ******************

    The main issue with this approach is that the error message you get from the message box is only the LAST error that occurred in the INIT of the object (error 24). To work around this, the object writes any errors out to a file named COMERR.TXT that resides in the same directory as the server.
  • What Else Does SmartPCFixer Offer You?

    Apart from fixing PRB: COMRETURNERROR() Does Not Work if Errors Occur During Server Creation problems, SmartPCFixer is designed to provide the user's computer system with better optimization, which helps you manage startup items, desktop, browser objects, Internet, system service, Windows optimization, file extensions and so on. With these sophisticated utilities your system is tuned up to run at the optimal state.

    SmartPCFixer provides you with Registry Backup, System Backup, Favorites Backup and Folder Backup. In addition, the new built-in function of Restore Point enables you to create a system store point so you can recover your system to a previous state if you do not like the changes you have made. This ensures the safety of your system when you run the registry repair process.



    Related: Faster Pc Performance,Guard Dll,Windows Vista Optimization,Free Sound Drivers,Windows Explorer Not Responding
    Read More: ,FIX: Error 515 with Concatenated NULLs in WHERE Clause and ORDER BY,How to move a Windows SharePoint Services Web site from one server to another by using FrontPage 2003,FIX: Servers Do Not Release if Init Returns .F.,FIX: Mismatched pushjmp/popjmp Call Error and VFP Closes,FIX: Blocking problems may occur when you use SQL Server to store ASP.NET session state information for a Web site that experiences high loads