Click here to Skip to main content
15,914,010 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionWho can help me about hooks using hot-key? Pin
TTT8131-Jan-05 14:02
TTT8131-Jan-05 14:02 
AnswerRe: Who can help me about hooks using hot-key? Pin
RicoH1-Feb-05 0:39
RicoH1-Feb-05 0:39 
GeneralIgnore Windows key + M Pin
Mike Hell31-Jan-05 12:36
Mike Hell31-Jan-05 12:36 
GeneralWM_PAINT seems not working Pin
int01hh31-Jan-05 12:28
int01hh31-Jan-05 12:28 
GeneralRe: WM_PAINT seems not working Pin
beerboy_2231-Jan-05 13:31
beerboy_2231-Jan-05 13:31 
GeneralRe: WM_PAINT seems not working Pin
JohnCz31-Jan-05 14:12
JohnCz31-Jan-05 14:12 
GeneralRe: WM_PAINT seems not working Pin
int01hh3-Feb-05 9:02
int01hh3-Feb-05 9:02 
GeneralList Control displays no Text Pin
RobertW10031-Jan-05 8:16
RobertW10031-Jan-05 8:16 
Ok, I am stumped, I hope someone out there can help me. FYI I am using Win 98 with VC++ 6.0. I am trying to create a list control to display text output to a window. Since I am new to using the WIN32 API I am trying to create a List Control with some generic text output so I have a working example. I can create the List Control and insert Columns and Items with no problem but when the window is displayed I get no output. I have called ListView_GetItemCount, ListView_GetColumn, and ListView_GetItem macros and can see the info that I have added. I am trying to create the 2nd window in a 2 window app.

What do I need to do in order to display the data in an Edit Window that I have created? I am totally confused on how I get the data to display. I have looked at the List Control articles but I don't see any discussion about this question.

FYI...I have created and displayed the parent window, an edit window and a header control window with no problems.

List Control Create:
HWND CreateSeasonListView()
{
INITCOMMONCONTROLSEX initStruct;
HWND hList;

int nCmdShow;
int nPrevIx;

initStruct.dwICC = ICC_LISTVIEW_CLASSES;
initStruct.dwSize = sizeof(initStruct);

nCmdShow = 1;
nPrevIx = 0;

InitCommonControlsEx(&initStruct);
hList = CreateWindowEx(WS_EX_CLIENTEDGE,WC_LISTVIEW,NULL,
WS_CHILD | WS_VISIBLE | WS_BORDER |
LVS_REPORT,
0,0,CW_USEDEFAULT,CW_USEDEFAULT,HWndSeason,NULL,hInstGlobal,NULL);

return(hList);
}

Insert Items Into List Control:
void AddListItems ()
{

#define LIST_COLUMNS 6

static LVCOLUMN lvCol[LIST_COLUMNS];

static LVITEM lvRow;
static LVITEM lvTest;
LRESULT rc;
LPSTR psText[LIST_COLUMNS];
LPSTR pItem;

char cHdg [LIST_COLUMNS] [11] = {"Date",
"Game 1",
"Game 2",
"Game 3",
"Avg",
"Total"};
char cTxt[20];

int iColHdgLen[LIST_COLUMNS] = {4,6,6,6,3,5};
int itest;
int x;
int nCmdShow = 1;

HDC hDC;
bool btest;
HWND hEdit;
char temp[255];

rc = -5;
pItem = NULL;

memset(temp,0,sizeof(temp));
ZeroMemory(&lvCol,sizeof(lvCol));
ZeroMemory(&lvRow,sizeof(lvRow));

for (x = 0;x < LIST_COLUMNS; x++) {
lvCol[x].mask = LVCF_FMT | LVCF_TEXT | LVCF_WIDTH;
lvCol[x].fmt = LVCFMT_LEFT;
lvCol[x].cx = 100;
lvCol[x].pszText = LPTSTR(cHdg[x]);
lvCol[x].cchTextMax = iColHdgLen[x];
lvCol[x].iSubItem = x;
lvCol[x].iImage = NULL;
lvCol[x].iOrder = x;

itest = ListView_InsertColumn(HWndSeasonList,x,&lvCol[x]);
}
lvRow.mask = LVIF_TEXT | LVIF_PARAM;
lvRow.iItem = 0;
lvRow.iSubItem = 0;

pItem = (LPSTR) malloc(20);
memset(pItem,0,20);
memcpy(pItem,"01/29/05",8);

lvRow.lParam = (LPARAM) pItem;
lvRow.pszText = pItem;
lvRow.cchTextMax = strlen(pItem);
itest = strlen(pItem);


rc = ListView_InsertItem(HWndSeasonList,&lvRow);


/* NOTE: I have tried this both ways shown below and neither
one seems to work (Nothing is displayed in the window.
rc = SendMessage(HWndSeasonList, WM_SETREDRAW, TRUE, 0);
btest = InvalidateRect(HWndSeasonList,NULL, TRUE);
btest = UpdateWindow(HWndSeasonList);
*/ btest = ShowWindow(HWndSeason,SW_NORMAL);
UpdateWindow(HWndSeason);
Error = GetLastError();

}
GeneralAnother user interface Thread Question Pin
Tom Wright31-Jan-05 7:39
Tom Wright31-Jan-05 7:39 
Generalpluggab;e protocol handler in MFC Pin
Wim Jans31-Jan-05 7:35
Wim Jans31-Jan-05 7:35 
GeneralSerbian letters problem Pin
User 91483331-Jan-05 7:29
User 91483331-Jan-05 7:29 
GeneralRe: Serbian letters problem Pin
John R. Shaw31-Jan-05 7:54
John R. Shaw31-Jan-05 7:54 
GeneralString bugs out Pin
Gadjuka31-Jan-05 7:23
Gadjuka31-Jan-05 7:23 
GeneralRe: String bugs out Pin
Wes Aday31-Jan-05 9:21
professionalWes Aday31-Jan-05 9:21 
GeneralRe: String bugs out Pin
Gadjuka31-Jan-05 10:47
Gadjuka31-Jan-05 10:47 
GeneralRe: String bugs out Pin
Gadjuka2-Feb-05 12:06
Gadjuka2-Feb-05 12:06 
GeneralMute the volume in Windows XP Pin
Aneurysm0031-Jan-05 7:10
Aneurysm0031-Jan-05 7:10 
GeneralRe: Mute the volume in Windows XP Pin
David Crow31-Jan-05 9:18
David Crow31-Jan-05 9:18 
GeneralRe: Mute the volume in Windows XP Pin
Aneurysm001-Feb-05 3:10
Aneurysm001-Feb-05 3:10 
GeneralRe: Mute the volume in Windows XP Pin
David Crow1-Feb-05 3:51
David Crow1-Feb-05 3:51 
GeneralRe: Mute the volume in Windows XP Pin
Aneurysm001-Feb-05 5:58
Aneurysm001-Feb-05 5:58 
Questionhow to read hexadecimal input in an editbox Pin
cbaykal31-Jan-05 7:03
cbaykal31-Jan-05 7:03 
AnswerRe: how to read hexadecimal input in an editbox Pin
John R. Shaw31-Jan-05 7:39
John R. Shaw31-Jan-05 7:39 
GeneralGet out of infinite loop question! Pin
jazzkiller31-Jan-05 6:58
jazzkiller31-Jan-05 6:58 
GeneralRe: Get out of infinite loop question! Pin
PJ Arends31-Jan-05 7:13
professionalPJ Arends31-Jan-05 7:13 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.