class MainWindow : public Dialog { ListView *listView; virtual BOOL HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam); void OnInitDialog(); void OnWindowPosChanged(WINDOWPOS *WndPos); public: MainWindow(); }; MainWindow::MainWindow() : Dialog(IDD_FORMVIEW) { } void MainWindow::OnInitDialog() { listView = new ListView(this, IDC_LIST2); listView->AppendColumn(100, "test!"); listView->AppendColumn(75, ":P"); listView->AppendItem("hello!"); listView->AppendItem("world"); listView->AppendItem("from visual c"); listView->AppendItem(";))"); listView->InsertSubItem(0, 1, "abcd"); listView->InsertSubItem(1, 1, "efgh"); } void MainWindow::OnWindowPosChanged(WINDOWPOS *Pos) { listView->Move(0, 0, Pos->cx, 100); } BEGIN_MSG_MAP(MainWindow) ON_WM_INITDIALOG(OnInitDialog) ON_WM_WINDOWPOSCHANGED(OnWindowPosChanged) END_MSG_MAP(Dialog)