Source code for Jinshan phrase

zhaozj2021-02-16  50

First of all, this code is aimed at "Jinshan Word 2003", and the other versions of Jinshan Words need to be slightly modified.

Source code description:

1: Please download LoadDll yourself and study it (just simply modify the command line):

Http://www.codeguru.com/cpp/w-p/dll/Article.php/c105/

2: Replace these TestFunction () to 4 source code in 4

3: Note:

3.1) // The Following Code Is To Read ExplanationList and

/ End of code to read explanation /

The code is interpreted by reading words.

3.2)

// the folowing code is to read word list

with

/ End of code to read Word List /

It is a list of words to read the word.

Please modify yourself

4. Source code

File * g_fileciba = null; void writeword (int Nindex, lpctstr pszstring) {static const INT string_max = 1024 * 100; static tchar pszbuffer [string_max 1] = ""

IF (pszstring == null) {// flush the buffer: pszbuffer ife (strlen (pszbuffer)> 0) FPUTS (PSZBuffer, g_fileciba); return;}}} (strlen (pszstring)> string_max) {:: messagebox (0, "Word Too Long!", _T ("Testlib"), MB_OK; RETURN;}

IF (pszstring) strlen (pszbuffer)> string_max) {// flush the buffer: pszbuffer fputs (pszbuffer, g_fileciba); // clear the content MEMSET (PSZBuffer, 0, Sizeof (pszbuffer);

Strcpy (pszbuffer, pszstring);} else {strat (pszbuffer, "##### / r / n"); // symbol to seperate each Word Strcat (pszbuffer, pszstring); strcat (pszbuffer, "/ r / n ");}}

Ulong testfunction () {/ // only for? Eé? '°? 2003! / Static const int word_max = 255; static const Int string_max = 1024 * 10; tchar psztext [string_max 1]; tchar pszcaption [word_max]; Tchar Pszword [Word_max 1];

// Find the main window HWND hWndCiba = GetWindow (GetDesktopWindow (), GW_CHILD); while (hWndCiba) {GetWindowText (hWndCiba, pszText, WORD_MAX); if (strstr (pszText, "? Eé 'ê °??") =! NULL) BREAK; / / DID NOT FIND WINDOW, GET next window in list. Hwndciba = getWindow (hwndciba, gw_hwndnext);} f (hwndciba == null) {:: messagebox (0, "? Ò2? Μ? Eé? '°? ", _T (" testlib "), MB_OK; return 0;} // Find the window which id is 0x3ea, The Combo Show the word selected hwnd hwndcombo = getWindow (hwndciba, gw_child); while (hwndcombo ) {GetWindowText (hWndCombo, pszText, WORD_MAX); if (GetWindowLong (hWndCombo, GWL_ID) == 0x3EA) break; hWndCombo = GetWindow (hWndCombo, GW_HWNDNEXT);} if (hWndCombo == NULL) {:: MessageBox (0, " Can not find the combo ", _t (" testlib "), mb_ok); return 0;}

// Find the window which ID is 0x434, the list of words (or which caption is "WordList") HWND hWndWordList = GetWindow (hWndCiba, GW_CHILD);. While (hWndWordList) {GetWindowText (hWndWordList, pszText, WORD_MAX); if ( GetWindowLong (hWndWordList, GWL_ID) == 0x434) break; hWndWordList = GetWindow (hWndWordList, GW_HWNDNEXT);} if (hWndWordList == NULL) {:: MessageBox (0, "Can NOT find the list", _T ( "TestLib") , MB_OK); Return 0;}

// Find the window which ID is 0x3F1, the explanation window HWND hWndExplain = GetWindow (hWndCiba, GW_CHILD);. While (hWndExplain) {GetWindowText (hWndExplain, pszText, WORD_MAX); if (GetWindowLong (hWndExplain, GWL_ID) == 0x3F1) Break; hwndexplain = getWindow (hwndexplain, gw_hwndnext);} if (hwndexplain == null) {:: messagebox (0, "can not find the explanation window", _T ("testlib"), MB_OK; return 0;} / // Select the next item to enable the word shown in the ComboBox // Then read the word from the ComboBox // I have tried to use ListView_GetItemText (hWndWordList, 0,0, lpszWord, 255); // to read the word from List Directly, But Failed! // Maybe It is Because? Eé? ê °? Encrypts the list ?? / int nprevindex, nindex; int ncount

g_fileciba = fopen ("c: //ciba.txt", "w"); if (g_fileciba == null) {:: messagebox (0, "can not open the file! / nprogram EXITS ...", _T ( "TestLib"), MB_OK); return 0;} GetWindowText (hWndCiba, pszCaption, WORD_MAX); nCount = ListView_GetItemCount (hWndWordList); // get item count nPrevIndex = ListView_GetNextItem (hWndWordList, -1, LVIS_SELECTED);

// The following code is to read explanationlist LPTSTR lptstr; for (nIndex = 0; nIndex

SendMessage (hWndCiba, WM_COMMAND, (WPARAM) 32791, NULL); SendMessage (hWndCiba, WM_COMMAND, (WPARAM) 32775, NULL); OpenClipboard (NULL); HGLOBAL hglb = GetClipboardData (CF_TEXT); if (! Hglb = NULL) {lptstr = (LPTSTR) Globalock (HGLB); Writeword (Nindex, LPTSTR); // Write The Word Into The File GlobalUnlock (HGLB);} CloseClipboard ();

// Show the progress if (Nindex% 100 == 0) {_stprintf (psztext, "getwords - [% D /% D] %%%. 2F", NINDEX, NCOUNT, (FLOAT) NINDEX / NCOUNT * 100.0F) HDC HDC = Getdc (NULL); Textout (HDC, 10, 10, PSZText, Strlen (PSZText)); Textout (HDC, 10, 10, PSZText, Strlen (psztext));}} / end of code to read explanation /

// The following code is to read word list / * for (nIndex = 0; nIndex

Writeword (Nindex, Pszword); // Write the Word Into the file

// Show the progress if (Nindex% 100 == 0) {_stprintf (psztext, "getwords - [% D /% D] %%%. 2F", NINDEX, NCOUNT, (FLOAT) NINDEX / NCOUNT * 100.0F) HDC HDC = Getdc (NULL); Textout (HDC, 10, 10, PSZText, Strlen (PSZText)); Textout (HDC, 10, 10, PSZText, Strlen (PSzText));}} * / / end of code to Read Word List /

Writeword (0, null); // Flush the buffer fclose (g_fileciba); return 1;}

转载请注明原文地址:https://www.9cbs.com/read-19808.html

New Post(0)