Software development sharing space
Computer News Distance Education Center Tang Ming
The author has been more than a year, with friends to exchange programming experience, roaming online roaming programming materials, tasteing others's sharing modules, indeed earnings a lot. In fact, shared software is not only in the application phase of the software, we have already felt the benefits of sharing software development in the development and development of software.
Microsoft's Windows has been opened to us thousands of functional functions. The class libraries in the MFC of the VC allow us to easily achieve a lot of functions in the program; and you can find more third-party resources online. Controls, DLLs, class libraries, and good articles related to programming, etc. Although some controls, the DLL also requires a small amount of registration fee, but people are still happy to receive it, after all, a small amount of money can accelerate their project development progress.
The author gives a VC-MFC-based DLL library and how to use them, while making some programming ideas using this DLL. There may be no high technical content, and it is also a demonstration for friends programming. This DLL is used as a shared resource without any logo, you are welcome to use.
First, DDL's function:
A DLL library Avidib.dll based on VC-MFC. Contains the following functional functions:
A, bitmap access: 1.lpbitmapinfoheader loadbmp (cstring filename); // Tune BMP graphics file: Enter the file name, return to the image data area pointer 2.lpbitmapinfohead loadtml (cstring filename); // Dance the compression graphic file: Enter the file name, return to the image data area pointer 3.void SaveBMP (CSTRINFOHEAME, LPBITMAPINFOHEADER BI1); // Storage BMP graphics file: Enter: 1 File name, 2 image data area pointer 4.void SaveTML (CSTRINFOHEADER BI1 , unsigned long mmio,); // Storage custom compression bitmap file: input: 1 storage file name, 2 image data area pointer, 3 compression format
B, screen copy 1.lpbitmapinfoheader copyspace (); // screen copy, return image data area pointer
C, store the DIB bitmap to AVI: 1.void Avifileopen (LPCTSTR FileName, Int Width, Int Height, Int ColorBits, Int FPS, Unsigned Long Mmio); // Established AVI file: Enter: 1 file name, 2 images Width, 3 images, 4 color depth, 5 playback speed per second frame number, 6 compression format (Note: Compression format is MMIOFOURCC ('t', 's', 'c', 'c') four-byte expression When MMIO = 0 is optional.) 2. Bool AddFrame (DWORD MFRAME, UCHAR * DATABUFFER); // Add frame to AVI: Enter 1 serial number, 2 image data area pointer 3.void avifileclose (); // Close The established AVI file D, take the picture in AVI: 1. Int aviopen (cstring filename); // Open AVI file, return to the frame number in AVI 2. LPbitMapInfoHeader AvireAd (int mframe) // Take the M frame of the AVI file, Returns the image data area pointer 3. Void aviexit (); // Take the map avi
Second, the application ideas: people who have a bit programming experience have seen this DLL library. What can it do? The author puts forward some ideas for your reference. 1, the screen copy can be performed, and stored in the BMP bitmap mode, you can also save (one 16-bit color bitmap of 800 * 600, select the appropriate compression format, can be compressed to only more than 10 K), Of course, from the DLL, you can also directly save the graphics copy of the screen (or compressed AVI). This is the basic function of sharing the gramographic software on the market. Microsoft once has a screen copy program called Microsoft Camcorder, and its screen copy results are Avi in special compression format, very small. The effect of this DLL can be comparable to it. 2, you can take out any of the disci files as BMP (or compressed) files in an existing AVI file; you can also generate an AVI file with a sequence of BMP files. Of course, you can also choose the compression method of AVI. For example, you can generate an AVI file that is now familiar with high compression ratio MPG4 format. With these main features, can I do an AVI file editor? If you are interested, you can make a home version of the digital image into AVI. 3, now some teaching software will grasp the screen's operation process, but overlapping the text on the AVI screen means a trouble. The method of using this DLL AVI single frame is taken in the playback of the AVI's playback is a simple thing. 4. Graphical information reading tools with a lot of versions and format are well received by people. You can do a reading tool for playing screen operations, with a variety of computer certification exam information, as long as you have a few well-made teaching counseling materials, I believe this reading tool will be received by people. Of course, as long as you have fun, this DLL provides a lot of things (whispers: A friend says here, he wants to engage in a background screen monitoring software, but it is too much storage. It can solve the problem now. Avi file made in TSCC compression format specifically compressed for screen copying graphics; 1 frame of 800 * 600, 1 frame per second, one minute to 450KB, one hour 27000KB. Record someone on the screen in one second, What can I not see?).
Ok, there is a project idea, there is a key module. You can try to plan your project, don't forget a little, things have to make others like to use it, and have benefits.
Third, the usage brief introduction:
The simple usage of this DLL is described below. The black body part is to join in your source program. Note: This DLL can only be used in VC (VB, which is provided later). Establish a dialog mode with VC, such as the project name TEST. Copy the three files provided by the author to copy it to your project directory. 1. Add the header file of the #include "avifile.h" // DLL in the header file ctestdlg.h to reference #pragma Comment (lib, "avidib.lib") // DLL connection library reference to join public class data member. Public: cavifile m_avi; // Defines a DLL reference pointer 2. Add a custom display function lpbitmapinfoheader buf in ctestdlg.cpp; // Defines the global graphic pointer Void ctestdlg :: xianshi () {CclientDC DC (this) ; if (buf == null) {return;} // no graphic returns hdrawdib HDD = DrawDibopen (); // Open DrawDibif (! HDD) Return; // Failed Return DrawDibDibDraw (HDD, DC.m_HDC, 10, 10, BUF-> BIWIDTH, BUF-> Biheight, BUF, NULL, 0, 0, BUF-> BiWidth, BUF-> Biheight, 0); // In the current window X = 10, Y = 10 Display graphics DrawDibClose (HDD ); // Close DrawDib} Don't forget to define this function in the header file. Below we can use the functional functions in the DLL library.
A, screen copy: 1) Copy a screen in the current directory to BMP file buf = m_avi.copyScreen (); // Copy one frame m_avi.savebmp ("test.bmp", buf); // save BMP file 2) Copy a screen in the current directory as a compressed graph file BI1 = m_avi.copyscreen (); m_avi.savetml ("test.tml", buf, // copy one frame MMIOFOURCC ('d', 'i', ' V ',' 3 ')); // Save MPG4 Format Compressed File Note 1: In the System.ini file under the Windows directory [Drivers32], you can see the four video compressed formats installed in your system. Byte description method. The compression format selected here is MPG4. Vidc.mrle = msrle32.dll // This is Microsoft's 8-bit color compressed Vidc.msvc = msvidc32.dll // This is Microsoft's 16-bit color-above compression Vidc.div3 = divxc32.dll // This is a common MPG4VIDC .Div4 = divxc32f.dll // MPG4VIDC.MJPG4VIDC.MJPG = pvmjpg20.dll // This is a JPG compressed Vidc.i263 = C: /Windows/system/i263_32.drv......... Note 2: Compressed graphics The file is the format of the author, and the file suffix is the TML.3) a second copy, and the 20-screen 20 screen is copied, and the AVI file in the MPG4 format Bi1 = m_avi.copyscreen (); // copy one frame first, Take the data m_avi.avifileopen ("test.avi", // in the current directory, buf -> biheight, // Figure high buf -> bibitcount, // Figure color 1, // frame / sec mmiofourcc ('d', 'I', 'V', '3')); for (int i = 0; i <20; i ) // cycle 20 {buf = m_avi. COPYSCREEN (); // Frisber screen, return to graphic pointer uchar * TMP; TMP = (uchar *) BUF 40; // data forward 40 byte m_avi.addframe (j, tmp); // Add this frame graphic Avisleep (1000); // Time 1 second} m_avi.avifileclose (); // After the new Avib, transfer to file display: 1) Turn into compressed graphics and display buf = m_avi.LoadTml ("Test.tml "); // Turn into compressed files, // returns to graphic pointer xianshi (); // Tune Defined Display 2) Turn into the AVI file and display int LEN0 = m_avi.aviopen (" Test.avi "); / / Open the avi // file in the current directory, return the number of frames for (int i = 0; i Fourth, get information about this article: