Building a Simple Dictionary Application

Building a Simple Dictionary Application

The most essential tool when learning a foreign language. dictionary. It is important that you and your partner find it hard to look at the dictionaries. The solution to the problem. l & agrave; Use the dictionary app. D & ugrave nowadays, c. many capital and agrave; Computer Science, The decision to create a dictionary application is simple.

Database


The most important part of a dictionary application is translation. database (database). The establishment of database for the dictionary must ensure the ability to access quickly by the data of the dictionary usually. Great to meet you. Thankfully, DICT.ORG (www.dict.org) It's a very easy-to-use dictionary format, formatting & formatting. It is a great way to create and edit dictionaries. large. Dict format is m & ocirc; Describe as follows: The database is contained in two files, one containing the meaning of the word v & agrave; an index file. The index file includes the word, The meaning of the start word in the file contains the meaning of & quot; the degree of meaning. Position start v & agrave; The meaning of m & atilde; ho. The following is as follows: Using 64 characters: ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 + /

The letter A is the number 0, the letter c is the number 1, and the letter B is equivalent to the number 1, etc. Between the words, start v & agrave; The meaning of each other by k & yacute; Self-tab (ASCII 9). Each index file contains the data of a word. C & o ;;;;;;;;;;; (ASCII 10).

V Listing in the index file of the German-Vietnamese dictionary. a & d as follows:

Abdeckung kbpP D3

Thus the meaning of the word Abdeckung in the file containing the definition will begin at offset kbpP (according to mk). c. D & D3.

Moving from m & atilde; Base 10 on base 10 is implemented as follows:

For the sake of started: kbpP. This k (at base 64) = 36 (at base 10), b = 27, p = 41, P = 15. So switch to base 10, m & atilde; kbpP c MAXI 36 1 AzSoft_watermark_big.png AzSoft_watermark_small.png cong-nghe?p=1 des.txt en_metadesc.txt en_name.txt getpageinfo.sh getpagelink.sh imglink.txt imglist.txt img.quantrimang.com label:Some Text link_original.txt link.txt log.txt meta_desc.txt name.txt news t-142619 testimg2-0.jpg testimg2-1.jpg testimg2.jpg testimg3.jpg testimg.jpg thumb tim-hieu-excel-2016-200.jpg title_vn.txt tmp02.html tmp03.html tmp2.html tmpdesc2.txt tmpdesc3.txt tmpdesc4.txt tmpdesc5.txt tmpdesc6.txt tmpdesc7.txt tmpdesc.txt tmp.html tmpresult.txt tmptrans.txt transresult.txt wm.quantrimang.com www.mailenable.com www.microsoft.com www.securityfocus.com 643 + 27 1 AzSoft_watermark_big.png AzSoft_watermark_small.png cong-nghe?p=1 des.txt en_metadesc.txt en_name.txt getpageinfo.sh getpagelink.sh imglink.txt imglist.txt img.quantrimang.com label:Some Text link_original.txt link.txt log.txt meta_desc.txt name.txt news t-142619 testimg2-0.jpg testimg2-1.jpg testimg2.jpg testimg3.jpg testimg.jpg thumb tim-hieu-excel-2016-200.jpg title_vn.txt tmp02.html tmp03.html tmp2.html tmpdesc2.txt tmpdesc3.txt tmpdesc4.txt tmpdesc5.txt tmpdesc6.txt tmpdesc7.txt tmpdesc.txt tmp.html tmpresult.txt tmptrans.txt transresult.txt wm.quantrimang.com www.mailenable.com www.microsoft.com www.securityfocus.com 642 + 41 1 AzSoft_watermark_big.png AzSoft_watermark_small.png cong-nghe?p=1 des.txt en_metadesc.txt en_name.txt getpageinfo.sh getpagelink.sh imglink.txt imglist.txt img.quantrimang.com label:Some Text link_original.txt link.txt log.txt meta_desc.txt name.txt news t-142619 testimg2-0.jpg testimg2-1.jpg testimg2.jpg testimg3.jpg testimg.jpg thumb tim-hieu-excel-2016-200.jpg title_vn.txt tmp02.html tmp03.html tmp2.html tmpdesc2.txt tmpdesc3.txt tmpdesc4.txt tmpdesc5.txt tmpdesc6.txt tmpdesc7.txt tmpdesc.txt tmp.html tmpresult.txt tmptrans.txt transresult.txt wm.quantrimang.com www.mailenable.com www.microsoft.com www.securityfocus.com 641 + 15 1 AzSoft_watermark_big.png AzSoft_watermark_small.png cong-nghe?p=1 des.txt en_metadesc.txt en_name.txt getpageinfo.sh getpagelink.sh imglink.txt imglist.txt img.quantrimang.com label:Some Text link_original.txt link.txt log.txt meta_desc.txt name.txt news t-142619 testimg2-0.jpg testimg2-1.jpg testimg2.jpg testimg3.jpg testimg.jpg thumb tim-hieu-excel-2016-200.jpg title_vn.txt tmp02.html tmp03.html tmp2.html tmpdesc2.txt tmpdesc3.txt tmpdesc4.txt tmpdesc5.txt tmpdesc6.txt tmpdesc7.txt tmpdesc.txt tmp.html tmpresult.txt tmptrans.txt transresult.txt wm.quantrimang.com www.mailenable.com www.microsoft.com www.securityfocus.com 640 = 9550415

For degree of significance: D3. This D = 3, 3 = 55. So switch to base 10, m & atilde; D3 at base 64. MAXI : 247.

The index file is arranged to reduce the time it takes for the search. The m & atilde; ho. By contrast, the index file size decreases a lot compared to the size of the file. a.

The file's configuration file contains the following sections:
@headword
1 AzSoft_watermark_small.png cong-nghe? P = 1 des.txt en_metadesc.txt en_name.txt getpageinfo.sh getpagelink.sh imglink.txt imglist.txt img.AzSoft.com label: Some Text link_original.txt link.txt log.txt meta_desc.txt name.txt news t-142619 testimg2-0.jpg testimg2-1.jpg testimg2.jpg testimg3.jpg testimg.jpg thumb tim-hieu-excel-2016-200.jpg title_vn.txt tmp02.html tmp03.html tmp2.html tmpdesc2.txt tmpdesc3.txt tmpdesc4.txt tmpdesc5.txt tmpdesc6.txt tmpdesc7.txt tmpdesc.txt tmp.html tmpresult.txt tmptrans.txt transresult.txt wm.AzSoft.com www.mailenable.com www .microsoft.com www.securityfocus.com tu loai (noun, verb ...)

- Nutrition 1
= cause of the nutrition 1 + the implication of the cause

- Nutrition 2
= cause it is 2 + the reason of the cause
1 AzSoft_watermark_small.png cong-nghe? P = 1 des.txt en_metadesc.txt en_name.txt getpageinfo.sh getpagelink.sh imglink.txt imglist.txt img.AzSoft.com label: Some Text link_original.txt link.txt log.txt meta_desc.txt name.txt news t-142619 testimg2-0.jpg testimg2-1.jpg testimg2.jpg testimg3.jpg testimg.jpg thumb tim-hieu-excel-2016-200.jpg title_vn.txt tmp02.html tmp03.html tmp2.html tmpdesc2.txt tmpdesc3.txt tmpdesc4.txt tmpdesc5.txt tmpdesc6.txt tmpdesc7.txt tmpdesc.txt tmp.html tmpresult.txt tmptrans.txt transresult.txt wm.AzSoft.com www.mailenable.com www .microsoft.com www.securityfocus.com here

- Nutrition 3

The meaning of each word consists of a part as a sequence of consecutive words.

So, you have to be careful. Can be used for editing & editing the dictionary. However, the simplest way to import data is simply to copy and paste the data. But, once again, we are fortunate! c. some of you Aborts some pre-installed dictionaries. C & rsquo; For more information, please visit: www.ttdomain.net/ttdownload/, www.informatik.uni-leipzig.de/~duc/Dict/, huybien.vze.com ... The dictionary also uses another language, For more information, visit the address at www.dict.org.

Create a playlist


Download and install the latest version of Visual C ++ 6.0 and later. MFC library. C & C Can be used in a variety of languages. In the area I write, only the most important parts are provided. C section as interface design, layout interface and so on. Refer to the tutorial chapter. self-created

1. Basic interface:

& bull;
Edit Box: d & ugrave to enter from. The variable for the control: 'Variable name: m_word, Category: Value, Type: Cstring;'

& bull;
WebBrowser: to make sense of the word. The use of WebBrowser is intended only for displaying the visual meaning. More dynamic with the yakute; string (will be mentioned after n & agr; You You can control the ActiveX Web Browser by using the Project-> Add-to-Components-> Components And Controls applet. In the Registered ActiveX Controls folder, navigate to the Microsoft Web Browser. C & i variable for control: 'Variable name: m_wordmean;'

& bull;
Listbox, to display a list of words. The variable for the control: 'Variable name: m_wordlist; Category: Control; '

& bull;
Listbox, to store data about words. C & i variable for control: 'Variable name: m_worddata, Category: Control;'

2. M & AT; program:

& bull;
Load the data in the list box: you put the m & atilde; n & agrave; at the WM_OnInitDialog () event so that the data is loaded right from the start of the program. At the top, you replace the index file with the file corresponding to the dictionary you are using.

TẬP_TIN 1 AzSoft_watermark_big.png AzSoft_watermark_small.png cong-nghe?p=1 des.txt en_metadesc.txt en_name.txt getpageinfo.sh getpagelink.sh imglink.txt imglist.txt img.quantrimang.com label:Some Text link_original.txt link.txt log.txt meta_desc.txt name.txt news t-142619 testimg2-0.jpg testimg2-1.jpg testimg2.jpg testimg3.jpg testimg.jpg thumb tim-hieu-excel-2016-200.jpg title_vn.txt tmp02.html tmp03.html tmp2.html tmpdesc2.txt tmpdesc3.txt tmpdesc4.txt tmpdesc5.txt tmpdesc6.txt tmpdesc7.txt tmpdesc.txt tmp.html tmpresult.txt tmptrans.txt transresult.txt wm.quantrimang.com www.mailenable.com www.microsoft.com www.securityfocus.com inFile;

inFile = fopen ('mydic.index', 'r');

if (inFile == NULL) {

MessageBox ('Can not open index file');

} else {

& nbsp; & nbsp; & nbsp; & nbsp; char 1 AzSoft_watermark_small.png cong-listening? p = 1 des.txt en_metadesc.txt en_name.txt getpageinfo.sh getpagelink.sh imglink.txt imglist.txt img.AzSoft.com label: Some Text link_original.txt link. txt log.txt meta_desc.txt name.txt news t-142619 testimg2-0.jpg testimg2-1.jpg testimg2.jpg testimg3.jpg testimg.jpg thumb tim-hieu-excel-2016-200.jpg title_vn.txt tmp02. html tmp03.html tmp2.html tmpdesc2.txt tmpdesc3.txt tmpdesc4.txt tmpdesc5.txt tmpdesc6.txt tmpdesc7.txt tmpdesc.txt tmp.html tmpresult.txt tmptrans.txt transresult.txt wm.AzSoft.com www.mailenable.com www.microsoft.com www.securityfocus.com line;

& nbsp; & nbsp; & nbsp; & nbsp; char lineBuf [100];

& nbsp; & nbsp; & nbsp; & nbsp; line = (char *) lineBuf;

& nbsp; & nbsp; & nbsp; & nbsp; m_wordlist.ResetContent ();

& nbsp; & nbsp; & nbsp; & nbsp; m_worddata.ResetContent ();

& nbsp; & nbsp; & nbsp; & nbsp; CString word = '';

& nbsp; & nbsp; & nbsp; & nbsp; CString sWord = '';

& nbsp; & nbsp; & nbsp; & nbsp; CString sData = '';

& nbsp; & nbsp; & nbsp; & nbsp; & nbsp; while (! feof (inFile)) {

& nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; fgets (line, 99, inFile);

& nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; if (strlen (line) & gt; = 2) {

& nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; word = line;

& nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; int pos = word.Find ('t', 0);

& nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; sWord = word.Left (pos);

& nbsp; & nbsp; & nbsp; & nbsp; sData = word.Mid (pos + 1, word.

& nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; GetLength () - pos-1);

& nbsp; & nbsp; & nbsp; & nbsp; if (sData.Find ('n', 0) & gt; 0) {

& nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; sData = sData.Left (sData.

& nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; GetLength () - 1); }

& nbsp; & nbsp; & nbsp; & nbsp; if (sWord.GetLength () & gt; = 1) {

& nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; m_wordlist.AddString (sWord);

& nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; m_worddata.AddString (sData);}

}}}

fclose (inFile);

& bull; M & m transfer from m & atilde; Base 64 to 10

int GetDemicalValue (CString str) {

& nbsp; & nbsp; & nbsp; CString base64 = 'ABCDEFGHIJKLM-NOPQRSTUVWXYZabcdefghijklmnopqrstu-vwxyz0123456789 + /';

& nbsp; & nbsp; & nbsp; int decValue = 0;

& nbsp; & nbsp; & nbsp; & nbsp; int len ​​= str.GetLength ();

& nbsp; & nbsp; & nbsp; for (int i = 0; and & lt; len; i ++) {

& nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; int pos = base64.Find (str.

& nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; GetAt (i), 0);

& nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; decValue + = (int) pow (64, len-i-

& nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; 1) pos;

& nbsp;}

return decValue;



& bull; & Mdash; k & self-meaning. As e & atilde; As mentioned above, use the Web Browser control to display the meaning of an animated gif. M & E & Use yacute; k & This means that the HTML tags are meant to be rendered more vividly. For example, bold, red, c & c; instance; blue text, blue text etc.

CString ChangeStyle (CString wordmean) {

& nbsp; & nbsp; CString meaning = wordmean;

& nbsp; & nbsp; meaning = meaning.Right (meaning.GetLength () - 1);

& nbsp; & nbsp; int pos = meaning.Find ('n', 1);

& nbsp; & nbsp; & nbsp; meaning.Insert (pos, '& lt; / b & gt;');

& nbsp; & nbsp; & nbsp; meaning = '& lt; b & gt;' + meaning;

& nbsp; & nbsp; & nbsp; meaning.Replace ('n', '& lt; br & gt;');

& nbsp; & nbsp; & nbsp; meaning.Replace ('{', '& lt; font color =' # FF0000 '& gt; & lt; b & gt;');

& nbsp; & nbsp; meaning.Replace ('}', '& lt; / b & gt; & lt; / font & gt;');

& nbsp; & nbsp; meaning.Replace ('[', 'font color =' # FF0000 '& gt; & lt; b & gt;');

& nbsp; & nbsp; & nbsp; meaning.Replace (']', '& lt; / b & gt; & lt; / font & gt;');

& nbsp; & nbsp; & nbsp; meaning.Replace ('+', '');

& nbsp; & nbsp; & nbsp; return meaning;



& bull; The meaning of the word: h & agrave; read from the file containing the meaning for the meaning of the word, then treat string and then write to temp.htm file. If you take the meaning of the word, you return it. TRUE, if given the meaning of the symbol, and return the value; FALSE. You replace the mydict.dict file with the corresponding dictionary file.

BOOL CXDictDlg :: GetMeaning () {

& nbsp; & nbsp; & nbsp; CFile f;

& nbsp; & nbsp; & nbsp; & nbsp; CString meaning = '';

& nbsp; & nbsp; & nbsp; if (f.Open ('mydic.dict', CFile :: modeRead) == FALSE) {

& nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; = 'Can not open database file!';

} else {

& nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; CString sOffLen;

& nbsp; & nbsp; & nbsp; & nbsp; m_worddata.GetText (m_wordlist.GetCurSel (), sOffLen);

& nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; int pos = sOffLen.Find ('t', 0);

& nbsp; & nbsp; & nbsp; & nbsp; & nbsp; CString sOff = sOffLen.Left (pos);

& nbsp; & nbsp; & nbsp; & nbsp; & nbsp; CString sLen = sOffLen.Right (sOffLen.GetLength () - pos-1);

& nbsp; & nbsp; & nbsp; & nbsp; & nbsp; int iOff = GetDemicalValue (sOff);

& nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; int iLength = GetDemicalValue (sLen);

& nbsp; & nbsp; & nbsp; & nbsp; int temp = f.Seek (iOff, CFile :: begin);

& nbsp; & nbsp; & nbsp; & nbsp; & nbsp; char buff [64];

& nbsp; & nbsp; & nbsp; & nbsp; & nbsp; DWORD dwRead;

& nbsp; & nbsp; & nbsp; & nbsp; & nbsp; to {

& nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; if (iLength & gt; 64)

& nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; dwRead = f.Read (buff, 64);

& nbsp; & nbsp; & nbsp; & nbsp; & nbsp; else

& nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; dwRead = f.Read (buff, iLength);

& nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; iLength - = dwRead;

& nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; CString stemp = buff;

& nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & amp; stampp = stemp.Left (dwRead);

& nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; meaning + = stampp;

& nbsp; & nbsp; & nbsp; & nbsp; while (iLength & gt; 0);

& nbsp; & nbsp; & nbsp; & nbsp; & nbsp; f.Close ();



meaning = ChangeStyle (meaning);

CString strHtml ('');

strHtml + = '& lt; html & gt; n & lt; head & gt; n';

strHtml + = '& lt; meta http-equiv =' Content-Type 'content =' text / html; charset = utf-8 '& gt; n';

strHtml + = '& lt; / head & gt; n & lt; body & gt; n';

strHtml + = meaning + 'n & lt; / body & gt; n & lt; / html & gt;';

CFile f2;

if (f2.Open ('temp.htm', CFile :: modeCreate | CFile :: modeWrite) == FALSE) {

& nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; MessageBox ('Can not write meaning file!', 'Error!');

& nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; return 0;



f2.Write (strHtml, strHtml.GetLength ());

f2.Close ();

return 1;



& bull; Display the meaning of the word, you & m; The DoubleClick event of the list box control.

BOOL gm = GetMeaning ();

if (gm) {

& nbsp; & nbsp; & nbsp; & nbsp; m_wordlist.GetText (m_wordlist.GetCurSel (), m_word);

& nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; UpdateData (FALSE); & nbsp;

& nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; // Layers of the interface

& nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; DWORD cchCurDir;

& nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; LPTSTR lpszCurDir;

& nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; TCHAR buffer [MAX_PATH];

& nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; lpszCurDir = buffer; & nbsp;

& nbsp; & nbsp; & nbsp; & nbsp; & nbsp; GetCurrentDirectory (cchCurDir, lpszCurDir); & nbsp;

& nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; CString str = lpszCurDir;

& nbsp; & nbsp; & nbsp; & nbsp; & nbsp; str = 'file: //' + str + ' temp.htm';

// I think of course

m_wordmean.Navigate

(str, NULL, NULL, NULL, NULL);

} else {

& nbsp; & nbsp; & nbsp; & nbsp; & nbsp; MessageBox ('Can not get the word');



& bull;
The word list in the list box corresponds to the change in the word entered in the Edit control. You set the m & atilde; The agence of EN_CHANGE control of the Edit control. So every time you have a 1k & From the Edit control, the program automatically selects the most common word in the list of words.

UpdateData (TRUE);

m_wordlist.SelectString (-1, m_word);

After you have created your account, you will be prompted to enter your username and password. interface like h.

Attributes, Learn how to build a simple dictionary application. With these created & agrave; atilde knowledge You & # 39; ve been up & Can add new capabilities to the dictionary app to help you. The loss of a commercial dictionary software. I came out with a dictionary format. As simple as you can, It is easy to create a new application for creating new dictionaries automatically.

I would also like to introduce you to some of the software / Use the standard dictionary of DICT.ORG for your reference.

& bull;
Website of Ho Ngoc Duc , at www.informatik.uni-leipzig.de/~duc/Dict/, at online dictionary lookup or download application written in Java v & agrave; A dictionary file to run directly from the dictionary.

About PowerClick , www.ttdomain.net/ttdownload. Software atilde; introduced by TGVT - PCW VN A 7/2004, Click and See look up some applications.

& bull;
E-lexicon, www.edusoft.com.vn. Software atilde; Introduction of microfinance - PCW VN A 7/2004, Client - Server.

& bull;
MultiDictionary , http://huybien.vze.com/. Many dictionaries, nice interface, c & o; English, Russian, Phonetic, German.

Make sure you have the correct & With & ldquo;

Tran B & igrave;
b_v_a_l@yahoo.com