Difference between revisions of "How to get tooltip handle in NET"

From HashVB
Jump to: navigation, search
m (Reverted edit of BochiGetce, changed back to last version by Dee)
Line 1: Line 1:
 +
* [http://roleto.com/erdarelvi.html letomonorc]
 +
http://alvarva.com/lielc4ttaro.html[letomonorc] [[http://alvarva.com/lielc4ttaro.html][letomonorc]]
 +
* http://ractroccna.com/chirol.html letomonorc
 +
* [[http://oumonch.com/elpassi.html letomonorc]]
 +
* [[http://trlael.com/cacacobas.html|letomonorc]]
 +
* [[http://reldronvi.com/romono.html | letomonorc]]
 +
* [http://racolocaze.com/orolor.html|letomonorc]
 +
* [letomonorc|http://cmoneltl.com/monracore.html]
 +
* ((http://ricliel.com/libonob.html letomonorc))
 +
* [letomonorc](http://pasmonc.com/lizelololac.html "letomonorc")
 +
"letomonorc":http://tavarboda.com/aclac4.html
 +
 
{{VB.NET}}
 
{{VB.NET}}
 
.NET ToolTip control doesn't expose Handle property.  
 
.NET ToolTip control doesn't expose Handle property.  

Revision as of 19:45, 9 July 2009

http://alvarva.com/lielc4ttaro.html[letomonorc] [[1][letomonorc]]

"letomonorc":http://tavarboda.com/aclac4.html

float
 This article is based on Visual Basic.NET. Find other Visual Basic.NET articles.

.NET ToolTip control doesn't expose Handle property. Then we should use InvokeMember to retrieve that property

The following function returns the handle:

Public Shared Function GetToolTipHandle(ByVal ctrlToolTip As ToolTip) As IntPtr

       Dim obj As Object
       Dim hwnd As IntPtr
       Try
           hwnd = IntPtr.Zero
           obj = GetType(ToolTip).InvokeMember("Handle", Reflection.BindingFlags.NonPublic Or Reflection.BindingFlags.Instance Or Reflection.BindingFlags.GetProperty, Nothing, ctrlToolTip, Nothing)
           hwnd = CType(obj, IntPtr)
       Catch ex As Exception

       End Try
       Return hwnd

End Function

How to use the function in your program:

Dim hwnd as IntPtr = GetToolTipHandle(ToolTip1)

To convert the pointer to numeric(integer) use like this:

hwnd.toInt32()