Java and C/C++ question.

How can I get the handle (HWDN) of a Window in vc++ created with Java. I have a JWindow and wanting to manipulate it using a VC++ .dll created in vc++ 6.0. I know how I can get the handle of a JFrame using FindWindow and the title of the JFrame. But how do i get the handle of a window with out any trimmings what so ever.

Any help would be appreciated.

Boycey
blokeyAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
JodConnect With a Mentor Commented:
How about....

FindWindowEx (you will ned the handle to a parent window for this to work)

The FindWindowEx function retrieves a handle to a window whose class name and window name match the specified strings. The function searches child windows, beginning with the one following the given child window. This function does not perform a case-sensitive search.

HWND FindWindowEx(
  HWND hwndParent,      // handle to parent window
  HWND hwndChildAfter,  // handle to a child window
  LPCTSTR lpszClass,    // pointer to class name
  LPCTSTR lpszWindow    // pointer to window name
);

OR


GetWindow (this will find ANY window for you)

The GetWindow function retrieves a handle to a window that has the specified relationship (Z order or owner) to the specified window.

HWND GetWindow(
  HWND hWnd,  // handle to original window
  UINT uCmd   // relationship flag
);
 
Parameters

hWnd

Handle to a window. The window handle retrieved is relative to this window, based on the value of the uCmd parameter.

uCmd

Specifies the relationship between the specified window and the window whose handle is to be retrieved. This parameter can be one of the following values: Value Meaning
GW_CHILD The retrieved handle identifies the child window at the top of the Z order, if the specified window is a parent window; otherwise, the retrieved handle is NULL. The function examines only child windows of the specified window. It does not examine descendant windows.


GW_ENABLEDPOPUP Windows NT 5.0 and later: The retrieved handle identifies the enabled popup window owned by the specified window (the search uses the first such window found using GW_HWNDNEXT); otherwise, if there are no enabled popup windows, the retrieved handle is that of the specified window.  

GW_HWNDFIRST The retrieved handle identifies the window of the same type that is highest in the Z order. If the specified window is a topmost window, the handle identifies the topmost window that is highest in the Z order. If the specified window is a top-level window, the handle identifies the top-level window that is highest in the Z order. If the specified window is a child window, the handle identifies the sibling window that is highest in the Z order.

GW_HWNDLAST The retrieved handle identifies the window of the same type that is lowest in the Z order. If the specified window is a topmost window, the handle identifies the topmost window that is lowest in the Z order. If the specified window is a top-level window, the handle identifies the top-level window that is lowest in the Z order. If the specified window is a child window, the handle identifies the sibling window that is lowest in the Z order.

GW_HWNDNEXT The retrieved handle identifies the window below the specified window in the Z order. If the specified window is a topmost window, the handle identifies the topmost window below the specified window. If the specified window is a top-level window, the handle identifies the top-level window below the specified window. If the specified window is a child window, the handle identifies the sibling window below the specified window.

GW_HWNDPREV The retrieved handle identifies the window above the specified window in the Z order. If the specified window is a topmost window, the handle identifies the topmost window above the specified window. If the specified window is a top-level window, the handle identifies the top-level window above the specified window. If the specified window is a child window, the handle identifies the sibling window above the specified window.

GW_OWNER The retrieved handle identifies the specified window's owner window, if any.

0
 
shaveriCommented:
0
 
shaveriCommented:
at least write the reason for rejection man.........
0
 
blokeyAuthor Commented:
Thanks Jod
0
All Courses

From novice to tech pro — start learning today.