The multi thread communication program based on VC++6.0 MFC
- Author
- LiXiaoLi
- Advisor
- LiWeiHua , HeHuaCan
- School
- Northwestern Polytechnical University
- Major
- Applied Computer Technology
- Classification
- TP311.1 Programming
- Degree
- Master's thesis
- Year
- 2001
- Downloads
- 1,835
- Citations
- 9
Abstract
In order to improve the code’s efficiency both in executing time and storing space, downstage and backstage programming were widely used on Multi-task Windows programs. To complete a task properly, threads were used to realize both downstage and backstage duties commonly, so the communications among threads were demanded widely.Visual C++6.0 MFC provided an object oriented programming development environment for Windows 95/NT, it can be used to cope with most standard Windows programming by it’s great many classes and support codes generated. By means of the development environment and class code’s high reliability, standard, we can get application code of high quality.The thesis’s background was the project of Shannxi Province Natural Science Fund (In the year 2001)-the study of Software Reverse Engineering. The thesis presented a method of software redesign by guide of object oriented analysis and design, and specialized on an application aspect of Windows programming: The implementation of Multi-Thread communications based on MFC (Microsoft Foundation Class Library). The significance of the method was that it solved the problems of the demands of Software Reverse Engineering, the demands of Software Reuse, the reliability of software, the module of software, the time span and the cost of the development.By means of the analysis of the target system and software demands, the function model can be get, with MFC, the module and standard code of high quality can be performed. In the process, it also generates related archives and quick model in classes about the target code system, but the architectures of the program hide behind the development system.Threads are divided into Worker Thread and User Interface Thread.The Worker Thread has no Message Rotation Queue and Window, so it can not receive messages. It is used to perform backstage task such as computation of CPU intensive, file I/O and so on. In the implementation of the Multi-Thread communications in the thesis, the Worker Thread performs a circulation of counting for a huge span of time, without the communication between main Thread and the Worker Thread, the CPU would be locked and the system would not respond. The User Interface Thread has both Message Rotation Queue and Window. So it can receive messages.The thesis detailed the outlook of the MFC and the relations among classes, and the realization of processes, threads in Visual C++6.0. the main body of the thesis specialized on 3 kinds of thread communication directly supported by MFC, that were by means of Global Variables, by means of User Defined Messages, by means of Event Object It also displayed the principle of communication, the method of implementation in the Multi-Thread communications. The main thread was a controls based on dialog, the worker thread was a circulation of counting lasting a long time. They use Event Object and User DefinedMessage to communicate. Without the communications between main thread and worker thread, CPU would be locked for a long time. By the communications, we can easily control the circulation of counting.A conclusion can be get from the design and implementation of the Multi-Thread communication program that Multi-Thread communications are useful for those application aspects requiring more executing time efficiency and storing space efficiency, and we can easily introduce the method into industry control and test, for example, we can scheme the architecture of the program as main thread and worker thread, in main thread, we can do initialization and coordinating the worker threads. We arrange those tasks need more time span as backstage tasks which to be performed by worker threads. So the system can schedule them by priority. We can use the technology specialized in the thesis to make the threads to communicate so as to complete the task.
Table of contents
Master thesis 2
topic -based VC 6.0 MFC multi-threaded communication program 2-3
Summary 3-4
ABSTRACT 4-6
directory 6-8
Chapter 1 Introduction 8-11
1.1 issues raised background 8
1.2多thread Overview 8
1.3 Introduction to the basic application and implementation main content 8-9
1.4 article 9-11
Chapter 2 VC 6.0 MFC Overview 11-29
2.1 application framework class 11-13
2.2 window class 13-19
2.3 graphics and printing class 19-20
2.4 collection classes 20-21
2.5 files and database classes 21-22
2.6 OLE support classes 22-25
2.7 Internet and network classes 25-27
2.8 debugging and exception classes 27-28
2.9 various auxiliary class 28-29 <br / > Chapter 3 processes and threads create nbsp 29-40
3.1 processes ; management and termination nbsp 29-34
3.2 processes ; 34-36 <br / > 3.3 thread creation and termination 36-37
3.4 thread priority and its management 37-40
Chapter 4, VC 6.0 multi -threaded 40-47
4.1 achieved using MFC threads 40-42
4.2 thread synchronization 42-47
Chapter 5 multithreaded programming communication technology 47-50
5.1 using global variables communication 47
5.2 using the messaging user-defined 47-48
5.3 use the event object communication 48-50
Chapter 6 multithreaded communications program 50-80
6.1 design steps 50-53
6.2 source list 53 - 80
Chapter 7 Win 32C communications API 80-94
7.1 open serial 80-81
7.2 Close serial 81
7.3 Configuring the Serial 81-86
7.4 timeout setting 86-87
7.5 reading and writing data 87-91
7.6 event-driven I / O 91-92
7.7 error handling 92-94
summary doing major work nbsp 94-96
1 of this article ; 94 <br / > 2 application prospect 94-96
Thanks 96-97
References 97
Related dissertations
- Research and development of software platforms for portable electronic map instrument navigation system
- Development of Universal Condition Monitoring System MFD320
- Based on the VC 6.0MFC multi-threaded Communication Technology Research
- Web-based technology embedded elevator remote monitoring system - Building Monitoring Center Software Design