Delphi Object-Oriented Practical Skills Teaching II (Encapsulation)

Object-oriented programming is a comprehensive skill, and it is not suitable for anyone to take it out alone. This time, TSimpleThread is rewritten so that it can run under D7.

Based on TSimpleThread, TSimpleUI.ExeProcInMainThread is launched, with more precise naming and eliminating doubts in use. Details are as follows:

1. TSimpleThread, described in detail in this blog thread tutorial.

2.TSimpleUI, execute Proc in UI Thread or MainThread.

3.TManagementBase, management base class, used to write thread programs, ThreadDispMsg(AMsg:string) is implemented in this class.

4.TElegantThread, provides Synchronize, Queue functions to execute Proc, that is, put Proc into the thread to execute. (not written example)

This example demonstrates, encapsulation, and minimal code on the interface. Use events to pass parameters, use List to save parameters, when to release Pointer, etc.

This example source code download (delphi7)

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325233789&siteId=291194637