Solved

URGENT : windows handle (com.ms.win32)

Posted on 1998-08-06
5
182 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
  • 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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
map related example 6 47
Tomcat: Unable to run tomcat service. 2 18
iterator/ListIterator approach 17 25
Facing this issue for maven proxy setting 2 9
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 …
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…

813 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now