?
Solved

C# API - Checking if a control exists, given it's Handle

Posted on 2008-10-14
3
Medium Priority
?
1,059 Views
Last Modified: 2010-04-21
Hi - I'm adding items to a listbox in an external app using the SendMessage API.

What is the best method finding out if my handle for list listbox is still valid?  Is there an API call that will take the handle for the listbox and give me a return code to indicate if the control for the handle still exists?
0
Comment
Question by:qfwp
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 86

Accepted Solution

by:
Mike Tomlinson earned 1004 total points
ID: 22711401
You can use IsWindow() to see if a handle is still valid:
http://msdn.microsoft.com/en-us/library/ms633528(VS.85).aspx

0
 
LVL 55

Assisted Solution

by:Jaime Olivares
Jaime Olivares earned 996 total points
ID: 22711448
you can use native window, like:

NativeWindow nw = NativeWindow.FromHandle(handle)

if (nw != null)
{
       // it is valid
}
0
 
LVL 1

Author Closing Comment

by:qfwp
ID: 31505876
thank you
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

800 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question