Advertisement
alien_fx_fiend

Dictionary GUI-Based Win32 (Final /w and w/o Duplicates!!!)

Jul 29th, 2024
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 21.15 KB | None | 0 0
  1. realtime-search.cpp::
  2. #include <Windows.h>
  3. #include <fstream>
  4. #include <sstream>
  5. #include <string>
  6. #include <algorithm>
  7. #include <vector>
  8. #include "resource2.h"
  9.  
  10. using namespace std;
  11.  
  12. // Structure to represent a dictionary entry
  13. struct DictionaryEntry {
  14.     wstring word;
  15.     wstring definition;
  16. };
  17.  
  18. // Structure to represent a node in the linked list
  19. struct Node {
  20.     DictionaryEntry data;
  21.     Node* next;
  22. };
  23.  
  24. Node* dictionary = nullptr;
  25. vector<wstring> words;
  26.  
  27. // Function prototypes
  28. void insertNode(Node*& head, const DictionaryEntry& entry);
  29. //void addWord(Node*& head, const wstring& word, const wstring& definition);
  30. bool addWord(Node*& head, const wstring& word, const wstring& definition);
  31. void deleteWord(Node*& head, const wstring& keyword);
  32. wstring InputBox(HWND hwnd, const wstring& prompt, const wstring& title);
  33. void DisplayDefinition(HWND hwnd, const wstring& word, const wstring& definition);
  34. void editWord(Node* head, const wstring& oldWord, const wstring& newWord, const wstring& newDefinition);
  35. void listWords(const Node* head, vector<wstring>& words);
  36. void serializeDictionary(const Node* head, const wstring& filename);
  37. void deserializeDictionary(Node*& head, const wstring& filename);
  38. void searchWordRealtime(const Node* head, const wstring& keyword, vector<wstring>& suggestions);
  39. void updateListBox(HWND hwnd, const vector<wstring>& words);
  40.  
  41. // Function implementations
  42. void insertNode(Node*& head, const DictionaryEntry& entry) {
  43.     Node* newNode = new Node{ entry, nullptr };
  44.     if (!head) {
  45.         head = newNode;
  46.     }
  47.     else {
  48.         Node* current = head;
  49.         while (current->next) {
  50.             current = current->next;
  51.         }
  52.         current->next = newNode;
  53.     }
  54. }
  55.  
  56. // Modify the addWord function to check for duplicates
  57. bool addWord(Node*& head, const wstring& word, const wstring& definition) {
  58.     // Check if the word already exists
  59.     Node* current = head;
  60.     while (current) {
  61.         if (current->data.word == word) {
  62.             return false; // Word already exists, don't add
  63.         }
  64.         current = current->next;
  65.     }
  66.  
  67.     // Word doesn't exist, add it
  68.     insertNode(head, { word, definition });
  69.     return true;
  70. }
  71. // /w duplicates
  72. /*void addWord(Node*& head, const wstring& word, const wstring& definition) {
  73.     insertNode(head, { word, definition });
  74. }*/
  75.  
  76. void deleteWord(Node*& head, const wstring& keyword) {
  77.     if (!head) return;
  78.  
  79.     if (head->data.word == keyword) {
  80.         Node* temp = head;
  81.         head = head->next;
  82.         delete temp;
  83.         return;
  84.     }
  85.  
  86.     Node* current = head;
  87.     while (current->next && current->next->data.word != keyword) {
  88.         current = current->next;
  89.     }
  90.  
  91.     if (current->next) {
  92.         Node* temp = current->next;
  93.         current->next = current->next->next;
  94.         delete temp;
  95.     }
  96. }
  97.  
  98. // Modify the InputBox function to pre-populate the input
  99. wstring InputBox(HWND hwnd, const wstring& prompt, const wstring& title, const wstring& defaultValue = L"") {
  100.     wstring input = defaultValue;
  101.     DialogBoxParam(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_INPUT), hwnd,
  102.         [](HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) -> INT_PTR {
  103.             static wstring* pInput;
  104.             switch (message) {
  105.             case WM_INITDIALOG:
  106.                 pInput = (wstring*)lParam;
  107.                 SetDlgItemText(hDlg, IDC_INPUT, pInput->c_str());
  108.                 SendDlgItemMessage(hDlg, IDC_INPUT, EM_SETSEL, 0, -1);  // Select all text
  109.                 return (INT_PTR)TRUE;
  110.             case WM_COMMAND:
  111.                 if (LOWORD(wParam) == IDOK) {
  112.                     HWND hEdit = GetDlgItem(hDlg, IDC_INPUT);
  113.                     int len = GetWindowTextLength(hEdit) + 1;
  114.                     wchar_t* buffer = new wchar_t[len];
  115.                     GetWindowText(hEdit, buffer, len);
  116.                     *pInput = buffer;
  117.                     delete[] buffer;
  118.                     EndDialog(hDlg, IDOK);
  119.                     return (INT_PTR)TRUE;
  120.                 }
  121.                 else if (LOWORD(wParam) == IDCANCEL) {
  122.                     EndDialog(hDlg, IDCANCEL);
  123.                     return (INT_PTR)TRUE;
  124.                 }
  125.                 break;
  126.             }
  127.             return (INT_PTR)FALSE;
  128.         }, (LPARAM)&input);
  129.     return input;
  130. }
  131. /*wstring InputBox(HWND hwnd, const wstring& prompt, const wstring& title) {
  132.     wchar_t input[156] = L"";
  133.     if (DialogBoxParam(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_INPUT), hwnd,
  134.         [](HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) -> INT_PTR {
  135.             static wchar_t input[156];
  136.             switch (message) {
  137.             case WM_INITDIALOG: {
  138.                 HWND hEdit = GetDlgItem(hDlg, IDC_INPUT);
  139.                 SetWindowText(hEdit, (LPCWSTR)lParam);
  140.                 SendMessage(hEdit, EM_SETSEL, 0, -1); // Select all text
  141.                 break;
  142.             }
  143.             case WM_COMMAND:
  144.                 if (LOWORD(wParam) == IDOK) {
  145.                     GetDlgItemText(hDlg, IDC_INPUT, input, 156);
  146.                     EndDialog(hDlg, IDOK);
  147.                     return (INT_PTR)TRUE;
  148.                 }
  149.                 else if (LOWORD(wParam) == IDCANCEL) {
  150.                     EndDialog(hDlg, IDCANCEL);
  151.                     return (INT_PTR)TRUE;
  152.                 }
  153.                 break;
  154.             }
  155.             return (INT_PTR)FALSE;
  156.         }, (LPARAM)prompt.c_str()) == IDOK) {
  157.         return (wstring)input;
  158.     }
  159.     return L"";
  160. }*/
  161.  
  162. void DisplayDefinition(HWND hwnd, const wstring& word, const wstring& definition) {
  163.     wstring message = L"Definition of '" + word + L"':\n\n" + definition;
  164.     HWND hDlg = CreateDialogParam(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_DEFINITION), hwnd, [](HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) -> INT_PTR {
  165.         switch (message) {
  166.         case WM_INITDIALOG:
  167.         {
  168.             wstring* definition = (wstring*)lParam;
  169.             SetDlgItemText(hDlg, IDC_DEFINITION_EDIT, definition->c_str());
  170.             delete definition;
  171.         }
  172.         return (INT_PTR)TRUE;
  173.         case WM_COMMAND:
  174.             if (LOWORD(wParam) == IDCANCEL) {
  175.                 EndDialog(hDlg, LOWORD(wParam));
  176.                 return (INT_PTR)TRUE;
  177.             }
  178.             break;
  179.         case WM_CLOSE:
  180.             EndDialog(hDlg, 0);
  181.             return (INT_PTR)TRUE;
  182.         }
  183.         return (INT_PTR)FALSE;
  184.         }, (LPARAM)new wstring(message));
  185.     ShowWindow(hDlg, SW_SHOW);
  186. }
  187. /*void DisplayDefinition(HWND hwnd, const wstring& word, const wstring& definition) {
  188.     wstring message = L"Definition of '" + word + L"':\n\n" + definition;
  189.     MessageBox(hwnd, message.c_str(), L"Word Definition", MB_OK | MB_ICONINFORMATION);
  190. }*/
  191.  
  192. void editWord(Node* head, const wstring& oldWord, const wstring& newWord, const wstring& newDefinition) {
  193.     Node* current = head;
  194.     while (current) {
  195.         if (current->data.word == oldWord) {
  196.             current->data.word = newWord;
  197.             current->data.definition = newDefinition;
  198.             return;
  199.         }
  200.         current = current->next;
  201.     }
  202. }
  203.  
  204. void listWords(const Node* head, vector<wstring>& words) {
  205.     words.clear();
  206.     const Node* current = head;
  207.     while (current) {
  208.         words.push_back(current->data.word);
  209.         current = current->next;
  210.     }
  211. }
  212.  
  213. void serializeDictionary(const Node* head, const wstring& filename) {
  214.     wofstream file(filename);
  215.     const Node* current = head;
  216.     while (current) {
  217.         file << current->data.word << L";" << current->data.definition << endl;
  218.         current = current->next;
  219.     }
  220.     file.close();
  221. }
  222.  
  223. void deserializeDictionary(Node*& head, const wstring& filename) {
  224.     wifstream file(filename);
  225.     wstring line;
  226.     while (getline(file, line)) {
  227.         size_t pos = line.find(L';');
  228.         if (pos != wstring::npos) {
  229.             wstring word = line.substr(0, pos);
  230.             wstring definition = line.substr(pos + 1);
  231.             addWord(head, word, definition);
  232.         }
  233.     }
  234.     file.close();
  235. }
  236.  
  237. // Add this function to convert a string to lowercase
  238. wstring toLower(const wstring& str) {
  239.     wstring lower = str;
  240.     transform(lower.begin(), lower.end(), lower.begin(), ::towlower);
  241.     return lower;
  242. }
  243.  
  244. // Modify the searchWordRealtime function to be case-insensitive
  245. void searchWordRealtime(const Node* head, const wstring& keyword, vector<wstring>& suggestions) {
  246.     suggestions.clear();
  247.     const Node* current = head;
  248.     wstring lowercaseKeyword = toLower(keyword);
  249.     while (current) {
  250.         wstring lowercaseWord = toLower(current->data.word);
  251.         if (lowercaseWord.find(lowercaseKeyword) != wstring::npos) {
  252.             suggestions.push_back(current->data.word);
  253.         }
  254.         current = current->next;
  255.     }
  256. }
  257.  
  258. void updateListBox(HWND hwnd, const vector<wstring>& words) {
  259.     HWND hListBox = GetDlgItem(hwnd, IDC_LISTBOX);
  260.     SendMessage(hListBox, LB_RESETCONTENT, 0, 0);
  261.     for (const auto& word : words) {
  262.         SendMessage(hListBox, LB_ADDSTRING, 0, (LPARAM)word.c_str());
  263.     }
  264. }
  265.  
  266. // Dialog procedure
  267. // Modify the DialogProc function
  268. INT_PTR CALLBACK DialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) {
  269.     switch (uMsg) {
  270.     case WM_INITDIALOG:
  271.         deserializeDictionary(dictionary, L"dictionary.txt");
  272.         listWords(dictionary, words);
  273.         updateListBox(hwnd, words);
  274.         return TRUE;
  275.  
  276.     case WM_COMMAND:
  277.         switch (LOWORD(wParam)) {
  278.         case IDC_ADD_WORD: {
  279.             wchar_t word[256], definition[1024];
  280.             GetDlgItemText(hwnd, IDC_WORD_INPUT, word, 256);
  281.             GetDlgItemText(hwnd, IDC_DEFINITION_INPUT, definition, 1024);
  282.             if (wcslen(word) > 0) {
  283.                 if (addWord(dictionary, word, definition)) {
  284.                     listWords(dictionary, words);
  285.                     updateListBox(hwnd, words);
  286.                     serializeDictionary(dictionary, L"dictionary.txt");
  287.                     SetDlgItemText(hwnd, IDC_WORD_INPUT, L"");
  288.                     SetDlgItemText(hwnd, IDC_DEFINITION_INPUT, L"");
  289.                 }
  290.                 // If addWord returns false, it means the word already exists.
  291.                 // We silently ignore it as per the requirement.
  292.             }
  293.             return TRUE;
  294.         }
  295.         // /w duplicates        
  296.         /*case IDC_ADD_WORD: {
  297.             wchar_t word[256], definition[1024];
  298.             GetDlgItemText(hwnd, IDC_WORD_INPUT, word, 256);
  299.             GetDlgItemText(hwnd, IDC_DEFINITION_INPUT, definition, 1024);
  300.             if (wcslen(word) > 0) {  // Only check if word is not empty
  301.                 addWord(dictionary, word, definition);
  302.                 listWords(dictionary, words);
  303.                 updateListBox(hwnd, words);
  304.                 serializeDictionary(dictionary, L"dictionary.txt");
  305.                 SetDlgItemText(hwnd, IDC_WORD_INPUT, L"");
  306.                 SetDlgItemText(hwnd, IDC_DEFINITION_INPUT, L"");
  307.             }
  308.             return TRUE;
  309.         }*/
  310.  
  311.         case IDC_DELETE_WORD: {
  312.             int index = SendDlgItemMessage(hwnd, IDC_LISTBOX, LB_GETCURSEL, 0, 0);
  313.             if (index != LB_ERR) {
  314.                 wchar_t word[256];
  315.                 SendDlgItemMessage(hwnd, IDC_LISTBOX, LB_GETTEXT, index, (LPARAM)word);
  316.  
  317.                 // Create the confirmation message
  318.                 wstring message = L"Are you sure you want to delete the word '";
  319.                 message += word;
  320.                 message += L"'?";
  321.  
  322.                 // Show the confirmation box
  323.                 int result = MessageBox(hwnd, message.c_str(), L"Confirm Deletion", MB_YESNO | MB_ICONQUESTION);
  324.  
  325.                 // If the user clicks "Yes", proceed with deletion
  326.                 if (result == IDYES) {
  327.                     deleteWord(dictionary, word);
  328.                     listWords(dictionary, words);
  329.                     updateListBox(hwnd, words);
  330.                     serializeDictionary(dictionary, L"dictionary.txt");
  331.                 }
  332.             }
  333.             return TRUE;
  334.         }
  335.  
  336.         case IDC_EDIT_WORD: {
  337.             int index = SendDlgItemMessage(hwnd, IDC_LISTBOX, LB_GETCURSEL, 0, 0);
  338.             if (index != LB_ERR) {
  339.                 wchar_t wordToEdit[256];
  340.                 SendDlgItemMessage(hwnd, IDC_LISTBOX, LB_GETTEXT, index, (LPARAM)wordToEdit);
  341.                 Node* current = dictionary;
  342.                 while (current) {
  343.                     if (current->data.word == wordToEdit) {
  344.                         wstring newWord = InputBox(hwnd, L"Edit Word", L"Edit Word", current->data.word);
  345.                         if (!newWord.empty()) {
  346.                             wstring newDefinition = InputBox(hwnd, L"Edit Definition", L"Edit Definition", current->data.definition);
  347.                             // newDefinition can be empty now
  348.                             SendDlgItemMessage(hwnd, IDC_LISTBOX, LB_DELETESTRING, index, 0); // Delete the old word
  349.                             editWord(dictionary, wordToEdit, newWord, newDefinition);
  350.                             listWords(dictionary, words);
  351.                             updateListBox(hwnd, words);
  352.                             for (int i = 0; i < words.size(); i++) {
  353.                                 if (words[i] == newWord) {
  354.                                     SendDlgItemMessage(hwnd, IDC_LISTBOX, LB_SETCURSEL, i, 0); // Select the edited word
  355.                                     break;
  356.                                 }
  357.                             }
  358.                             serializeDictionary(dictionary, L"dictionary.txt");
  359.                         }
  360.                         break;
  361.                     }
  362.                     current = current->next;
  363.                 }
  364.                 if (!current) {
  365.                     MessageBox(hwnd, L"Word not found in the dictionary.", L"Error", MB_OK | MB_ICONERROR);
  366.                 }
  367.             }
  368.             return TRUE;
  369.         }
  370.         // /w duplicates (does not affect duplicates tho only no check for blank definitions
  371.         /*case IDC_EDIT_WORD: {
  372.             int index = SendDlgItemMessage(hwnd, IDC_LISTBOX, LB_GETCURSEL, 0, 0);
  373.             if (index != LB_ERR) {
  374.                 wchar_t wordToEdit[256];
  375.                 SendDlgItemMessage(hwnd, IDC_LISTBOX, LB_GETTEXT, index, (LPARAM)wordToEdit);
  376.                 Node* current = dictionary;
  377.                 while (current) {
  378.                     if (current->data.word == wordToEdit) {
  379.                         wstring newWord = InputBox(hwnd, L"Edit Word", L"Edit Word", current->data.word);
  380.                         if (!newWord.empty()) {
  381.                             wstring newDefinition = InputBox(hwnd, L"Edit Definition", L"Edit Definition", current->data.definition);
  382.                             SendDlgItemMessage(hwnd, IDC_LISTBOX, LB_DELETESTRING, index, 0); // Delete the old word
  383.                             editWord(dictionary, wordToEdit, newWord, newDefinition);
  384.                             listWords(dictionary, words);
  385.                             updateListBox(hwnd, words);
  386.                             for (int i = 0; i < words.size(); i++) {
  387.                                 if (words[i] == newWord) {
  388.                                     SendDlgItemMessage(hwnd, IDC_LISTBOX, LB_SETCURSEL, i, 0); // Select the edited word
  389.                                     break;
  390.                                 }
  391.                             }
  392.                             serializeDictionary(dictionary, L"dictionary.txt");
  393.                         }
  394.                         break;
  395.                     }
  396.                     current = current->next;
  397.                 }
  398.                 if (!current) {
  399.                     MessageBox(hwnd, L"Word not found in the dictionary.", L"Error", MB_OK | MB_ICONERROR);
  400.                 }
  401.             }
  402.             return TRUE;
  403.         }*/
  404.  
  405.         case IDC_VIEW_DEFINITION: {
  406.             int index = SendDlgItemMessage(hwnd, IDC_LISTBOX, LB_GETCURSEL, 0, 0);
  407.             if (index != LB_ERR) {
  408.                 wchar_t word[256];
  409.                 SendDlgItemMessage(hwnd, IDC_LISTBOX, LB_GETTEXT, index, (LPARAM)word);
  410.                 Node* current = dictionary;
  411.                 while (current) {
  412.                     if (current->data.word == word) {
  413.                         DisplayDefinition(hwnd, current->data.word, current->data.definition);
  414.                         break;
  415.                     }
  416.                     current = current->next;
  417.                 }
  418.             }
  419.             return TRUE;
  420.         }
  421.  
  422.         case IDC_SEARCH_INPUT: {
  423.             if (HIWORD(wParam) == EN_CHANGE) {
  424.                 wchar_t query[256];
  425.                 GetDlgItemText(hwnd, IDC_SEARCH_INPUT, query, 256);
  426.                 if (wcslen(query) == 0) {
  427.                     updateListBox(hwnd, words);
  428.                 }
  429.                 else {
  430.                     vector<wstring> suggestions;
  431.                     searchWordRealtime(dictionary, query, suggestions);
  432.                     updateListBox(hwnd, suggestions);
  433.                 }
  434.             }
  435.             return TRUE;
  436.         }
  437.  
  438.         case IDC_CLEAR_SEARCH: {
  439.             SetDlgItemText(hwnd, IDC_SEARCH_INPUT, L"");
  440.             updateListBox(hwnd, words);
  441.             return TRUE;
  442.         }
  443.  
  444.         case IDCANCEL:
  445.             DestroyWindow(hwnd);
  446.             PostQuitMessage(0);
  447.             return TRUE;
  448.         }
  449.         break;
  450.  
  451.     case WM_CLOSE:
  452.         DestroyWindow(hwnd);
  453.         PostQuitMessage(0);
  454.         return TRUE;
  455.     }
  456.     return FALSE;
  457. }
  458.  
  459. int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCmdShow) {
  460.     HWND hDlg = CreateDialogParam(hInstance, MAKEINTRESOURCE(IDD_MAINDIALOG), 0, DialogProc, 0);
  461.     if (!hDlg) {
  462.         MessageBox(NULL, L"Failed to create dialog", L"Error", MB_ICONERROR | MB_OK);
  463.         return 1;
  464.     }
  465.  
  466.     ShowWindow(hDlg, nCmdShow);
  467.  
  468.     MSG msg;
  469.     BOOL bRet;
  470.     while ((bRet = GetMessage(&msg, nullptr, 0, 0)) != 0) {
  471.         if (bRet == -1) {
  472.             // Handle the error and possibly exit
  473.             break;
  474.         }
  475.         else if (!IsWindow(hDlg) || !IsDialogMessage(hDlg, &msg)) {
  476.             TranslateMessage(&msg);
  477.             DispatchMessage(&msg);
  478.         }
  479.     }
  480.  
  481.     return (int)msg.wParam;
  482. }
  483.  
  484. Resource2.rc
  485. #include <windows.h>
  486. #include "resource2.h"
  487.  
  488. IDD_MAINDIALOG DIALOGEX 0, 0, 320, 240
  489. STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
  490. CAPTION "Dictionary Application"
  491. FONT 8, "MS Shell Dlg", 400, 0, 0x1
  492. BEGIN
  493. LTEXT           "Word:", -1, 10, 10, 30, 8
  494. EDITTEXT        IDC_WORD_INPUT, 50, 8, 110, 14, ES_AUTOHSCROLL
  495. LTEXT           "Definition:", -1, 10, 30, 40, 8
  496. EDITTEXT        IDC_DEFINITION_INPUT, 50, 28, 200, 14, ES_AUTOHSCROLL
  497. PUSHBUTTON      "Add Word", IDC_ADD_WORD, 260, 8, 50, 14
  498. PUSHBUTTON      "Delete Word", IDC_DELETE_WORD, 260, 28, 50, 14
  499. PUSHBUTTON      "Edit Word", IDC_EDIT_WORD, 260, 48, 50, 14
  500. PUSHBUTTON      "View Definition", IDC_VIEW_DEFINITION, 200, 8, 50, 14
  501. PUSHBUTTON      "Clear", IDC_CLEAR_SEARCH, 170, 8, 20, 14
  502. LTEXT           "Search:", -1, 10, 50, 30, 8
  503. EDITTEXT        IDC_SEARCH_INPUT, 50, 48, 200, 14, ES_AUTOHSCROLL
  504. LISTBOX         IDC_LISTBOX, 10, 70, 300, 160, LBS_SORT | LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP
  505. END
  506.  
  507. IDD_INPUT DIALOGEX 0, 0, 250, 120
  508. STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
  509. CAPTION "Input"
  510. FONT 8, "MS Shell Dlg", 400, 0, 0x1
  511. BEGIN
  512. LTEXT           "Input:", -1, 7, 14, 50, 8
  513. EDITTEXT        IDC_INPUT, 7, 30, 230, 20, ES_AUTOHSCROLL
  514. DEFPUSHBUTTON   "OK", IDOK, 70, 60, 50, 14
  515. PUSHBUTTON      "Cancel", IDCANCEL, 130, 60, 50, 14
  516. END
  517.  
  518. IDD_DEFINITION DIALOGEX 0, 0, 300, 200
  519. STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
  520. CAPTION "Definition"
  521. FONT 8, "MS Shell Dlg"
  522. BEGIN
  523. EDITTEXT        IDC_DEFINITION_EDIT, 7, 7, 286, 186, ES_MULTILINE | ES_AUTOVSCROLL | ES_READONLY | WS_VSCROLL
  524. END
  525.  
  526. /*IDD_INPUT DIALOGEX 0, 0, 200, 100
  527. STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
  528. CAPTION "Input"
  529. FONT 8, "MS Shell Dlg"
  530. BEGIN
  531. LTEXT           "Input:", -1, 7, 14, 50, 8
  532. EDITTEXT        IDC_INPUT, 7, 24, 186, 12, ES_AUTOHSCROLL
  533. DEFPUSHBUTTON   "OK", IDOK, 139, 7, 50, 14
  534. PUSHBUTTON      "Cancel", IDCANCEL, 139, 24, 50, 14
  535. END*/
  536.  
  537. //EDITTEXT        IDC_WORD_INPUT, 50, 8, 100, 14, ES_AUTOHSCROLL
  538. //PUSHBUTTON      "Add Word", IDC_ADD_WORD, 260, 8, 50, 14
  539. //PUSHBUTTON      "View Definition", IDC_VIEW_DEFINITION, 260, 68, 50, 14
  540.  
  541. resource2.h::
  542. #ifndef RESOURCE2_H
  543. #define RESOURCE2_H
  544.  
  545. #define IDD_MAINDIALOG                  101
  546. #define IDC_WORD_INPUT                  1001
  547. #define IDC_DEFINITION_INPUT            1002
  548. #define IDC_ADD_WORD                    1003
  549. #define IDC_DELETE_WORD                 1004
  550. #define IDC_SEARCH_INPUT                1005
  551. #define IDC_LISTBOX                     1006
  552. #define IDC_INPUT                       1007  // Add this line if you're using IDC_INPUT
  553. #define IDC_EDIT_WORD                   1008
  554. #define IDC_VIEW_DEFINITION             1009
  555. #define IDD_INPUT                       1010
  556. #define IDD_DEFINITION                  1011
  557. #define IDC_DEFINITION_EDIT             1012
  558. #define IDC_CLEAR_SEARCH                1013
  559.  
  560. #endif // RESOURCE2_H
  561.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement