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

  • SEARCH
  • Home
  • 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 193649
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T16:31:42+00:00 2026-05-11T16:31:42+00:00

Vista has introduced a new API to display a text in the list view

  • 0

Vista has introduced a new API to display a text in the list view control when it doesn’t have any items. As the MSDN library states, I should process the LVN_GETEMPTYMARKUP notification.

In the inherited ListView control the WndProc method is overriden:

protected override void WndProc(ref Message m) {
  try {
    if(m.Msg == 78 /* WM_NOTIFY */) {
      var nmhdr = (NMHDR)Marshal.PtrToStructure(m.LParam, typeof(NMHDR));
      if(nmhdr.code == -187 /* LVN_GETEMPTYMARKUP */) {
        var nmlvemptymarkup =
          (NMLVEMPTYMARKUP)Marshal.PtrToStructure(m.LParam, typeof(NMLVEMPTYMARKUP));
        nmlvemptymarkup.szMarkup = "The ListView is empty.";
        m.Result = (IntPtr)1;
      }
    }
  } finally {
    base.WndProc(ref m);
  }
}

However, it doesn’t work (although it doesn’t throw any exception). Actually I never get nmhdr.code equals to -187. Any ideas?

  • 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-05-11T16:31:42+00:00Added an answer on May 11, 2026 at 4:31 pm

    I struggled a lot with this one myself.

    To get the code in the original question to work, mark the NMLVEMPTYMARKUP struct with [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] (the CharSet.Unicode is important).

    Also, after setting the markup-values, call Marshal.StructureToPtr(nmlvemptymarkup, m.LParam, false) to copy the data back to the buffer pointed to by LParam.

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

Sidebar

Related Questions

So I'm trying to use IApplicationAssociationRegistration , which has been introduced with Windows Vista.
We have a dll that has been running fine on Vista and Win7 for
I have an Excel VBA Application running on Windows Vista. A .Net DLL has
This is a Windows Vista Command Link dialog: alt text http://i.msdn.microsoft.com/Aa511455.commandlinks01(en-us,MSDN.10).png I was wondering
I'm about to jump to a new machine that has Vista Home Premium 64
This is an interesting conundrum. We have a WPF app that has a Vista-like
Have you used the Application Recovery APIs with vista? http://msdn.microsoft.com/en-us/library/aa373347(VS.85).aspx Do you find them
I have a Vista gadget that has a few DIV's and IMG's. The elements
I have an ASP.NET web site, my machine has IIS7 running on Windows Vista
My WinForms application has the standard Aero glass appearance on Vista/Windows 7. I want

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.