1. Список говнокодов пользователя iloveYou

    Всего: 1

  2. Pascal / Говнокод #4776

    +94

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    44. 44
    45. 45
    46. 46
    47. 47
    48. 48
    49. 49
    50. 50
    51. 51
    52. 52
    53. 53
    54. 54
    55. 55
    56. 56
    57. 57
    58. 58
    59. 59
    60. 60
    61. 61
    62. 62
    63. 63
    64. 64
    65. 65
    66. 66
    67. 67
    68. 68
    69. 69
    70. 70
    71. 71
    72. 72
    73. 73
    74. 74
    75. 75
    function WindowProc(Wnd: HWND; Msg: UINT; wParam: WPARAM; lParam: LPARAM ): LRESULT; stdcall;
    type
      Item = record
        szItemNr: array[0..8] of char;
        szItem: array[0..32] of char;
        szItemDescription: array[0..32] of char;
      end;
    var
      ListColumn: LV_COLUMN;
      ListItem: LV_ITEM;
    begin
      // In case of Msg ...
      case Msg of
        WM_CREATE: // Create?
        begin
          // Create list
          ListView := CreateWindowEx(WS_EX_CLIENTEDGE, WC_LISTVIEW, '', WS_VISIBLE Or WS_CHILD Or LVS_REPORT Or LVS_SHOWSELALWAYS,
                                     10, 10, 524, 300, Wnd, 0, hInstance, nil);
          ListView_SetExtendedListViewStyle(ListView, LVS_EX_FULLROWSELECT Or LVS_EX_GRIDLINES);
          // Filling list columns
          with ListColumn do begin
            mask := LVCF_FMT Or LVCF_WIDTH Or LVCF_TEXT Or LVCF_SUBITEM;
            fmt := LVCFMT_LEFT;
    
            iSubItem := 0;
            cx := 200;
            pszText := 'File name';
            ListView_InsertColumn(ListView, 0, ListColumn);
    
            iSubItem := 1;
            cx := 250;
            pszText := 'Folder path';
            ListView_InsertColumn(ListView, 1, ListColumn);
    
            iSubItem := 2;
            cx := 70;
            pszText := 'File size';
            ListView_InsertColumn(ListView, 2, ListColumn);
          end;
    
          with ListItem do begin
            mask := LVIF_TEXT;
            iItem := 1;
            iSubItem := 1;
            pszText := PChar('test');
            cchTextMax := SizeOf(PChar('test')) + 1;
          end;
          ListView_InsertItem(ListView, ListItem);
          ListView_SetItemText(ListView, 1, 1, PChar('Hello world!'));
    
          // Create static text, progress bar and buttons
          StaticText := CreateWindowEx(0, 'Static', '', WS_CHILD Or WS_VISIBLE Or SS_CENTER,
                                       10, 310, 524, 16, Wnd, ID_StaticText, hInstance, 0);
          ProgressBar := CreateWindowEx(0, PROGRESS_CLASS, nil, WS_CHILD Or WS_VISIBLE Or PBS_SMOOTH,
                                        9, 326, 525, 17, Wnd, ID_ProgressBar, hInstance, nil);
          Button_Start := CreateWindowEx(WS_EX_STATICEDGE, 'Button', 'Start', BS_DEFPUSHBUTTON Or WS_VISIBLE Or WS_CHILD,
                                   150, 350, 70, 25, Wnd, ID_Button_Start, hInstance, nil );
          Button_Pause := CreateWindowEx(WS_EX_STATICEDGE, 'Button', 'Pause', WS_VISIBLE Or WS_CHILD Or WS_DISABLED,
                                   230, 350, 70, 25, Wnd, ID_Button_Pause, hInstance, nil );
          Button_Stop := CreateWindowEx(WS_EX_STATICEDGE, 'Button', 'Stop', WS_VISIBLE Or WS_CHILD Or WS_DISABLED,
                                   310, 350, 70, 25, Wnd, ID_Button_Stop, hInstance, nil );
        end;
    
        WM_DESTROY: // Closing?
        begin
          PostQuitMessage(0);
          Result := 0;
          Exit;  // Bye.
        end;
    
        WM_COMMAND: // Any command?
        case LoWord(wParam) of
            // ....................................
        end;
    end;

    Пристрелите меня кто-нибудь. Или объясните, как работает этот волшебный listview %)

    iloveYou, 28 Ноября 2010

    Комментарии (30)