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 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

This is an interesting conundrum. We have a WPF app that has a Vista-like
So I'm trying to use IApplicationAssociationRegistration , which has been introduced with Windows Vista.
I was testing on a customer's box this afternoon which has Windows Vista (He
My Vista application needs to know whether the user has launched it as administrator
Vista SP1 Visual Studio 2008 SP1 .NET 3.5 SP1 C# I have a winforms
I work on an application that has a both a GUI (graphical) and API
Vista displays the dialog Close programs to prevent information loss when the system is
OS: Vista enterprise When i switch between my home and office network, i always
Env.: Vista SP1, SQL Server Express 2005 I'm able to connect to my localhost
On Vista, I got a problem with the application crash handler. Basically, if something

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.