<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-1171241504632581094</id><updated>2024-08-28T18:23:32.174-07:00</updated><title type='text'>Windows API used Examples</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://winapihelp.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1171241504632581094/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://winapihelp.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>jivangoyal</name><uri>http://www.blogger.com/profile/12853371042810428434</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>1</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-1171241504632581094.post-5891250463085260578</id><published>2008-12-18T22:23:00.000-08:00</published><updated>2008-12-19T01:16:21.755-08:00</updated><title type='text'>Other Windows Handle</title><content type='html'>[Note: Use the specified code at your own risk,author is not responsible for any harm from the code]&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;Option Explicit&lt;br /&gt;Private Const GW_HWNDNEXT = 2&lt;br /&gt;Public Const WM_USER As Long = &amp;amp;H400&lt;br /&gt;&lt;br /&gt;Private Declare Function FindWindow Lib &quot;user32&quot; Alias &quot;FindWindowA&quot; (ByVal lpClassName As String, ByVal lpWindowName As String) As Long&lt;br /&gt;Private Declare Function GetWindowThreadProcessId Lib &quot;user32&quot; (ByVal HWND As Long, lpdwProcessId As Long) As Long&lt;br /&gt;Private Declare Function GetParent Lib &quot;user32&quot; (ByVal HWND As Long) As Long&lt;br /&gt;Private Declare Function GetWindow Lib &quot;user32&quot; (ByVal HWND As Long, ByVal wCmd As Long) As Long&lt;br /&gt;Public Declare Function DeleteObject Lib &quot;gdi32.dll&quot; (ByVal hObject As Long) As Long&lt;br /&gt;Public Declare Function FindWindowEx Lib &quot;user32&quot; Alias &quot;FindWindowExA&quot; ( _&lt;br /&gt;        ByVal hWnd1 As Long, ByVal hWnd2 As Long, _&lt;br /&gt;        ByVal lpsz1 As String, ByVal lpsz2 As String) As Long&lt;br /&gt;       &lt;br /&gt;Public Function GetHwnd(ByVal PID As Long) As Long&lt;br /&gt;&#39; Return the window handle for an instance handle.&lt;br /&gt;    Dim lHwnd As Long&lt;br /&gt;    Dim test_pid As Long&lt;br /&gt;    Dim Thread_ID As Long&lt;br /&gt;    &#39; Get the first window handle.&lt;br /&gt;    lHwnd = FindWindow(&quot;OWL_Window&quot;, vbNullString)&lt;br /&gt;    &#39; Loop until we find the target or we run out&lt;br /&gt;    &#39; of windows.&lt;br /&gt;    Do While lHwnd &lt;&gt; 0&lt;br /&gt;        &#39; See if this window has a parent. If not,&lt;br /&gt;        &#39; it is a top-level window.&lt;br /&gt;        If GetParent(lHwnd) = 0 Then&lt;br /&gt;            &#39; This is a top-level window. See if&lt;br /&gt;            &#39; it has the target instance handle.&lt;br /&gt;            Thread_ID = GetWindowThreadProcessId(lHwnd, test_pid)&lt;br /&gt;            If test_pid = PID Then&lt;br /&gt;                &#39; This is the target.&lt;br /&gt;                GetHwnd = lHwnd&lt;br /&gt;                Exit Do&lt;br /&gt;            End If&lt;br /&gt;        End If&lt;br /&gt;        &#39; Examine the next window.&lt;br /&gt;        lHwnd = GetWindow(lHwnd, GW_HWNDNEXT)&lt;br /&gt;    Loop&lt;br /&gt;End Function&lt;br /&gt;&lt;br /&gt;&lt;/blockquote&gt;</content><link rel='replies' type='application/atom+xml' href='http://winapihelp.blogspot.com/feeds/5891250463085260578/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://winapihelp.blogspot.com/2008/12/other-windows-handle.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1171241504632581094/posts/default/5891250463085260578'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1171241504632581094/posts/default/5891250463085260578'/><link rel='alternate' type='text/html' href='http://winapihelp.blogspot.com/2008/12/other-windows-handle.html' title='Other Windows Handle'/><author><name>jivangoyal</name><uri>http://www.blogger.com/profile/12853371042810428434</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>