Solved

URGENT : windows handle (com.ms.win32)

Posted on 1998-08-06
5
204 Views
Last Modified: 2010-04-16
I have a java application that extends java.awt.Window.  How can I get the Win32 handle (as an int) to this window within my code, which I can then pass to functions like User32.SetWindowPos(int hWnd, ...)?

thanks
nishant
0
Comment
Question by:nishant080698
[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
  • 2
5 Comments
 
LVL 16

Accepted Solution

by:
imladris earned 50 total points
ID: 1231549
This is actually more of a pointing you in the right direction than a specific answer. It involves some windows programming, a topic in which I am ignorant on the the details. But since noone else has proffered anything concrete, here's what I have.

We ran into a similar situation. We needed to get the handle of a Java program. The solution we came up with was to use the name. A native windows routine would scan the list of running applications, find the one of interest, by name, and acquire the handle from there. In our case it was used directly in the native routine, however, it could undoubtedly be passed back into the Java program just as well.

0
 

Author Comment

by:nishant080698
ID: 1231550
how do i know what name to use? I have a java class (a.java) that is a stub that in turn calls another java class (b.java) which extends Window (and therefore has no border or title name). also a.java is registered as an activeX object A.Java.1 , and i am creating the object in VB using this classname. so, how can i then refer to it by name? i assume you were referring to using
Declare Function FindWindow Lib "user32" Alias _
"FindWindowA" (ByVal lpClassName As String, _
                    ByVal lpWindowName As Long) As Long

what value do i pass to lpClassName and lpWindowName respectively?

thanks
nishant
0
 
LVL 16

Expert Comment

by:imladris
ID: 1231551
Use whatever name that winds up in the title bar.

0
 

Author Comment

by:nishant080698
ID: 1231552
its a window without a border or title bar.
nishant
0
 
LVL 16

Expert Comment

by:imladris
ID: 1231553
OK, whatever title would have been there, if there had been a title bar.

Specifically, in the case of straight Java, there is a constructor for Frame that takes a String as an argument. This string will appear as the title (if you have a title bar). This is how we specified the name of the program.

0

Featured Post

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

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

Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
Suggested Courses

635 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