Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

URGENT : windows handle (com.ms.win32)

Posted on 1998-08-06
5
Medium Priority
?
212 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 100 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
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…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
Suggested Courses

722 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