Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9186081
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T19:26:13+00:00 2026-06-17T19:26:13+00:00

When a NM_CUSTOMDRAW notification code is send by a WM_NOTIFY message to the parent

  • 0

When a NM_CUSTOMDRAW notification code is send by a WM_NOTIFY message to the parent of a control, the lParam parameter of this WM_NOTIFY message is the address of an NMCUSTOMDRAW structure, as written here :

http://msdn.microsoft.com/en-us/library/windows/desktop/ff919569(v=vs.85).aspx

On the otherhand, the lParam of a WM_NOTIFY message should be

A pointer to an NMHDR structure that contains the notification code and additional
information. For some notification messages, this parameter points to a larger
structure that has the NMHDR structure as its first member.

In many code examples, for the handler for WM_NOTIFY message, I see

LPNMLISTVIEW     pnm         =   (LPNMLISTVIEW)lParam;
    switch   (pnm->hdr.code){   .... 

But the question is, we don’t know this lParam is a NMHDR structure or a NM_CUSTOMDRAW structure a proior, how could one cast lParam correctly? If the lParam is a just a NMHDR,
one should use LPNMHDR and pnm->code, isn’t it?

Worse, different control use different type of structures: NMLVCUSTOMDRAW, NMTVCUSTOMDRAW, NMLVCUTTOMDRAW and NMTBCUSTOMDRAW. So what is the correct way to do at the beginning of a WM_NOTIFY handler, distinguish it is with a NM_CUSTOMDRAW or not, and decide the correct NMCUSTOMDRAW structure type.


When I read the article

http://msdn.microsoft.com/en-us/library/windows/desktop/ff919569%28v=vs.85%29.aspx

on MSDN, I can’t understand some parts. For example,

CDRF_NOTIFYPOSTPAINT The control will send an NM_CUSTOMDRAW notification when the painting cycle for the entire control is complete. This occurs when dwDrawStage equals CDDS_PREPAINT.

When a control send an NM_CUSTOMDRAW notification when the painting cycle for the entire control is complete, this NM_CUSTOMDRAW should have dwDrawState equals CDDS_PREPOSTPAINT, isn’t it?

Can someone explain what “This occurs when….” in the list of the meaning of return value in that MSDN article.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T19:26:14+00:00Added an answer on June 17, 2026 at 7:26 pm

    It is easy. The lParam pointer is both NMHDR* and NMLVCUSTOMDRAW* in the same time. If you look at how NMLVCUSTOMDRAW is defined you will see it starts with NMHDR member.

    Having said that, you can reliably cast your LPARAM to anything of your choice: NMHDR*, NMCUSTOMDRAW*, NMLVCUSTOMDRAW*. If the notification is coming from listview, the message itself is WM_NOTIFY and NMHDR::code equals to NM_CUSTOMDRAW, then any and all of the three casts will be correct.

    Think of NMLVCUSTOMDRAW as of a notification-specific extension of general purpose NMHDR.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a problem on this code $(document).ready(function(){ $('.nm_close').click(function(){ $('.map_pops').css('display','none'); }); }); What I
I want to convert this LINQ code var x = from nm in names
Having trouble with this code: let subscribe (nm : NamespaceManager) (subName : string) (desc
Using the following code, I would like to have the notification to just disappear
I currently have NM_CUSTOMDRAW message calling a function to color the rows of a
I am trying to convert this code from Oracle: CREATE VIEW PLANNED AS SELECT
I am using the following code to launch a notification when a Service is
PHP: $x = preg_match ( '/^([.\\n\\r]*)\\n\\n/m', a\nb\nc\n\nd\ne\nf, $m); print x=$x, m=; print_r ($m); This
In NM_CUSTOMDRAW, I draw something and return CDRF_SKIPDEFAULT. But the 3 dots at the
I have a datafile (tab separated) which looks like this: chr1 38045559 38046059 chr1:38045559-38046559_NM_001142726_C1orf122_+,chr1:38045559-38046559_NM_198446_C1orf122_+,chr1:38045952-38046952_NM_024640_YRDC_-

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.