+ Reply to Thread
Results 1 to 6 of 6

Thread: winAPI java

  1. #1
    galaxyAbstractor's Avatar
    galaxyAbstractor is offline Community Advocate galaxyAbstractor is on a distinguished road
    Join Date
    Oct 2007
    Location
    Land of Null and Insanity
    Posts
    5,495

    winAPI java

    Anyone knows how I can send keystrokes trough winAPI to a running software, in java? I tried ask in the Java channel, but they told me I am a idiot that they always do when they fail...

    What I would want to do is like http://johan.deckmar.net/2009/09/spo...ds-part-2.html, but in Java
    Last edited by galaxyAbstractor; 12-12-2009 at 07:39 AM.

  2. #2
    Gouri's Avatar
    Gouri is offline Community Paragon Gouri has a brilliant futureGouri has a brilliant futureGouri has a brilliant future
    Join Date
    Oct 2007
    Location
    India
    Posts
    4,502

    Re: winAPI java

    Are you saying that to use winAPI in java and send keystrokes to a application?

    I don't know whether it is useful or not but I heard about JWinAPI , Check this out --> http://sourceforge.net/projects/jwinapi/
    Last edited by Gouri; 12-12-2009 at 07:46 AM.
    If you feel my post is useful then click to give Reputation (bottom left corner of this post)

    X10 Hosting | News and Announcements | Premium Hosting | VPS Hosting | Prime Membership

    Tech Community | Gouri

  3. #3
    galaxyAbstractor's Avatar
    galaxyAbstractor is offline Community Advocate galaxyAbstractor is on a distinguished road
    Join Date
    Oct 2007
    Location
    Land of Null and Insanity
    Posts
    5,495

    Re: winAPI java

    Quote Originally Posted by gsonline View Post
    Are you saying that to use winAPI in java and send keystrokes to a application?

    I don't know whether it is useful or not but I heard about JWinAPI , Check this out --> http://sourceforge.net/projects/jwinapi/
    I tried it but it isn't too compatible, because you can only start the song with it, because when you start a song, the window title is changed, and then it does not work.

  4. #4
    misson is offline x10 Spammer misson is a jewel in the rough
    Join Date
    Mar 2008
    Location
    Libertatia
    Posts
    2,506

    Re: winAPI java

    You could try importing user32.dll using @dll.import or System.loadLibrary to get access to PostMessage and send a WM_KEYDOWN & WM_KEYUP or WM_CHAR message(s). Of course, you still need to find the window handle. The "how" of that depends entirely on the windows of interest (All windows? All visible windows? The frontmost window? Windows for a specific application? Something else?), but will involve loading other Windows API procedures.
    Be sure to read all pages linked in this post; they have further information that should prove useful. When asking for help, make sure you follow Eric Raymond's and Jon Skeet's guidelines for prompt, accurate responses. Please answer any questions I ask; they're not rhetorical (probably). Any posted code is intended as illustrative example, rather than a solution to your problem to be copied without alteration. Study it to learn how to write your own solution.
    Misson, not Mission.

  5. #5
    marshian's Avatar
    marshian is offline x10 Elder marshian is an unknown quantity at this point
    Join Date
    Jan 2008
    Location
    Belgium
    Posts
    526

    Re: winAPI java

    You can't, using only pure Java.
    You can however use the Java Native Interface (JNI), and write a native extension for Java that will allow you to do this. The problem is, you'll have to write it in a native language, Java just doesn't have the option to do it.
    And of course, if you use the JNI, the hardcore Java guys will hate you.

  6. #6
    galaxyAbstractor's Avatar
    galaxyAbstractor is offline Community Advocate galaxyAbstractor is on a distinguished road
    Join Date
    Oct 2007
    Location
    Land of Null and Insanity
    Posts
    5,495

    Re: winAPI java

    ah, I already fixed it in C++ using some app I found on google code xD

    http://pixomania.net/dev/rainmeter/s...-for-rainmeter

+ Reply to Thread

Similar Threads

  1. Recieve GET POST data, java?
    By Parsa44 in forum Programming Help
    Replies: 3
    Last Post: 11-29-2009, 02:47 PM
  2. Java Problems
    By runeps in forum Programming Help
    Replies: 5
    Last Post: 08-13-2009, 01:43 AM
  3. VPS - JAVA JDK Help
    By allofus in forum Programming Help
    Replies: 12
    Last Post: 03-14-2009, 12:09 PM
  4. Java
    By Rhianna in forum Scripts & 3rd Party Apps
    Replies: 4
    Last Post: 03-07-2009, 06:22 PM
  5. Anfy Java Applet Online problems
    By Tharu in forum Scripts & 3rd Party Apps
    Replies: 2
    Last Post: 08-02-2008, 09:05 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
x10hosting free hosting for the masses
dedicated servers