Разработка информационно-поисковой системы, страница 10

void  load_combobox(LVWnd_t * wnd, HWND hCombo);

void  update_item(LVWnd_t * wnd, char * data);

int         delete_row(LVWnd_t * wnd);

int         insert_row(LVWnd_t * wnd, char ** data);

Файл gui\about_wnd.c :

#include "..\CORE\main.h"

/* Обработчик сообщений окна "О программе" */

LRESULT CALLBACK AboutWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)

{

      switch (message)

      {

      case WM_INITDIALOG:

            return TRUE;

      case WM_COMMAND:

            if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL)

            {

                  EndDialog(hWnd, LOWORD(wParam));

                  return TRUE;

            }

      }

      return FALSE;

}

Файл gui\gui_main.c :

#include "..\CORE\main.h"

HWND hMainWnd, hMDIClientWnd, hCombo, hListView;

HACCEL hAccel;

HWND hStudentsWnd, hStudentsListWnd;

HWND hGroupsWnd,   hGroupsListWnd;

HWND hResultsWnd,  hResultsListWnd;

HWND hLessonsWnd,  hLessonsListWnd;

TCHAR app_name [] = "MetaDB";

TCHAR main_wnd_class [] = "main_wnd_class";

TCHAR students_wnd_class [] = "list_mnd_class";

TCHAR groups_wnd_class [] = "groups_mnd_class";

TCHAR lessons_wnd_class [] = "lessons_mnd_class";

TCHAR result_wnd_class [] = "result_mnd_class";

int hash = 0;

OPENFILENAME ofn;

TCHAR filename[MAX_PATH];

/* регистрация оконных классов */

inline void RegisterWindowsClasses()

{

      WNDCLASSEX wcex;

      memset(&wcex, 0, sizeof(WNDCLASSEX));

      wcex.cbSize = sizeof(WNDCLASSEX);

      wcex.style = CS_HREDRAW|CS_VREDRAW;

      wcex.lpfnWndProc = (WNDPROC)MainWndProc;

      wcex.hInstance = hInstance;

      wcex.hCursor = LoadCursor(NULL, IDC_ARROW);

      wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW);

      wcex.lpszMenuName = (LPCTSTR)IDR_MENU;

      wcex.lpszClassName =(LPCTSTR)main_wnd_class;

      wcex.hIcon = LoadIcon(hInstance, (LPCTSTR)IDI_ICON);

      RegisterClassEx(&wcex);

      wcex.lpszMenuName = 0;

      wcex.lpfnWndProc = (WNDPROC)TableWndProc;

      wcex.lpszClassName =(LPCTSTR)table_wnd_class;

      RegisterClassEx(&wcex);

      wcex.lpfnWndProc = (WNDPROC)ResultsWndProc;

      wcex.lpszClassName =(LPCTSTR)result_wnd_class;

      RegisterClassEx(&wcex);

}

/* инициализация графического интерфейса */

int InitGUI()

{

      //InitCommonControls();

      INITCOMMONCONTROLSEX icex;

      icex.dwSize = sizeof(INITCOMMONCONTROLSEX);

      icex.dwICC  = ICC_LISTVIEW_CLASSES;

      InitCommonControlsEx(&icex);

      RegisterWindowsClasses();

      /* создание главного окна */

      hMainWnd = CreateWindow (main_wnd_class, app_name, WS_OVERLAPPEDWINDOW,

      CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL);

      if (!hMainWnd)

            return 0;

      hAccel = LoadAccelerators (hInstance, MAKEINTRESOURCE(IDR_ACCEL));

      if (hAccel == NULL)

            return 0;

      /* заполнение структуры, необходимой для диалога "Сохранить файл" */

      ofn.lStructSize = sizeof(ofn);

      ofn.hwndOwner = hMainWnd;

      ofn.hInstance = hInstance;

      ofn.nMaxFile = 256;

      ofn.lpstrFilter = "Text files\0*.txt";

      ofn.lpstrDefExt = "text";

      ofn.lpstrFile = filename;

      ofn.Flags = OFN_PATHMUSTEXIST | OFN_LONGNAMES | OFN_EXPLORER;

      /* получение параметров запуска приложения */

      STARTUPINFO s_info;

      GetStartupInfo(&s_info);

      /* создание главного MDI-окна */

      CLIENTCREATESTRUCT ccs;

      memset (&ccs, 0, sizeof(CLIENTCREATESTRUCT));

      HMENU hMenu = GetMenu(hMainWnd);

      ccs.hWindowMenu = GetSubMenu (hMenu, 2);

      ccs.idFirstChild = 100;

      hMDIClientWnd = CreateWindow ("MDICLIENT", (LPCTSTR)NULL,

            WS_CHILD | WS_CLIPCHILDREN | WS_VSCROLL | WS_HSCROLL | WS_VISIBLE,

            0, 0, 0, 0, hMainWnd, NULL, hInstance, (LPSTR)&ccs);

      if (!hMDIClientWnd)

            return 0;

      for (int i = 0; i < tables; i++)

            ModifyMenu (hMenu, IDM_W00 + i, MF_STRING, IDM_W00 + i, window[i]->name);

      for (int i = tables; i < 16; i++)