Saturday, October 23, 2010

VC + + dynamic link library (DLL) program in layman's language (1)


1. Introduction

First to set out the DLL (Dynamic Linkable Library) concept, you can simply the DLL as a kind of warehouse, it offers you some of the variables can be used to use, function or class. History of the development in the warehouse through the "no library - static link library - Dynamic Link Library" era.

Static link library dynamic link library is shared with the way the code, if the static link library, whether you are willing, lib of the instructions are generated directly included in the final EXE file in the. However, if the use of DLL, the DLL not be included in the final EXE file, EXE file when the implementation of "dynamic" to quote and unload the DLL and EXE file independent. Static link library and the dynamic link library, another difference is that the static link library can not contain other dynamic-link library or static library, but also in the dynamic link library can be further contain other dynamic or static link library.

Dynamic link library, we must develop the following concepts:

(1) DLL's compiled with a specific programming language and compiler independent
Follow the convention of the DLL as long as the interface specification and the call mode, DLL written in various languages can call each other. For example, Windows provides a system DLL (which includes the Windows-API), in any development environment can be called, never mind its a Visual Basic, Visual C + + or Delphi.

(2) dynamic link library can be seen everywhere
We are in the Windows directory under the system32 folder to see kernel32.dll, user32.dll and gdi32.dll, windows most of the API are included in the DLL. kernel32.dll function in the main processing memory management and process scheduling; user32.dll function in the main control of the user interface; gdi32.dll in respect of the function is responsible for graphics operation.

Programmers are generally similar to MessageBox function used, in fact, that it is included in the dynamic link library user32.dll. This shows that DLL is not unfamiliar to us.

(3) VC classification of the dynamic link library
Visual C + + supports three DLL, namely the Non-MFC DLL (non-MFC dynamic libraries), MFC Regular DLL (MFC rules DLL), MFC Extension DLL (MFC extension DLL).

Non-MFC dynamic libraries do not use MFC class library structure, the export function for standard C interface, can be written in non-MFC or MFC application that calls; MFC rules DLL contains a class that inherits from CWinApp, but no message loop; MFC extension DLL using MFC to create a dynamic link version, it can only be prepared to use MFC class library calls the application.

As this lengthy, more content will definitely need to read this article on matters related note, the following questions and answers given in the form.
Q: What are the contents of this paper to explain?
A: This paper describes all aspects of DLL programming, to completion of this DLL should be able to have a more comprehensive grasp, and can write most of the DLL program.

Q: How do see this?
Answer: This explanation of each topic are included with the source code routine, with the text can be downloaded (each project by WINRAR compressed). All of these routines written by the author and debug by VC + +6.0.
Certainly not the readers understand the ultimate goal of this article, readers should be hands-on practice to really master the subtleties of DLL.

Q: What kind of learning this basic knowledge?
A: If you master C, and generally control the C + +, to understand that the knowledge of MFC, you can easily read this article.

2. Static Link Library
To explain the static link library is not the focus of this article, but the specific DLL before explaining, through the example of a static link library to help us quickly establish a "library" concept.



Figure 1, a static link library

Figure 1, in a VC + +6.0 in the new name for the libTest the static library project (click here to download the attachment in this project), and New lib.h and lib.cpp two files, lib.h and lib.cpp The source code is as follows:


/ / File: lib.h
# Ifndef LIB_H
# Define LIB_H
extern "C" int add (int x, int y); / / declared as a C compiler, the external connection function
# Endif

/ / File: lib.cpp
# Include "lib.h"
int add (int x, int y)
(
return x + y;
)

Compile this project to get a. Lib file, this file is a library, add the functionality it provides. The header files and. Lib file to the user, the user can directly use one of the add function of the.

Standard Turbo C2.0 in the C library functions (we use the scanf, printf, memcpy, strcpy, etc.) came from such a static library.

Here take a look at how to use the library, where the work of the project in libTest a libCall new project area. libCall project contains only one main.cpp file, it shows a static link library for calling the method, its source code is as follows:


# Include
# Include ".. lib.h"
# Pragma comment (lib, ".. \ debug \ libTest.lib") / / specify the connection with the static library
int main (int argc, char * argv [])
(
printf ("2 + 3 =% d", add (2, 3));
)

Static link library call is as simple as perhaps we use every day, but we do not understand the concept. Code # pragma comment (lib, ".. \ debug \ libTest.lib") means that in this paper generated. Obj file should be connected together with libTest.lib.

If you do not specify # pragma comment, you can set VC + +, as shown in Figure 2, choose tools, options, directories, library files menu or option, fill in the library path. Red circle in Figure 2 plus some added libTest.lib our path to the file.



Figure 2 is set in the VC library path

Examples of the static link library at least let us see how the library functions going on, they come from. We now have a vague understanding of the following:

(1) library is not a monster, the preparation of libraries of procedures and the preparation procedures generally little different, but libraries can not be executed;
(2) library provides to other procedures that can be called the East, another program to call it must be some way of specifying that it should be called.

From the above analysis of the static link library on the library get muddled concept can be extended to the dynamic link library, dynamic link libraries and static link library and call in the preparation of the different reflected in the library on the external interface definition and call a slightly different way .

3. The library and view the debugger

In specific detail into the various DLL's before, it is necessary to debug and view the library method look description, because the next section, we will be faced with a large number of examples of projects.

As the library file can not be executed, thus pressing F5 (start debug mode execution) or CTRL + F5 (run) the implementation of, its pop-up dialog box shown in Figure 3, requires users to enter the path of the executable file to start the library execution of the function. This time we enter the call the library path of EXE file can be debugged on the library, and its general application debugging skills and debug the same project.



Figure 3 library debugging and "Run"

The practice is usually better than debugging means that the library project and application engineering (call the library project) located in the same VC workspace, application engineering for debugging only, call the library at the application engineering function to set the statement Department breakpoint, execution, press F11, so step into the library function. Section 2 of the libTest and libCall project to put the same work area, the project structure shown in Figure 4.



Figure 4 library project and call the library project to debug into the same work area

The testing method and the static link library dynamic link library in terms of the same.鎵?互鏈枃鎻愪緵涓嬭浇鐨勬墍鏈夋簮浠g爜涓兘鍖呭惈浜嗗簱宸ョ▼鍜岃皟鐢ㄥ簱鐨勫伐绋嬶紝杩欎簩鑰呴兘琚寘鍚湪涓?釜宸ヤ綔鍖哄唴锛岃繖鏄瑪鑰呮彁渚涜繖绉嶆墦鍖呬笅杞界殑鐢ㄦ剰鎵?湪銆?br />
銆??鍔ㄦ?閾炬帴搴撲腑鐨勫鍑烘帴鍙e彲浠ヤ娇鐢╒isual C++鐨凞epends宸ュ叿杩涜鏌ョ湅锛岃鎴戜滑鐢―epends鎵撳紑绯荤粺鐩綍涓殑user32.dll锛岀湅鍒颁簡鍚э紵绾㈠湀鍐呯殑灏辨槸鍑犱釜鐗堟湰鐨凪essageBox浜嗭紒鍘熸潵瀹冪湡鐨勫湪杩欓噷鍟婏紝鍘熸潵瀹冨氨鍦ㄨ繖閲屽晩锛?br />


鍥?銆?敤Depends鏌ョ湅DLL

銆??褰撶劧Depends宸ュ叿涔熷彲浠ユ樉绀篋LL鐨勫眰娆$粨鏋勶紝鑻ョ敤瀹冩墦寮?竴涓彲鎵ц鏂囦欢鍒欏彲浠ョ湅鍑鸿繖涓彲鎵ц鏂囦欢璋冪敤浜嗗摢浜汥LL銆?br />
銆??濂斤紝璁╂垜浠寮忚繘鍏ュ姩鎬侀摼鎺ュ簱鐨勪笘鐣岋紝鍏堟潵鐪嬬湅鏈?竴鑸殑DLL锛屽嵆闈濵FC DLL(寰呯画...)






相关链接:



Secretary, Ministry of Industry and consumer ZHANG cordial meeting with President of Central Best In



You Will Enter The English Phonetic It?



MKV to Zune



VS 2008 And. NET 3.5 Beta2 Introduce New Features



Photoshop rendering realistic beautiful necklace



3G: meat and Potatoes or hot potato



learn how to burn downloaded ps2 games



Access Control Report



How to add the equivalent in the R5 name (Alternate name)



Zhou Hongyi: difficult to start off on how conservative estimates are not



CG City Wizard - Wizard is the beginning (1)



XviD to WMV



AVI To DivX



Intel claims AMD is due to be executive pay



COMMENT Development



Monday, October 11, 2010

Auto Attendant computer operator




1. Introduction:

High efficiency, fast-paced today, telephone is an important tool for information transmission, the level of its services. Quality directly affects a Hotel up, commercial buildings, the company's reputation and image. The traditional attendant console manual calls received by the switch can not meet the needs of social development. The face of growing traffic, how to faster, more accurate to take turn every call; the face of a large number of phone messages, check request, how to accurately record, notification and rapid response; the face of the attendant console has less load manual call forwarding and backward way, how to improve and update! To keep up with the pace of information delivery has become an urgent task manager! In response to these circumstances, Guangzhou Tsui Sing Yuen Technology Co., Ltd. developed intelligent voice system, the computer operator with the unique combination of voice mail, then switch to manual and computer integration in two ways, the work of the current switchboard injected new vitality the same time improve the telephone service grade!

Second, the system connection

Intelligent voice system is suitable for any type of switch. Simply connect to the regular extension, extension or trunk night service can work.

Third, the system functions

鈼?Intelligent Voice systems have manual and automatic transfer of two telephone access mode, and can be used interchangeable.
When the system is manually switched mode, the phone first, then switch to manual, when the artificial sets busy switch provides automatic access mode; the other hand when the system is automatically
Switched mode, the guests can dial extension automatically switching, in a wrong number, check number can automatically be transferred when the artificial sets.
鈼?intelligent voice system can be connected to switch the phone automatically when busy or no access prompts customers, and further offers to change dial the number, message, CALL pager, phone tracking and many other services.
Even artificial carry-phone operator, has just completed a simple answer, dial ext operation, followed by the intelligence services would be able to automatic processing
鈼?Intelligent Voice system extension has a message for all functions.
Telephone 1 has a message, it will promptly notify the intelligent attendant console extension, BP machine, or cellular phones, and voice prompts owners extract a message. Users at any one time, place, using ordinary telephone can be extracted or recorded message to find the owner.
鈼?Intelligent Voice system has automatic, manual inside phone tracking.
Transferred to an extension can be set outside of the system line telephone or cellular phone, the truly "take the phone with you four!"; System security outside dial-up password control and reliable telephone billing, but also gives you " 200 "type of long-distance telephone services.
鈼?Intelligent Voice system has powerful telephone inquiry service system.
Information through a computer store, providing numbers, area code, zip code inquiry service.
鈼?Intelligent Voice system has two-way telephone recording function.
Timely record an important telephone conversation or a telephone operator carry-term response, and may at any time in the machine table to listen.

Fourth, after-sales service

"Excellent quality, excellent service" is our commitment to customers!

鈼?all sold equipment, our company are for one year warranty and free technical support, warranty expired long-term security of supply spare parts and maintenance services.

鈼?The company is responsible for training technical managers.







相关链接:



MP4 to 3GP



How did i thoroughly uninstall windows live



MP4 to FLASH



3GPP converter



New Graphic CAD



Photoshop open 10 things



Zango Sued Kaspersky Lab Kaspersky Win Case



Foam Everywhere



WIZARD Dial Up And Connection Tools



Recommend Newsgroup Clients



Using Filter Effects Create Fantastic Images



Alibaba Ma: Even if I HAVE to finally kneeling down



Credit "to bear the blame," Who back?



3G really do lead to economic disaster