Re: determine invalid window process



Further to my last post, I tested again and found the following facts:

hWnd = FindWindow(vbNullString, "Project Navigator")
'hwnd=3803704 returned
bVisible = IsWindowVisible(hWnd)
'bVisible=False returned

But Spy++ returned different Handle, 00690BC4 (6884292); then tried
bVisible = IsWindowVisible(6884292)
'bVisible=True returned.

Somehow, my FindWindow() call returned wrong window handle, even though
IsWindow() returned True. Anything wrong with my call hWnd =
FindWindow(vbNullString, "Project Navigator")? Here the real window title
always starts with "Project Navigator", but has more characters appending to
it.

Thanks,


"expvb" wrote:

"X. Zhang" <XZhang@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:84630312-7D18-475E-84D7-0CD4E3063CC0@xxxxxxxxxxxxxxxx
Thanks, expvb.
I tried IsWindowVisible(hwnd), but it always returned 0, even if the main
window was visible.
I even tried lRet = GetWindowLong(hwnd, GWL_STYLE), and then check the
value
of (lRet And WS_VISIBLE). It's 0 too, even when the main window was
visible.
So weird.
Any ideas?

IsWindow() should tell if the handle is a valid hWnd. It's possible that the
window has width and height of 0, or moved off screen. Use Spy++ to see the
screen coordinates. If you don't have Spy++, use this free alternative:

http://www.windows-spy.com




.



Relevant Pages

  • Re: Trapping Alt-F4
    ... It will ABSOLUTELY differ from run to run. ... I think 0x02BE is the HWND of the window erroneously processing the ... adjust the log settings in Spy++ to give you better output (such as ...
    (microsoft.public.vc.mfc)
  • Re: Trapping Alt-F4
    ... I think 0x02BE is the HWND of the window erroneously processing the ... adjust the log settings in Spy++ to give you better output (such ... If so, you see my dilemma, what good is knowing the HWND if the app has ...
    (microsoft.public.vc.mfc)
  • Re: Click Button in Another Running App
    ... So using Spy++ or similar find the class names of the window and button, ... You'll still have to FindWindow or EnumWindows to get the ... for the button hwnd based on its text, ...
    (microsoft.public.vb.winapi)
  • Re: Trapping Alt-F4
    ... I think 0x02BE is the HWND of the window erroneously processing the ... adjust the log settings in Spy++ to give you better output (such as ... the parameters for the Windows message being decoded and not just raw ...
    (microsoft.public.vc.mfc)
  • Re: How add buton onto title bar of any external active window?
    ... I want to add buttons ontoany active window. ... int sm_CXSIZE; ... static int WindowsFeaturesWidth(HWND hwnd, DWORD style) ... LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM ...
    (microsoft.public.win32.programmer.gdi)

Loading