Download HALCON Programmer`s Guide
Transcript
282 General Information 30.2 Tips and Tricks 30.2.1 Troubleshooting ? Executed program or procedure raises exception for display operators like set_tposition when not using implementation of display operators If you are not using an implementation of HDevelop’s internal display operators (dev_*), calls to these operators in the executed HDevelop program or procedure are simply ignored. However, if the program or procedure contains other, “external” display operators like set_tposition or write_string, which need a window handle as input parameter, the program / procedure will raise an exception at this operator if the window handle has not been instantiated. Typically, this problem will not arise when executing programs, because you will in most cases use an implementation of the display operators. When executing procedures, we recommend to leave out the external display operators that use window handles. If this is not possible, you could place them in a separate procedure and use the implementation of display operators for just this procedure. Alternatively, initialize the window handle with a value like -1 and test it before executing the external display operators. ? External procedures cannot call local procedures Note that local procedures can call external procedures but not the other way round. 30.2.2 Loading and Unloading Procedures In most applications there is no need to delete loaded HDevelop procedures explicitly using UnloadProcedure. A reason might be to free memory. Please note that when creating a procedure with the class HDevProcedure, the procedure is loaded together with all the procedures it uses. In contrast, UnloadProcedure deletes only the specified procedure. To delete the automatically loaded procedures, you can query their names using GetLoadedProcedureNames and then delete them (if you are sure that they are not used by another loaded procedure!), or you can use UnloadAllProcedures to unload all external procedures. As an alternative, you can reset the external procedure paths by passing an empty string to SetProcedurePath or call UnloadAllProcedures.