No Observation while ingame

Feature Requests, Comments, Bugs, and Suggestions on the JIntellitype Java API.

No Observation while ingame

Postby Akrillo » Fri May 06, 2011 6:08 am

Hey guys,

at first I want to say good job. Its a very helpful API.

But I got a huge problem because jintellitype dont observe hotkeys if i am in a Game ( League of Legends ).
I setup some F1 --- F6 observations. If i am on Windows screen ( focused or unfocused the Application window ) verything runs fine. If I start the game ( i think Direct X9(11) Engine ) the observation stops.

Can some 1 tell me how to fix it ?

Update:

In Starcraft II everything runs fine
In League of Legends i got not events on pressing my hotkeys ;p I always need to tab out to windows

Best regards
Sebastian

Ahh here is my code :

Code: Select all

/**Main
*/
import com.melloware.jintellitype.JIntellitype;


public class Respawner {

   /**
    * @param args
    */
   public static void main(String[] args) {
      GUI gui = new GUI();
      KeyListener keyListener = new KeyListener(gui);
      
      // first check to see if an instance of this application is already
       // running, use the name of the window title of this JFrame for checking
       if (JIntellitype.checkInstanceAlreadyRunning("JIntellitype Test Application")) {
            System.exit(1);
       }
        
       // next check to make sure JIntellitype DLL can be found and we are on
       // a Windows operating System
       if (!JIntellitype.isJIntellitypeSupported()) {
           System.exit(1);
       }

       KeyListener mainFrame = new KeyListener(gui);
       mainFrame.initJIntellitype();
      
   }

}

/**
Hot key listener
*/

import java.awt.BorderLayout;
import java.awt.Event;
import java.awt.Frame;
import java.awt.GraphicsEnvironment;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.border.EtchedBorder;


import com.melloware.jintellitype.HotkeyListener;
import com.melloware.jintellitype.IntellitypeListener;
import com.melloware.jintellitype.JIntellitype;


public class KeyListener implements HotkeyListener, IntellitypeListener {

   /**
    * Logger for this class
    */
   private static KeyListener mainFrame;
   private final int F1 = java.awt.event.KeyEvent.VK_F1;
   private final int F2 = java.awt.event.KeyEvent.VK_F2;
   private final int F3 = java.awt.event.KeyEvent.VK_F3;
   private final int F4 = java.awt.event.KeyEvent.VK_F4;
   private final int F5 = java.awt.event.KeyEvent.VK_F5;
   private final int F6 = java.awt.event.KeyEvent.VK_F6;
   private final int F7 = java.awt.event.KeyEvent.VK_F7;
   private final int F8 = java.awt.event.KeyEvent.VK_F8;
   private final int F9 = java.awt.event.KeyEvent.VK_F9;
   private static GUI gui;

   /**
    * Creates new form.
    */
   public KeyListener(GUI gui) {
      KeyListener.gui = gui;
      initComponents();
   }


   public void onHotKey(int aIdentifier) {
      System.out.println(aIdentifier);
      switch(aIdentifier) {
         case F1:
          gui.team_resetBlue();
        break;
         case F2:
            gui.team_resetRed();
         break;
         case F3:
            gui.enemy_resetBlue();
         break;
         case F4:
            gui.enemy_resetRed();
         break;
         case F5:
            gui.resetDragon();
         break;
         case F6:
            gui.resetBaron();
         break;
        
      }
   }

   /*
    * (non-Javadoc)
    * @see com.melloware.jintellitype.IntellitypeListener#onIntellitype(int)
    */
   public void onIntellitype(int aCommand) {

   }

   /**
    * Centers window on desktop.
    * <p>
    * @param aFrame the Frame to center
    */
   private static void center(JFrame aFrame) {
      final GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
      final Point centerPoint = ge.getCenterPoint();
      final Rectangle bounds = ge.getMaximumWindowBounds();
      final int w = Math.min(aFrame.getWidth(), bounds.width);
      final int h = Math.min(aFrame.getHeight(), bounds.height);
      final int x = centerPoint.x - (w / 2);
      final int y = centerPoint.y - (h / 2);
      aFrame.setBounds(x, y, w, h);
      if ((w == bounds.width) && (h == bounds.height)) {
         aFrame.setExtendedState(Frame.MAXIMIZED_BOTH);
      }
      aFrame.validate();
   }


   /**
    * Method to unregister a hotkey using the UnregisterHotKey Windows API call.
    * <p>
    * @param aEvent the ActionEvent fired.
    */

   /**
    * This method is called from within the constructor to initialize the form.
    */
   private void initComponents() {
   // assign the WINDOWS+A key to the unique id 88 for identification
      JIntellitype.getInstance().registerHotKey(F1, JIntellitype.MOD_SHIFT, F1 );
      JIntellitype.getInstance().registerHotKey(F2, JIntellitype.MOD_SHIFT, F2);
      JIntellitype.getInstance().registerHotKey(F3, JIntellitype.MOD_SHIFT, F3);
      JIntellitype.getInstance().registerHotKey(F4, JIntellitype.MOD_SHIFT, F4);
      JIntellitype.getInstance().registerHotKey(F5, JIntellitype.MOD_SHIFT, F5);
      JIntellitype.getInstance().registerHotKey(F6, JIntellitype.MOD_SHIFT, F6);
      
        
   }

   /**
    * Initialize the JInitellitype library making sure the DLL is located.
    *
    */
   public void initJIntellitype() {
      try {

         // initialize JIntellitype with the frame so all windows commands can
         // be attached to this window
         JIntellitype.getInstance().addHotKeyListener(this);
         JIntellitype.getInstance().addIntellitypeListener(this);
         output("JIntellitype initialized");
      } catch (RuntimeException ex) {
         output("Either you are not on Windows, or there is a problem with the JIntellitype library!");
      }
   }

   /**
    * Send the output to the log and the text area.
    * <p>
    * @param text the text to output
    */
   private void output(String text) {
      System.out.println(text);
     
   }

}

Akrillo
 
Posts: 2
Joined: Fri May 06, 2011 6:02 am

Re: No Observation while ingame

Postby Melloware » Fri May 06, 2011 6:52 am

It might be the game. A lot of games to prevent people writing bots disable this kind of behavior at the OS level. So League of Legends might be doing something to disable all registered hotkeys when the game is running. Just a hunch...
=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Melloware Inc.
http://www.melloware.com
=-=-=-=-=-=-=-=-=-=-=-=-=-=-
User avatar
Melloware
Site Admin
 
Posts: 11043
Joined: Thu Dec 01, 2005 10:24 pm
Location: Philadelphia, Pennsylvania USA

Re: No Observation while ingame

Postby Akrillo » Fri May 06, 2011 8:52 am

mmhhmmm but there must be a solution ?!? :)

Have you an idea ? I only want to start some timers if i Press <hotkey> ..
Akrillo
 
Posts: 2
Joined: Fri May 06, 2011 6:02 am

Re: No Observation while ingame

Postby Melloware » Fri May 06, 2011 9:15 am

Akrillo wrote:mmhhmmm but there must be a solution ?!? :)

Have you an idea ? I only want to start some timers if i Press <hotkey> ..


I honestly don't have any ideas or any real expertise in this. If a game developer adds code to go in to the OS level and disable hotkeys there is not much you can do about it....
=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Melloware Inc.
http://www.melloware.com
=-=-=-=-=-=-=-=-=-=-=-=-=-=-
User avatar
Melloware
Site Admin
 
Posts: 11043
Joined: Thu Dec 01, 2005 10:24 pm
Location: Philadelphia, Pennsylvania USA


Return to JIntellitype

Who is online

Users browsing this forum: No registered users and 1 guest

cron