[SOLVED] modify this code

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

[SOLVED] modify this code

Postby Jhovarie » Thu Dec 16, 2010 1:44 am

Hello guys i don't know how to modify this code please help
this code work for F9,F10,F12 and Scape
and i want to registerHotKey for number 0 up to 9 and letter A up to z

here is the code

import java.awt.event.KeyEvent;
import com.melloware.jintellitype.HotkeyListener;
import com.melloware.jintellitype.JIntellitype;


public class Main implements HotkeyListener
{

private boolean running = true;

public static void main(String[] args)
{
System.out.println("Test key Event");

KeyTest test = new KeyTest();
test.registerHotKeys();
test.waitForESC();
test.cleanup();

System.out.println("Test finished");
}

public Main()
{
}

public void registerHotKeys()
{
// hook keystrokes
JIntellitype keyhook = JIntellitype.getInstance();

keyhook.registerHotKey(9, 0, KeyEvent.VK_F9);
keyhook.registerHotKey(10, 0, KeyEvent.VK_F10);
keyhook.registerHotKey(11, 0, KeyEvent.VK_F11);
keyhook.registerHotKey(12, 0, KeyEvent.VK_F12);
keyhook.registerHotKey(0, 0, KeyEvent.VK_ESCAPE);


keyhook.addHotKeyListener(this);
}

public void onHotKey(int identifier)
{
if(identifier > 0)
System.out.println("Received HotKey F"+identifier);
else
running = false;
}

public void waitForESC()
{
while(running) {
try {
Thread.sleep(10);
} catch (InterruptedException e) {}
}
}

public void cleanup()
{
JIntellitype.getInstance().cleanUp();
}
}

thanks in advance
Jhovarie
 
Posts: 10
Joined: Wed Dec 15, 2010 10:44 am

Re: modify this code change to registerhotkey number and letter

Postby Melloware » Thu Dec 16, 2010 6:37 am

I don't think Windows will allow you to register a HOt key for 0-9 and A-z on the keyboard. For some reason there might be a limit on number of hotkeys. Why would you want a hotkey on every key on the keyboard? That is not the intention of hotkeys for capturing keyboard input from every key.
=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Melloware Inc.
http://www.melloware.com
=-=-=-=-=-=-=-=-=-=-=-=-=-=-
User avatar
Melloware
Site Admin
 
Posts: 11020
Joined: Thu Dec 01, 2005 10:24 pm
Location: Philadelphia, Pennsylvania USA

Re: modify this code change to registerhotkey number and letter

Postby Jhovarie » Mon Dec 20, 2010 9:21 am

Melloware wrote:I don't think Windows will allow you to register a HOt key for 0-9 and A-z on the keyboard. For some reason there might be a limit on number of hotkeys. Why would you want a hotkey on every key on the keyboard? That is not the intention of hotkeys for capturing keyboard input from every key.


Hmmm.... the true reason is i just want to create a keyloger using java because im not contented that keyloger cannot be written in java because keyloger can be written in vb.net and c++ and another computer language without any using third party library and i think by the help of Jintellitype can do it.. any help please.
Jhovarie
 
Posts: 10
Joined: Wed Dec 15, 2010 10:44 am

Re: modify this code change to registerhotkey number and letter

Postby Melloware » Mon Dec 20, 2010 9:43 am

OK then a keylogger might be the only use case for using Jintellitype for this. You are right Java cannot natively be a keylogger without the C++ code used in the DLL or like you said in native C or VB code since it can attach directly to keyboard input.
=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Melloware Inc.
http://www.melloware.com
=-=-=-=-=-=-=-=-=-=-=-=-=-=-
User avatar
Melloware
Site Admin
 
Posts: 11020
Joined: Thu Dec 01, 2005 10:24 pm
Location: Philadelphia, Pennsylvania USA

Re: modify this code change to registerhotkey number and letter

Postby Jhovarie » Mon Dec 20, 2010 5:55 pm

Melloware wrote:OK then a keylogger might be the only use case for using Jintellitype for this. You are right Java cannot natively be a keylogger without the C++ code used in the DLL or like you said in native C or VB code since it can attach directly to keyboard input.


hello melloware can you show me the syntax of keyloger using JIntellitype?
Jhovarie
 
Posts: 10
Joined: Wed Dec 15, 2010 10:44 am

Re: modify this code change to registerhotkey number and letter

Postby Melloware » Mon Dec 20, 2010 6:04 pm

Jhovarie wrote:
Melloware wrote:OK then a keylogger might be the only use case for using Jintellitype for this. You are right Java cannot natively be a keylogger without the C++ code used in the DLL or like you said in native C or VB code since it can attach directly to keyboard input.


hello melloware can you show me the syntax of keyloger using JIntellitype?


You already have it.... you simply need to register as Hotkey for every single key on the keyboard.

A
Code: Select all
keyhook.registerHotKey(9, 0, 65);


B
Code: Select all
keyhook.registerHotKey(9, 0, 66);


C
Code: Select all
[code]keyhook.registerHotKey(9, 0, 67);[/code]


etc etc etc
=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Melloware Inc.
http://www.melloware.com
=-=-=-=-=-=-=-=-=-=-=-=-=-=-
User avatar
Melloware
Site Admin
 
Posts: 11020
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