LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

turn off Non-Fatal Runtime Error popups

how can i disable the non-fatal runtime error popups?

for instance, when the user writes too many characters to an input string, or specifies a file to be opened that is non existent.

i want to handle these mundane user errors without a lot of pop-up drama.

I've tried unchecking the Run -> Break On -> "break on library errors" and I've tried adding the function call  SetBreakOnLibraryErrors (0); to my code, but neither has any effect. 

i must be misunderstanding something here. 

thanks in advance,

robert




0 Kudos
Message 1 of 3
(4,260 Views)
You can use the functions DisableBreakOnLibraryError() and EnableBreakOnLibraryError().
I give you a short example:
 
   // Open file for writing.
 DisableBreakOnLibraryErrors();
 filehandle = OpenFile (pathname, VAL_WRITE_ONLY, VAL_TRUNCATE, VAL_ASCII);
 EnableBreakOnLibraryErrors();
 
   // Check if the file could be opened.
 if (filehandle == -1){
      error = GetFmtIOError();
      if (error){
          MessagePopup ("Could not open file", GetFmtIOErrorString (error));
          return 0;
      }
 }
Message 2 of 3
(4,253 Views)
While debugging, CVI catches errors returned by libraries and displays popups with error messages. These library error popups can be disabled using SetBreakOnLibraryErrors. CVI also catches "user protection errors" like buffer overruns, passing invalid memory addresses and NULL pointers to libraries, etc and displays popups - this can be disabled using SetBreakOnProtectionErrors. Your popups may be caused by "protection" errors and not library errors and may be that is why SetBreakOnLibraryErrors is not disabling them.
Message 3 of 3
(4,237 Views)