Results 1 to 9 of 9
  1. #1
    jihadrh is offline Member
    Join Date
    Oct 2008
    Posts
    4
    Rep Power
    0

    Smile To get the current active window`s path using Windows API

    Hi all,

    I got the handle to the current active window using getactivewindow() . But how to get the path of the current active window. My intention is to create a folder in that, when I press a key .

    thnx in advance....!!:)

  2. #2
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,401
    Rep Power
    25

    Default

    Is this a java programming question?
    What class is getactivewindow() in?

  3. #3
    jihadrh is offline Member
    Join Date
    Oct 2008
    Posts
    4
    Rep Power
    0

    Red face

    Its JNI programming.. I am calling windows API using one Jar file (J/Invoke). By using that , we can call method, like User32.GetForegroundWindow(); it will return one integer value corresponds to the active window.
    So, After using this, i got hanlde to the window, But I need the path of the active Window.
    We can also use System.load("User32"). to get this methods instead of using that JInvoke jar.

    If any clarification needs, pls let me knw... :o

  4. #4
    fishtoprecords's Avatar
    fishtoprecords is offline Senior Member
    Join Date
    Jun 2008
    Posts
    571
    Rep Power
    7

    Default

    Why would you want to use Windows specific APIs from Java? Java is designed to be platform independant. If you want to write stuff tied to the Windoze API, why not use C# or one of the other .net platforms? Its a ton easier to write Windows code in a Windows language.

  5. #5
    jihadrh is offline Member
    Join Date
    Oct 2008
    Posts
    4
    Rep Power
    0

    Default

    hi ,
    thnx for the reply...
    so you are saying that java is not good, when we use windows api or its not possible ?

  6. #6
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,401
    Rep Power
    25

    Default

    What class is getactivewindow() in?
    What jar file is that class in?

  7. #7
    fishtoprecords's Avatar
    fishtoprecords is offline Senior Member
    Join Date
    Jun 2008
    Posts
    571
    Rep Power
    7

    Default

    Quote Originally Posted by jihadrh View Post
    so you are saying that java is not good, when we use windows api or its not possible ?
    Anything is possible. Some easier than other.

    I'm just pointing out that Java is platform independent. Write once, run everywhere.

    If your platform is Windows, a major justification for using Java is gone. And Microsoft does a lot to make it easy to write code that is seemless in their world.

    So the decision tree for me is:

    if (platform independent critical) use Java
    else if (tied forever to Windows) use C# or VB or ...

  8. #8
    jihadrh is offline Member
    Join Date
    Oct 2008
    Posts
    4
    Rep Power
    0

    Smile

    pls check this url for that jar docs ( jinvoke.com), I think it can help me to describe you more than I can....

    :o

  9. #9
    albus is offline Member
    Join Date
    Dec 2008
    Posts
    1
    Rep Power
    0

    Default

    If you are still interesting to find active window try this:

    KeyboardFocusManager.getCurrentKeyboardFocusManage r().getActiveWindow();

Similar Threads

  1. Close Active Window (?)
    By dcnorman07 in forum New To Java
    Replies: 2
    Last Post: 10-03-2008, 05:55 PM
  2. Changing Active Window
    By jmHoekst in forum New To Java
    Replies: 1
    Last Post: 06-14-2008, 12:21 AM
  3. Check Menu active
    By Mir in forum AWT / Swing
    Replies: 0
    Last Post: 06-12-2008, 06:53 AM
  4. Active Content enable problem
    By kasipandian in forum JavaServer Pages (JSP) and JSTL
    Replies: 0
    Last Post: 02-01-2008, 02:15 PM
  5. Accessing Active Directory
    By javaplus in forum Advanced Java
    Replies: 1
    Last Post: 01-04-2008, 11:25 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •