Modi and VB6

Source: Internet
Author: User

Ma Jian
Email:[email protected]
Home: Http://www.comicer.com/stronghorse
Published: 2016.12.16

After I wrote the "Use Modi OCR 21 languages", "Modi in the OCR module" released, it seems that the use of Modi to do OCR more people up. A few days ago at the request of someone, I tried to call the Modi under the VB6, but found a bit of compatibility issues.

Because of the MODI of Office 2007 (hereinafter referred to as "MODI 2007", Microsoft's official version number is MODI 12.0) is more concise than the MODI with Office 2003 (hereinafter referred to as "MODI 2003", the Microsoft version number MODI 11.0), So I always say in the above two articles is Modi 2007, on my network disk also only put out Modi 2007 of the installation package. Because I used to only VC development, and VC development Environment (IDE) and Modi 2007 no compatibility issues, so I also do not care about the Modi version of the difference. But after a try in VB, but found that Modi 2007 and the VB6 Development Environment (IDE) in the compatibility of a little small problem: VB code if you call the Modi (Microsoft Office Document Imaging 12.0 Type Library), can be used normally under the VB6 IDE, but only once, that is, if Modi 2007 is called in your VB6 program, clicking on the Start button on the VB6 IDE toolbar will work, but if you do not exit the VB6 IDE after the program has finished running, Instead of clicking the Start button on the toolbar again, the VB6 IDE will report an error, and the best case is that the object creation fails, but the most common scenario is to exit the entire IDE directly. That is, each time the IDE is started, only the VB6 program that calls Modi 2007 is run once.

The cause of this problem, I guess is VB6 IDE management problems, that is, each debug program exit, may not completely release the DLL or clear memory, just Modi 2007 is not re-entry, so it crashed. The VC6 IDE does not have this problem, so if the program written in VC6 calls Modi 2007, how many times in the VC6 IDE will not cause the IDE to exit with an error.

After repeated testing, MODI 2007 and VB6 compatibility only for the VB6 IDE, if it has been compiled into an EXE file, no matter how many times to run this exe alone, there will be no problem mentioned above. That's why I suspect this is a management problem for the VB6 IDE itself.

To solve this problem, the simplest way is to give up Modi 2007, instead of Modi 2003, because Modi 2003 is developed with VC6, with the VB6 IDE with good, there is no compatibility issues mentioned above. So this time I have added a separate installation package for Modi 2003 on my network and also support 21 languages. Language files are basically copied from office 2007 because I don't have a multi-country language pack for Office 2003. But this does not seem to appear what compatibility problem, in x86 XP, x64 Win7 under the test.

I did not compare the Modi 2003 and 2007 in the OCR quality gap, but I release the language files are the same, so I personally think there is no difference in OCR quality, but Microsoft adjusted the architecture, and then follow the new architecture with the VC 2005 the original code written in VC6 and changed again, did not touch the core of the OCR engine, after all, this engine is not written by Microsoft itself, can not be said to change. MODI 2003 is the first time that Microsoft has provided OCR functionality in Office products, so the architecture design aspect does not seem perfect, the MODI is mixed with the text Proofing tool, so I myself stripped out of the MODI 2003 standalone installation package more than 2007 of the files, registry entries more complex, I do not want to use batch to write the registry key generation section, so be sure to look at the installation instructions before installing.

In addition, if the direct use of VB code calls Modi there is a small note: If you use VB code directly call Modi, if the development of Modi 2003, the software compiled after the release of the client must also install Modi 2003, because the pure VB code in the use of Modi before, The Microsoft Office Document Imaging 11.0 Type Library needs to be selected through the IDE's Project->references menu, and this string of characters will be written dead in the source code after compilation, and then run to the user. , you should follow the original selected version to find Modi, can not find the error.

If you want the end customer to be able to choose whether to install Modi 2003 or 2007 (after all, install 2007 is simpler, and Microsoft's official instructions for the installation of illustrations), there is only one way: With the VC development DLL or ACTIVX control, the call to Modi is encapsulated to the bottom, It is no longer necessary to select the version of the Modi Type library in VB.

The principle of this is actually very simple: in the VC call Modi, you can not choose the Modi Type library version, so it does not matter which version is used. The version number of the Modi class library will no longer appear in VB code, just call it like a normal call to a system DLL or other control. Like I use VC write Djvutoy, Freepic2pdf, Pdg2pic, Textforever, etc., in Modi 2007, 2003 can use, not picky.

Note: Under Windows 7/10, C:\Program Files (x86) \microsoft Visual Studio\vb98\vb6. EXE must run as an administrator, and the compiled EXE must also run as an administrator to properly invoke Modi.
Note: Under Windows 7/10, C:\Program Files (x86) \microsoft Visual Studio\vb98\vb6. EXE must run as an administrator, and the compiled EXE must also run as an administrator to properly invoke Modi.
Note: Under Windows 7/10, C:\Program Files (x86) \microsoft Visual Studio\vb98\vb6. EXE must run as an administrator, and the compiled EXE must also run as an administrator to properly invoke Modi.
The important thing to say three times.
Finish

Modi and VB6

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.