Hey guys
Im having a problem adding strings to a listbox. ive tried many different variants, from other peoples code, but while most do compile fine, the listbox always remains empty...
If you could help me i'd much appreciate it... Ive spent so much time on this...
Also... what im trying to do is create a report with column values and data, but unable to do that (same problems as this), ive tried to set my sights lower and do this.. Any tips on inserting columns and stuff would be much appareciated...
Thanx in advance
Code:
#include <windows.h>
#include <commctrl.h>
#include <stdio.h>
#include <iostream.h>
#include "resource.h"
BOOL CALLBACK DlgProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
{
switch(Message)
{
case WM_INITDIALOG:
{
HWND hListView = GetDlgItem(hwnd, IDC_LIST_CTRL);
SendMessage(hListView,LB_ADDSTRING, 0, (LPARAM)"Data");
SendMessage(hListView, LB_SETITEMDATA, 0, (LPARAM) 0);
SendMessage(hListView,LB_ADDSTRING, 0, (LPARAM)"Data2");
SendMessage(hListView, LB_SETITEMDATA, 1, (LPARAM) 1);
return FALSE;
}
case WM_CREATE:
break;
case WM_CLOSE:
EndDialog(hwnd,0);
break;
default:
//return DefWindowProc(hwnd, Message, wParam, lParam);
return FALSE;
}
return TRUE;
}
/* Main function (starting point) */
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpCmdLine, int nCmdShow)
{
DialogBox(hInstance,MAKEINTRESOURCE(IDD_DIALOG1), NULL, (DLGPROC)DlgProc);
return TRUE;
}