"the type or name space name 'HWND' couldnot be found.are you missing a using directive or assembly reference".i got this error message when i run below code in c#.

        {
          LRESULT CALLBACK NewListViewWndProc(HWND hwnd, UINT uiMsg, WPARAM wParam, LPARAM lParam)

                    switch (uiMsg)
                    {
                        case WM_CONTEXTMENU:    // trying to create a context menu?
                            {
                                return 0;       // eat this message, prevent context menu
                            }

                            break;
                    }


        }

how can i solve it????????????

ohhhh i'm very happyyy.....thankyou...

This is C++ code and won't work in C# unless you import the relevent Windows API DLLs.

See pinvoke.net for more information on how to do that and what is available to you.

You can obtain a HWND in C# here

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.