-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bc6f66f
commit 18bec2c
Showing
71 changed files
with
2,173 additions
and
1,550 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,26 @@ | ||
/.metadata/ | ||
/.recommenders/ | ||
# Created by .ignore support plugin (hsz.mobi) | ||
### Java template | ||
# Compiled class file | ||
*.class | ||
|
||
# Log file | ||
*.log | ||
|
||
# BlueJ files | ||
*.ctxt | ||
|
||
# Mobile Tools for Java (J2ME) | ||
.mtj.tmp/ | ||
|
||
# Package Files # | ||
*.jar | ||
*.war | ||
*.nar | ||
*.ear | ||
*.zip | ||
*.tar.gz | ||
*.rar | ||
|
||
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml | ||
hs_err_pid* | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4"> | ||
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8" inherit-compiler-output="true"> | ||
<content url="file://$MODULE_DIR$"> | ||
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" /> | ||
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" /> | ||
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" /> | ||
<excludeFolder url="file://$MODULE_DIR$/target" /> | ||
</content> | ||
<orderEntry type="inheritedJdk" /> | ||
<orderEntry type="sourceFolder" forTests="false" /> | ||
<orderEntry type="library" name="Maven: net.java.dev.jna:jna:4.1.0" level="project" /> | ||
<orderEntry type="library" name="Maven: net.java.dev.jna:jna-platform:4.1.0" level="project" /> | ||
</component> | ||
</module> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<groupId>groupId</groupId> | ||
<artifactId>KeyboardHookTest</artifactId> | ||
<version>1.0-SNAPSHOT</version> | ||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<configuration> | ||
<source>1.8</source> | ||
<target>1.8</target> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
<dependencies> | ||
<!-- https://mvnrepository.com/artifact/net.java.dev.jna/jna --> | ||
<dependency> | ||
<groupId>net.java.dev.jna</groupId> | ||
<artifactId>jna</artifactId> | ||
<version>4.1.0</version> | ||
</dependency> | ||
<!-- https://mvnrepository.com/artifact/net.java.dev.jna/jna-platform --> | ||
<dependency> | ||
<groupId>net.java.dev.jna</groupId> | ||
<artifactId>jna-platform</artifactId> | ||
<version>4.1.0</version> | ||
</dependency> | ||
</dependencies> | ||
|
||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
import com.sun.jna.Pointer; | ||
import com.sun.jna.platform.win32.Kernel32; | ||
import com.sun.jna.platform.win32.User32; | ||
import com.sun.jna.platform.win32.WinDef.HMODULE; | ||
import com.sun.jna.platform.win32.WinDef.LPARAM; | ||
import com.sun.jna.platform.win32.WinDef.LRESULT; | ||
import com.sun.jna.platform.win32.WinDef.WPARAM; | ||
import com.sun.jna.platform.win32.WinUser; | ||
import com.sun.jna.platform.win32.WinUser.HHOOK; | ||
import com.sun.jna.platform.win32.WinUser.KBDLLHOOKSTRUCT; | ||
import com.sun.jna.platform.win32.WinUser.LowLevelKeyboardProc; | ||
import com.sun.jna.platform.win32.WinUser.MSG; | ||
|
||
public class KeyBoardHook { | ||
static HHOOK hhk = null; | ||
public static void main(String[] args) { | ||
HMODULE hMod = Kernel32.INSTANCE.GetModuleHandle(null); | ||
User32 lib = User32.INSTANCE; | ||
int result = 0; | ||
LowLevelKeyboardProc rr = new LowLevelKeyboardProc() { | ||
@Override | ||
public LRESULT callback(int nCode, WPARAM wParam, KBDLLHOOKSTRUCT info) { | ||
System.out.println(info.flags + " " + info.scanCode + " " + info.vkCode + " " + nCode + " " + wParam.intValue() + " " + wParam.doubleValue() ); | ||
try { | ||
if (nCode >= 0) { | ||
switch (wParam.intValue()) { | ||
case WinUser.WM_KEYUP: | ||
System.out.println(info.vkCode +"����" ); | ||
break; | ||
case WinUser.WM_KEYDOWN: | ||
System.out.println(info.vkCode +"����"); | ||
break; | ||
case WinUser.WM_SYSKEYUP: | ||
System.out.println(info.vkCode +"����----"); | ||
break; | ||
case WinUser.WM_SYSKEYDOWN: | ||
System.out.println(info.vkCode +"����----"); | ||
break; | ||
} | ||
|
||
} | ||
} catch (Exception e) { | ||
|
||
} | ||
|
||
Pointer ptr = info.getPointer(); | ||
|
||
long peer = Pointer.nativeValue(ptr); | ||
|
||
return lib.CallNextHookEx(hhk, nCode, wParam, new LPARAM(peer)); | ||
} | ||
}; | ||
hhk = lib.SetWindowsHookEx(WinUser.WH_KEYBOARD_LL, rr, hMod, 0); | ||
MSG msg = new MSG(); | ||
while ((result = lib.GetMessage(msg, null, 0, 0)) != 0) { | ||
if (result == -1) { | ||
System.err.println("error in get message"); | ||
break; | ||
} else { | ||
System.err.println("got message"); | ||
lib.TranslateMessage(msg); | ||
lib.DispatchMessage(msg); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4"> | ||
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8" inherit-compiler-output="true"> | ||
<content url="file://$MODULE_DIR$"> | ||
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" /> | ||
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" /> | ||
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" /> | ||
<sourceFolder url="file://$MODULE_DIR$/res" type="java-resource" /> | ||
<excludeFolder url="file://$MODULE_DIR$/target" /> | ||
</content> | ||
<orderEntry type="inheritedJdk" /> | ||
<orderEntry type="sourceFolder" forTests="false" /> | ||
<orderEntry type="library" name="Maven: net.java.dev.jna:jna:4.1.0" level="project" /> | ||
<orderEntry type="library" name="Maven: net.java.dev.jna:jna-platform:4.1.0" level="project" /> | ||
<orderEntry type="library" name="Maven: org.xerial.snappy:snappy-java:1.1.4" level="project" /> | ||
</component> | ||
</module> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<groupId>groupId</groupId> | ||
<artifactId>RemoteControl-Client</artifactId> | ||
<version>1.0-SNAPSHOT</version> | ||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<configuration> | ||
<source>1.8</source> | ||
<target>1.8</target> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
<dependencies> | ||
<!-- https://mvnrepository.com/artifact/net.java.dev.jna/jna --> | ||
<dependency> | ||
<groupId>net.java.dev.jna</groupId> | ||
<artifactId>jna</artifactId> | ||
<version>4.1.0</version> | ||
</dependency> | ||
<!-- https://mvnrepository.com/artifact/net.java.dev.jna/jna-platform --> | ||
<dependency> | ||
<groupId>net.java.dev.jna</groupId> | ||
<artifactId>jna-platform</artifactId> | ||
<version>4.1.0</version> | ||
</dependency> | ||
<!-- https://mvnrepository.com/artifact/org.xerial.snappy/snappy-java --> | ||
<dependency> | ||
<groupId>org.xerial.snappy</groupId> | ||
<artifactId>snappy-java</artifactId> | ||
<version>1.1.4</version> | ||
</dependency> | ||
|
||
</dependencies> | ||
|
||
</project> |
File renamed without changes
File renamed without changes
22 changes: 11 additions & 11 deletions
22
RemoteControlClient/src/DebugMessage.java → ...ol-Client/src/main/java/DebugMessage.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
|
||
public class DebugMessage { | ||
public static void printDebugMessage(String message) { | ||
System.out.println(message); | ||
} | ||
|
||
public static void printDebugMessage(Exception e) { | ||
e.getStackTrace(); | ||
System.out.println(e.getMessage()); | ||
} | ||
} | ||
|
||
public class DebugMessage { | ||
public static void printDebugMessage(String message) { | ||
System.out.println(message); | ||
} | ||
|
||
public static void printDebugMessage(Exception e) { | ||
e.getStackTrace(); | ||
System.out.println(e.getMessage()); | ||
} | ||
} |
Oops, something went wrong.