Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
A

author

@author
About
Posts
3
Topics
2
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • ListView Notification Example win32
    A author

    Hi Michael Thanks for replying. I have seen that code. but it doesn't seemt o work for me in Win32 or maybe I have done something wrng i just can't figure it out. :confused: Would appreciate help on this. I have posted the problem yesterday in the Visual C++ discussion board but nobody replied. I have given details of my problem there and I can't seem to figure out the problem. I will put the stuff here again. I am making a win32 dll (non MFC) and i have these three functions which I am using (i have more functions but may not be exactly useful here) HWND WINAPI EXPORT MakeListView(HWND hwnd,long x ,long y,long width,long height) { INITCOMMONCONTROLSEX iccex; iccex.dwICC=ICC_LISTVIEW_CLASSES; //ICC_WIN95_CLASSES; iccex.dwSize=sizeof(INITCOMMONCONTROLSEX); InitCommonControlsEx(&iccex); hwndTT = CreateWindow("SysListView32","",WS_CHILD | WS_VISIBLE | WS_BORDER | LVS_REPORT | LVS_SHOWSELALWAYS , x, y,width,height,awParam->hwnd, NULL, hInst, NULL); ListView_SetExtendedListViewStyle(hwndTT, LVS_EX_FULLROWSELECT ); //initialize the LVCOLUMN structure //The LVCOLUMN is used for adding title to the header of listview. lvc.mask=LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM; lvc.cx=100; lvi.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_STATE; lvi.state = 0; lvi.stateMask = 0; return(hwndTT); } //The above sample code is for making a listview and it returns a handle void WINAPI EXPORT ListChangeItemColor(HWND listviewhandle) { glPrevWndProc = SetWindowLong(listviewhandle, GWL_WNDPROC,(LONG)(WNDPROC)DoNotify); } //this is the second function which accepts the listviewhandle and attempts to use the window procedure of the ListView. I think this is the problem, not sure if i am doing this right. long DoNotify(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { switch(msg) { case WM_NOTIFY: { LPNMLISTVIEW pnm = (LPNMLISTVIEW)lParam; switch (pnm->hdr.code) { case NM_CUSTOMDRAW: { LPNMLVCUSTOMDRAW lplvcd = (LPNMLVCUSTOMDRAW)lParam; if(lplvcd->nmcd.dwDrawStage == CDDS_PREPAINT) return CDRF_NOTIFYITEMDRAW; if(lplvcd->nmcd.dwDrawStage == CDDS_ITEMPREPAINT) { if(!(lplvcd->nmcd.dwItemSpec % 3)) { GetClientRect(hwnd,&rect); MessageBox(NULL,"I am here","help",MB_OK); lplvcd->clrText =RGB(255, 0, 0); lplvcd->clrTextBk = RGB(0,0,0); InvalidateRect(hwnd,&rect,FALSE); return(CDRF_DODEFAULT); } } } } }

    Article Writing tutorial question

  • ListView Notification Example win32
    A author

    How about a win32 example which shows how to change the background color of individual items of a listview control ? I have been trying to find and know how to do this but till now without much success :( author

    Article Writing tutorial question

  • Changing Individual Item Background Color of listview (need win32 non MFC)
    A author

    i have a dll containing a function which creates a listview and returns the handle for the listview. i have another function which hooks into the window procedure of this newly created listview so that it can change the background color of individual items. It uses SetWindowLong to trap the window procedure. Am i doing it right ? The sample code is as below: listviewhandle=alMakeListView(AWPARAM_PTR awParam,long x ,long y,long width,long height); void WINAPI EXPORT alListChangeItemColor(HWND listviewhandle) { glPrevWndProc = SetWindowLong(listviewhandle, GWL_WNDPROC,(LONG)(WNDPROC)DoNotify); } LRESULT DoNotify(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { switch(msg) { case WM_NOTIFY: { LPNMLISTVIEW pnm = (LPNMLISTVIEW)lParam; switch (pnm->hdr.code) { case NM_CUSTOMDRAW: { LPNMLVCUSTOMDRAW lplvcd = (LPNMLVCUSTOMDRAW)lParam; return(CDRF_DODEFAULT); if(lplvcd->nmcd.dwDrawStage == CDDS_PREPAINT) return CDRF_NOTIFYITEMDRAW; if(lplvcd->nmcd.dwDrawStage == CDDS_ITEMPREPAINT) { COLORREF crText; if(!(lplvcd->nmcd.dwItemSpec % 3)) { crText=RGB(255, 0, 0); lplvcd->clrText = crText; lplvcd->clrTextBk = RGB(0,0,0); } } } default: break; } } } return CallWindowProc((WNDPROC)glPrevWndProc, hwnd, msg, wParam, lParam); } Can anybody tell me what is going wrong with this code ? Been trying this for some time now and can't figure it out. author :confused:

    C / C++ / MFC question c++
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups