http://dev.9cbs.net/develop/Article/18/18388.shtm
CDEX is a hot project, ranked first in SourceForge, which converts the CD track to a WAV file, converts the WAV file to the MP3 file, or converts MP3 into WAV, the current latest version is 1.40beta9, I have one hand The source code of 1.40beta3, took advantage of the empty look. However, my purpose is only limited to understanding the entire software structure (layout), how to learn other people's software. My work and multimedia have not much relationship, so I have no ability to do what comments have been used by the algorithms used by CDEX, and write a little one thing here. CDEX is a typical Windows application that implements a basic element required by a Windows application, a variety of standard Windows controls (such as combo boxs, list controls, text editing boxes, with hotspot features The horizontal toolbar and a vertical toolbar (all types of 256 colors), a setup dialog (typical property sheet implementation, including several property pages), an old helper (HLP format), additional There is also some necessary anti-wrong information.
From the internal structure of the program, it is a typical MFC application that has three main MFC classes to the program's framework (CWINAPP, CDocument, CView, CMAINFRAME), the response of user events is also very standard, basically Capture the event in CVIEW, then access the relevant data via the getDocument function, and then go to the relevant dialog box.
From the structure of the entire program, CDEX is the main project, and several other auxiliary projects include CDRIP, ID3LIB, Libsnddll, MP2ENCDLL, MP3ENCDLL, MPGLIBDLL, VORBISDLL, ZLIB, which are all in the form of a DLL. They export their own functions for the main engineering, and the main project can use these export functions as long as INCLUDE is related to the relevant header files in the DLL directory. And if the auxiliary project needs to use the class in the main project, use the Class XX in the header file (forward class declaration / forward class declaration), and then use the header file that INCLUDE in the file. These projects of CDEX are a loosely coupled structure, and they are relatively strong and often used in other projects.
Incident, there are so fews: 1. Appearance: 1 or 2 256-color hotspot toolbar (1 to 2 controls in the toolbar), status bar, setup dialog (attribute table), about dialog, corresponding hyperlink (connected to Company page or product homepage), a variety of dialogs. These appearance requirements have the following class support: a registry cregistry, used to access information in the registry, read and write CINI for the INI file, used to access some information running in the file;
The property sheet, the property page, usually includes 5 to 6 pages, used to construct a setup dialog, and there is another structure that defines a global variable, specifically saving various settings information; for example, cconfig is such a Class, declare G_Config's global variable, any need to access setup information, as long as the include the header file;
Bit map CDIBSTATIC, CDIB, hyperlink class Chypelink, is used in the About dialog box and connected to the relevant URL. 2. Some common functions that are usually implemented in the form of a global function or DLL export function: related to window location, such as judging the color of the screen to determine the size of the fonts and windows, responding to the layout of the window in Onsize , Save the location size of the window, use these saved values when starting next time;
Provides a global function for detecting the operating system version and the CommCTL Runture (Windows Standard Control Library) version to determine if certain functions can be implemented;
Check if a file or directory exists, check before saving the file;
There is a debugprintf function in CDEX that prints related debug information when the DEBUG state is used.
1. The MFC application needs to be used, such as views, documents, CWINAPP, FrameWnd classes, etc. The document class is responsible for data access, and the view class is responsible for interacting with the user.
The CCDEXDOC class is not very long, mainly providing two interfaces, one is the interface of the data store, such as savetoini, saving some information into the file; the other is an interface with the logic processing class, such as CDInfo is a special read CDROM information The class, ccdexdoc declared a member variable of a CDInfo class, through this member variable to obtain the information of the CDROM; CDINFO also contains a member variable of a CDTrackInfo class, and read the related track information through this class. It is tissue in such a layer.
However, the relationship between CCDEXDOC and logic processing classes is not large. These logic processing classes are generally declared as global variables, and they can be used in the place where INCLUDE to be used. By the way, the logical handling class that I refer is to implement the main function of the program. It is nothing to do with the UI. There is no relationship with the data storage, such as cacmcodec, mainly used for encoding, it is returned to the logic processing class . These classes can also be incorporated into the intermediate layer if the development of WINDOWSDNA development is.
The CCDExView class has probably 2500 lines, main features: 1. Refresh the status of each control, such as using the appropriate menu / toolbar, make some unavailable menus / tool icons to make gray, adjust the location size of the window; 2. Respond to the user event, call out various dialog processing user requests. The constructor of these dialogs generally requires a pointer to a ccdexView, so that you can do a lot through this pointer in these dialog boxes, like a track Copy dialog CCopyDialog is the case. Basically ccdexView is these features, core part - track replication / codec is not done 2500 lines, visible UI is indeed a heavy burden of Windows application developers.
The earliest use of the WINDOWS program is the standard document in the MFC - the view - frame structure, later in some time, there is no truly understanding of the complicated things inside this structure, I think this structure is a cumbersome, in the program written in the MFC. Don't use it, and use your own set of data display / access structures.
Later, I saw the MFC of the Waitie, and the mechanism inside the MFC understands a lot. The document in the MFC program - the view - the frame structure has a good sense, I think this is a set of mechanisms provided by the MFC itself, don't need it It does not use the benefits of MFC. Now many programs, look at SPY , like a document view structure, especially this CDEX, a standard document view structure. In general, the multimedia algorithm is not taking, reading the entire program is still very easy, mainly the implementation of this program is very standardized, the interface does not feel, there is no popular CJLibrary, BCG library and any beautiful UI control, there is no very mysterious skill on programming, it is very simple, but the function of this implementation is all achieved, I tried it, its CD track turns MP3 is much better than before, it is much better. There is no phenomenon.
Time to take the source code for the CDEX, I would like to learn some skills, and see what the top 10 project is amazing. I wrote a hard work for almost three years. I didn't think that CDEX wrote too soil. If it is not the algorithm of its multimedia part, it feels like a person who has learned from VC1, than the previously seen FreeAmp. BO2K has a big difference, but these two days have gradually have a lot of good feelings, and it is indeed simple to touch me, and it can also be said that it is specified to touch me.
For all, many Windows software developers have long time long, always get tired of Windows software, the reason is something that many Windows itself and procedures are not too many relationships, such as UI is a very heavy burden, and the time for participation Beijing Communication Exhibition I need to do the interface of a demo software, usually today, the boss said that the font is not correct, and the next day, another requirement, saying that the function panel should be put, what information should be added in the settings dialogue, etc. Wait.
The core of a software should be its algorithm and logic processing section, because because there is no specification, the UI design on the Windows platform often accounts for more than 1/3 ratio. Even with the interface library such as CJLibrary, BCG, I also thought I had to organize a set of design elements that should have under the Windows platform, such as what kind of UI, what kind of settings dialog boxes, do you need Reading and writing a registry, but I have not been put into action until I see CDEX, I have a little understanding, regardless of CDEX is returning to the graffiti, I want to read the structure of the program, everyone will have some gains, this gain For me, I can call the basic elements of a Windows program, I think this is also a design pattern.
However, CDEX also has some funny things, such as such a full-time function testini (), is very like a test function of a registry written by the author, and throws into the release version.