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

                              {"Размещение",          CT_COMBO_EX, 160, 3, SET_PARAM(TRUE, 1, 2)},

                              {"",                   CT_NULL, 0, 0, 0}

                        };

                        if (!create_result_listview(result_wnd_class,

                              "Результаты поиска :", &hResultsWnd, &hResultsListWnd, table1))

                              return -1;

                        ShowWindow (hResultsWnd, SW_SHOWNORMAL);

                        SendMessage(hResultsWnd, WM_DRAW_ITEMS, 0, 0);

                  }

                  ShowWindow(hResultsWnd, SW_NORMAL);

                  break;

            case IDM_SAVE_RESULT:

                  if (GetSaveFileName(&ofn))

                        save_result(filename, hResultsListWnd, 7);

                  break;

            case IDM_W00:

            case IDM_W01:

            case IDM_W02:

            case IDM_W03:

            case IDM_W04:

            case IDM_W05:

            case IDM_W06:

            case IDM_W07:

            case IDM_W08:

            case IDM_W09:

            case IDM_W10:

            case IDM_W11:

            case IDM_W12:

            case IDM_W13:

            case IDM_W14:

            case IDM_W15:

            {

                  LVWnd_t *wnd = window[wmId - IDM_W00];

                  if (wnd->hTable)

                        ShowWindow (wnd->hTable, SW_SHOWNORMAL);

                  else

                  {

                        create_mdi_table(wnd);

                        load_table (wnd);

                  }

            break;

            }

            case IDM_TILE_HOR:

                  SendMessage (hMDIClientWnd, WM_MDITILE, MDITILE_HORIZONTAL, 0);

                  break;

            case IDM_TILE_VERT:

                  SendMessage (hMDIClientWnd, WM_MDITILE, MDITILE_VERTICAL, 0);

                  break;

            case IDM_CASCADE:

                  SendMessage (hMDIClientWnd, WM_MDICASCADE, MDITILE_SKIPDISABLED, 0);

                  break;

            default:

                  return DefFrameProc(hWnd, hMDIClientWnd, message, wParam, lParam);

            }

            break;

      case WM_DESTROY:

            PostQuitMessage(0);

            break;

      case WM_ERASEBKGND:

            break;

      default:

            return DefFrameProc(hWnd, hMDIClientWnd, message, wParam, lParam);

      }

      return 0;

}

Файл gui\results_wnd.c :

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

/* Обработчик сообщений окна "Результаты поиска" */

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

{

      switch (message)

      {

      case WM_CREATE:

            break;

      case WM_SIZE:

            {

                  RECT rc;

                  GetClientRect(hWnd, &rc);

                  // разтяжение окна списка на всю клиентскую область главного окна

                  MoveWindow(hResultsListWnd, 0, 0, rc.right, rc.bottom, TRUE);

                  return DefMDIChildProc(hWnd, message, wParam, lParam);

            }

      case WM_DRAW_ITEMS:

      {

            /* очистка списка */

            SendMessage(hResultsListWnd, LVM_DELETEALLITEMS,0,0);

            break;

      }

      case WM_NOTIFY:

            {

                  // обработка сообщений от списка

                  NMHDR * data = (NMHDR*)lParam;

                  if (data->hwndFrom != hResultsListWnd)

                        break;

                  switch (data->code)

                  {

                        /* сортировка списка */

                        case LVN_COLUMNCLICK:

                              {

                                   NM_LISTVIEW * data = (NM_LISTVIEW*)lParam;

                                   //SendMessage (hResultsListWnd, LVM_SORTITEMS, data->iSubItem, (LPARAM)&compare_func);

                                   sort_column(hResultsListWnd, data->iSubItem);

                              }     break;

                  }

            }     break;

      case WM_ERASEBKGND:

            break;

      case WM_DESTROY: