Replace tabs with spaces

This commit is contained in:
2015-09-01 13:12:26 +01:00
parent b80574dc17
commit 6c1213e3e3
13 changed files with 473 additions and 473 deletions

View File

@@ -1,8 +1,8 @@
/*
JIntellitype (http://www.melloware.com/)
Java JNI API for Windows Intellitype commands and global keystrokes.
JIntellitype (http://www.melloware.com/)
Java JNI API for Windows Intellitype commands and global keystrokes.
Copyright (C) 1999, 2008 Emil A. Lefkof III, info@melloware.com
Copyright (C) 1999, 2008 Emil A. Lefkof III, info@melloware.com
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -17,8 +17,8 @@
limitations under the License.
Compiled with Mingw port of GCC,
Bloodshed Dev-C++ IDE (http://www.bloodshed.net/devcpp.html)
Compiled with Mingw port of GCC,
Bloodshed Dev-C++ IDE (http://www.bloodshed.net/devcpp.html)
*/
#include "stdafx.h"
#include "com_melloware_jintellitype_JIntellitype.h"
@@ -29,21 +29,21 @@ HINSTANCE g_instance = NULL;
BOOL WINAPI DllMain
(
HINSTANCE hinstDLL, // handle to DLL module
DWORD fdwReason, // reason for calling function
LPVOID lpvReserved // reserved
HINSTANCE hinstDLL, // handle to DLL module
DWORD fdwReason, // reason for calling function
LPVOID lpvReserved // reserved
)
{
switch( fdwReason )
{
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
{
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
case DLL_PROCESS_ATTACH:
g_instance = hinstDLL;
break;
case DLL_PROCESS_ATTACH:
g_instance = hinstDLL;
break;
}
return TRUE;
}
@@ -81,16 +81,16 @@ JNIEXPORT void JNICALL Java_com_melloware_jintellitype_JIntellitype_regHotKey
// Get handler
JIntellitypeHandler *l_handler = JIntellitypeHandler::extract( env, object );
if( l_handler )
{
l_handler->regHotKey(identifier, modifier, keycode);
}
else
{
if( l_handler )
{
l_handler->regHotKey(identifier, modifier, keycode);
}
else
{
// throw exception
jclass JIntellitypeException = env->FindClass("com/melloware/jintellitype/JIntellitypeException");
jclass JIntellitypeException = env->FindClass("com/melloware/jintellitype/JIntellitypeException");
env->ThrowNew(JIntellitypeException,"JIntellitype was not initialized properly.");
}
}
}
extern "C"
@@ -105,16 +105,16 @@ JNIEXPORT void JNICALL Java_com_melloware_jintellitype_JIntellitype_unregHotKey
// Get handler
JIntellitypeHandler *l_handler = JIntellitypeHandler::extract( env, object );
if( l_handler )
{
l_handler->unregHotKey(identifier);
}
else
{
if( l_handler )
{
l_handler->unregHotKey(identifier);
}
else
{
// throw exception
jclass JIntellitypeException = env->FindClass("com/melloware/jintellitype/JIntellitypeException");
jclass JIntellitypeException = env->FindClass("com/melloware/jintellitype/JIntellitypeException");
env->ThrowNew(JIntellitypeException,"JIntellitype was not initialized properly.");
}
}
}
@@ -127,12 +127,12 @@ extern "C"
JNIEXPORT void JNICALL Java_com_melloware_jintellitype_JIntellitype_terminate
(JNIEnv *env, jobject object)
{
// Get handler
JIntellitypeHandler *l_handler = JIntellitypeHandler::extract( env, object );
// Get handler
JIntellitypeHandler *l_handler = JIntellitypeHandler::extract( env, object );
// Clean up all resources allocated by this API
if( l_handler )
l_handler->terminate();
// Clean up all resources allocated by this API
if( l_handler )
l_handler->terminate();
}
@@ -148,10 +148,10 @@ JNIEXPORT jboolean JNICALL Java_com_melloware_jintellitype_JIntellitype_isRunnin
// App name for the hidden window's registered class
CHAR szAppName[] = "SunAwtFrame";
const char *cWndName = env->GetStringUTFChars(wndName, 0);
// Find out if there's a hidden window with the given title
HWND mHwnd = FindWindow(szAppName, cWndName);
env->ReleaseStringUTFChars(wndName, cWndName);
// If there is, another instance of our app is already running
return mHwnd != NULL;
// Find out if there's a hidden window with the given title
HWND mHwnd = FindWindow(szAppName, cWndName);
env->ReleaseStringUTFChars(wndName, cWndName);
// If there is, another instance of our app is already running
return mHwnd != NULL;
}

View File

@@ -1,8 +1,8 @@
/*
JIntellitype (http://www.melloware.com/)
Java JNI API for Windows Intellitype commands and global keystrokes.
JIntellitype (http://www.melloware.com/)
Java JNI API for Windows Intellitype commands and global keystrokes.
Copyright (C) 1999, 2008 Emil A. Lefkof III, info@melloware.com
Copyright (C) 1999, 2008 Emil A. Lefkof III, info@melloware.com
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -17,8 +17,8 @@
limitations under the License.
Compiled with Mingw port of GCC,
Bloodshed Dev-C++ IDE (http://www.bloodshed.net/devcpp.html)
Compiled with Mingw port of GCC,
Bloodshed Dev-C++ IDE (http://www.bloodshed.net/devcpp.html)
*/
#include "stdafx.h"
#include "JIntellitypeHandler.h"
@@ -33,13 +33,13 @@ UINT WM_SHELLHOOK = 0;
*/
JIntellitypeHandler *JIntellitypeHandler::extract( JNIEnv *env, jobject object )
{
// Get field ID
jfieldID l_handlerId = env->GetFieldID( env->GetObjectClass( object ), "handler", "I" );
// Get field ID
jfieldID l_handlerId = env->GetFieldID( env->GetObjectClass( object ), "handler", "I" );
// Get field
JIntellitypeHandler *l_handler = (JIntellitypeHandler *) env->GetIntField( object, l_handlerId );
// Get field
JIntellitypeHandler *l_handler = (JIntellitypeHandler *) env->GetIntField( object, l_handlerId );
return l_handler;
return l_handler;
}
/*
@@ -47,20 +47,20 @@ JIntellitypeHandler *JIntellitypeHandler::extract( JNIEnv *env, jobject object )
*/
JIntellitypeHandler::JIntellitypeHandler( JNIEnv *env, jobject object )
{
m_window = NULL;
m_window = NULL;
// Reference object
m_object = env->NewGlobalRef(object );
// Reference object
m_object = env->NewGlobalRef(object );
// Get method IDs
m_fireHotKey = env->GetMethodID( env->GetObjectClass( m_object ) , "onHotKey", "(I)V" );
m_fireIntellitype = env->GetMethodID( env->GetObjectClass( m_object ) , "onIntellitype", "(I)V" );
// Get method IDs
m_fireHotKey = env->GetMethodID( env->GetObjectClass( m_object ) , "onHotKey", "(I)V" );
m_fireIntellitype = env->GetMethodID( env->GetObjectClass( m_object ) , "onIntellitype", "(I)V" );
// Get field ID
jfieldID l_handlerId = env->GetFieldID( env->GetObjectClass( m_object ) , "handler", "I" );
// Get field ID
jfieldID l_handlerId = env->GetFieldID( env->GetObjectClass( m_object ) , "handler", "I" );
// Set field
env->SetIntField( m_object, l_handlerId, (jint) this );
// Set field
env->SetIntField( m_object, l_handlerId, (jint) this );
}
/*
@@ -68,20 +68,20 @@ JIntellitypeHandler::JIntellitypeHandler( JNIEnv *env, jobject object )
*/
JIntellitypeHandler::~JIntellitypeHandler()
{
// Get field ID
jfieldID l_handlerId = g_JIntellitypeThread.m_env->GetFieldID( g_JIntellitypeThread.m_env->GetObjectClass( m_object ), "handler", "I" );
// Get field ID
jfieldID l_handlerId = g_JIntellitypeThread.m_env->GetFieldID( g_JIntellitypeThread.m_env->GetObjectClass( m_object ), "handler", "I" );
// Set field
g_JIntellitypeThread.m_env->SetIntField( m_object, l_handlerId, 0 );
// Set field
g_JIntellitypeThread.m_env->SetIntField( m_object, l_handlerId, 0 );
// Release our reference
g_JIntellitypeThread.m_env->DeleteGlobalRef( m_object );
// unregister the shell hook
DeregisterShellHookWindow( m_window );
// Release our reference
g_JIntellitypeThread.m_env->DeleteGlobalRef( m_object );
// unregister the shell hook
DeregisterShellHookWindow( m_window );
// Destroy window
DestroyWindow( m_window );
// Destroy window
DestroyWindow( m_window );
}
@@ -91,9 +91,9 @@ JIntellitypeHandler::~JIntellitypeHandler()
void JIntellitypeHandler::initialize( JNIEnv *env, HINSTANCE instance )
{
m_instance = instance;
g_JIntellitypeThread.MakeSureThreadIsUp( env );
while( !PostThreadMessage( g_JIntellitypeThread, WM_JINTELLITYPE, INITIALIZE_CODE, (LPARAM) this ) )
Sleep( 0 );
g_JIntellitypeThread.MakeSureThreadIsUp( env );
while( !PostThreadMessage( g_JIntellitypeThread, WM_JINTELLITYPE, INITIALIZE_CODE, (LPARAM) this ) )
Sleep( 0 );
}
/*
@@ -102,56 +102,56 @@ void JIntellitypeHandler::initialize( JNIEnv *env, HINSTANCE instance )
*/
void JIntellitypeHandler::doInitialize()
{
// Register window class
WNDCLASSEX l_Class;
l_Class.cbSize = sizeof( l_Class );
l_Class.style = CS_HREDRAW | CS_VREDRAW;
l_Class.lpszClassName = TEXT( "JIntellitypeHandlerClass" );
l_Class.lpfnWndProc = WndProc;
l_Class.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);
l_Class.hCursor = NULL;
l_Class.hIcon = NULL;
l_Class.hIconSm = NULL;
l_Class.lpszMenuName = NULL;
l_Class.cbClsExtra = 0;
l_Class.cbWndExtra = 0;
l_Class.hInstance = m_instance;
// Register window class
WNDCLASSEX l_Class;
l_Class.cbSize = sizeof( l_Class );
l_Class.style = CS_HREDRAW | CS_VREDRAW;
l_Class.lpszClassName = TEXT( "JIntellitypeHandlerClass" );
l_Class.lpfnWndProc = WndProc;
l_Class.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);
l_Class.hCursor = NULL;
l_Class.hIcon = NULL;
l_Class.hIconSm = NULL;
l_Class.lpszMenuName = NULL;
l_Class.cbClsExtra = 0;
l_Class.cbWndExtra = 0;
l_Class.hInstance = m_instance;
if( !RegisterClassEx( &l_Class ) )
return;
if( !RegisterClassEx( &l_Class ) )
return;
// Create window
m_window = CreateWindow
(
TEXT( "JIntellitypeHandlerClass" ),
TEXT( "JIntellitypeHandler" ),
WS_OVERLAPPEDWINDOW,
0, 0, 0, 0,
NULL,
NULL,
m_instance,
NULL
);
// Create window
m_window = CreateWindow
(
TEXT( "JIntellitypeHandlerClass" ),
TEXT( "JIntellitypeHandler" ),
WS_OVERLAPPEDWINDOW,
0, 0, 0, 0,
NULL,
NULL,
m_instance,
NULL
);
if( !m_window )
return;
if( !m_window )
return;
//Set pointer to this object inside the Window's USERDATA section
SetWindowLongPtr( m_window, GWLP_USERDATA, (LONG) this );
// hide the window
ShowWindow(m_window, SW_HIDE);
UpdateWindow(m_window);
//register this window as a shell hook to intercept WM_APPCOMMAND messages
WM_SHELLHOOK = RegisterWindowMessage(TEXT("SHELLHOOK"));
BOOL (__stdcall *RegisterShellHookWindow)(HWND) = NULL;
RegisterShellHookWindow = (BOOL (__stdcall *)(HWND))GetProcAddress(GetModuleHandle("USER32.DLL"), "RegisterShellHookWindow");
//make sure it worked
if (!RegisterShellHookWindow(m_window)) {
//Set pointer to this object inside the Window's USERDATA section
SetWindowLongPtr( m_window, GWLP_USERDATA, (LONG) this );
// hide the window
ShowWindow(m_window, SW_HIDE);
UpdateWindow(m_window);
//register this window as a shell hook to intercept WM_APPCOMMAND messages
WM_SHELLHOOK = RegisterWindowMessage(TEXT("SHELLHOOK"));
BOOL (__stdcall *RegisterShellHookWindow)(HWND) = NULL;
RegisterShellHookWindow = (BOOL (__stdcall *)(HWND))GetProcAddress(GetModuleHandle("USER32.DLL"), "RegisterShellHookWindow");
//make sure it worked
if (!RegisterShellHookWindow(m_window)) {
// throw exception
jclass JIntellitypeException = g_JIntellitypeThread.m_env->FindClass("com/melloware/jintellitype/JIntellitypeException");
jclass JIntellitypeException = g_JIntellitypeThread.m_env->FindClass("com/melloware/jintellitype/JIntellitypeException");
g_JIntellitypeThread.m_env->ThrowNew(JIntellitypeException,"Could not register window as a shell hook window.");
}
}
@@ -164,12 +164,12 @@ void JIntellitypeHandler::doInitialize()
*/
void JIntellitypeHandler::regHotKey( jint identifier, jint modifier, jint keycode )
{
JIntellitypeHandlerCallback *callback = (JIntellitypeHandlerCallback*) malloc(sizeof(JIntellitypeHandlerCallback));
callback->identifier = identifier;
callback->modifier = modifier;
callback->keycode = keycode;
callback->handler = this;
PostThreadMessage( g_JIntellitypeThread, WM_JINTELLITYPE, REGISTER_HOTKEY_CODE, (LPARAM) callback );
JIntellitypeHandlerCallback *callback = (JIntellitypeHandlerCallback*) malloc(sizeof(JIntellitypeHandlerCallback));
callback->identifier = identifier;
callback->modifier = modifier;
callback->keycode = keycode;
callback->handler = this;
PostThreadMessage( g_JIntellitypeThread, WM_JINTELLITYPE, REGISTER_HOTKEY_CODE, (LPARAM) callback );
}
/*
@@ -177,9 +177,9 @@ void JIntellitypeHandler::regHotKey( jint identifier, jint modifier, jint keycod
*/
void JIntellitypeHandler::doRegHotKey(LPARAM callback_)
{
JIntellitypeHandlerCallback *callback = (JIntellitypeHandlerCallback*) callback_;
RegisterHotKey(m_window, callback->identifier, callback->modifier, callback->keycode);
free(callback);
JIntellitypeHandlerCallback *callback = (JIntellitypeHandlerCallback*) callback_;
RegisterHotKey(m_window, callback->identifier, callback->modifier, callback->keycode);
free(callback);
}
/*
@@ -189,9 +189,9 @@ void JIntellitypeHandler::doRegHotKey(LPARAM callback_)
void JIntellitypeHandler::unregHotKey( jint identifier )
{
JIntellitypeHandlerCallback *callback = (JIntellitypeHandlerCallback*) malloc(sizeof(JIntellitypeHandlerCallback));
callback->identifier = identifier;
callback->handler = this;
PostThreadMessage( g_JIntellitypeThread, WM_JINTELLITYPE, UNREGISTER_HOTKEY_CODE, (LPARAM) callback );
callback->identifier = identifier;
callback->handler = this;
PostThreadMessage( g_JIntellitypeThread, WM_JINTELLITYPE, UNREGISTER_HOTKEY_CODE, (LPARAM) callback );
}
/*
@@ -199,9 +199,9 @@ void JIntellitypeHandler::unregHotKey( jint identifier )
*/
void JIntellitypeHandler::doUnregisterHotKey(LPARAM callback_)
{
JIntellitypeHandlerCallback *callback = (JIntellitypeHandlerCallback*) callback_;
JIntellitypeHandlerCallback *callback = (JIntellitypeHandlerCallback*) callback_;
UnregisterHotKey(m_window, callback->identifier);
free(callback);
free(callback);
}
/*
@@ -212,9 +212,9 @@ void JIntellitypeHandler::doUnregisterHotKey(LPARAM callback_)
void JIntellitypeHandler::intellitype( jint commandId )
{
JIntellitypeHandlerCallback *callback = (JIntellitypeHandlerCallback*) malloc(sizeof(JIntellitypeHandlerCallback));
callback->command = commandId;
callback->handler = this;
PostThreadMessage( g_JIntellitypeThread, WM_JINTELLITYPE, INTELLITYPE_CODE, (LPARAM) callback );
callback->command = commandId;
callback->handler = this;
PostThreadMessage( g_JIntellitypeThread, WM_JINTELLITYPE, INTELLITYPE_CODE, (LPARAM) callback );
}
/*
@@ -222,9 +222,9 @@ void JIntellitypeHandler::intellitype( jint commandId )
*/
void JIntellitypeHandler::doIntellitype(LPARAM callback_)
{
JIntellitypeHandlerCallback *callback = (JIntellitypeHandlerCallback*) callback_;
JIntellitypeHandlerCallback *callback = (JIntellitypeHandlerCallback*) callback_;
g_JIntellitypeThread.m_env->CallVoidMethod(m_object, m_fireIntellitype, callback->command);
free(callback);
free(callback);
}
/*
@@ -232,7 +232,7 @@ void JIntellitypeHandler::doIntellitype(LPARAM callback_)
*/
void JIntellitypeHandler::terminate()
{
PostThreadMessage( g_JIntellitypeThread, WM_JINTELLITYPE, TERMINATE_CODE, (LPARAM) this );
PostThreadMessage( g_JIntellitypeThread, WM_JINTELLITYPE, TERMINATE_CODE, (LPARAM) this );
}
/*
@@ -240,7 +240,7 @@ void JIntellitypeHandler::terminate()
*/
void JIntellitypeHandler::fireHotKey(jint hotkeyId)
{
g_JIntellitypeThread.m_env->CallVoidMethod(m_object, m_fireHotKey, hotkeyId);
g_JIntellitypeThread.m_env->CallVoidMethod(m_object, m_fireHotKey, hotkeyId);
}
@@ -265,13 +265,13 @@ LRESULT CALLBACK JIntellitypeHandler::WndProc( HWND hWnd, UINT uMessage, WPARAM
switch( uMessage ) {
case WM_HOTKEY: {
JIntellitypeHandler *l_this = (JIntellitypeHandler *) GetWindowLongPtr( hWnd, GWLP_USERDATA );
l_this->fireHotKey(wParam);
l_this->fireHotKey(wParam);
return TRUE;
break;
break;
}
default:
return DefWindowProc( hWnd, uMessage, wParam, lParam );
}
}
}

View File

@@ -1,8 +1,8 @@
/*
JIntellitype (http://www.melloware.com/)
Java JNI API for Windows Intellitype commands and global keystrokes.
JIntellitype (http://www.melloware.com/)
Java JNI API for Windows Intellitype commands and global keystrokes.
Copyright (C) 1999, 2008 Emil A. Lefkof III, info@melloware.com
Copyright (C) 1999, 2008 Emil A. Lefkof III, info@melloware.com
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -17,8 +17,8 @@
limitations under the License.
Compiled with Mingw port of GCC,
Bloodshed Dev-C++ IDE (http://www.bloodshed.net/devcpp.html)
Compiled with Mingw port of GCC,
Bloodshed Dev-C++ IDE (http://www.bloodshed.net/devcpp.html)
*/
#include "stdafx.h"
#include "JIntellitypeThread.h"
@@ -29,105 +29,105 @@ JIntellitypeThread g_JIntellitypeThread;
JIntellitypeThread::JIntellitypeThread()
{
m_env = NULL;
m_thread = 0;
m_vm = NULL;
m_handlerCount = 0;
m_env = NULL;
m_thread = 0;
m_vm = NULL;
m_handlerCount = 0;
}
void JIntellitypeThread::MakeSureThreadIsUp( JNIEnv *env )
{
if( !m_thread )
{
// Get VM
env->GetJavaVM( &m_vm );
if( !m_thread )
{
// Get VM
env->GetJavaVM( &m_vm );
// Start "native" thread
CreateThread
(
NULL,
0,
ThreadProc,
this,
0,
&m_thread
);
}
// Start "native" thread
CreateThread
(
NULL,
0,
ThreadProc,
this,
0,
&m_thread
);
}
}
JIntellitypeThread::operator DWORD ()
{
return m_thread;
return m_thread;
}
DWORD WINAPI JIntellitypeThread::ThreadProc( LPVOID lpParameter )
{
JIntellitypeThread *l_this = (JIntellitypeThread *) lpParameter;
JIntellitypeThread *l_this = (JIntellitypeThread *) lpParameter;
// Attach the thread to the VM
l_this->m_vm->AttachCurrentThread( (void**) &l_this->m_env, NULL );
// Attach the thread to the VM
l_this->m_vm->AttachCurrentThread( (void**) &l_this->m_env, NULL );
MSG msg;
while( GetMessage( &msg, NULL, 0, 0 ) )
{
if( msg.message == WM_JINTELLITYPE )
{
// Extract handler
JIntellitypeHandler *l_handler;
MSG msg;
while( GetMessage( &msg, NULL, 0, 0 ) )
{
if( msg.message == WM_JINTELLITYPE )
{
// Extract handler
JIntellitypeHandler *l_handler;
switch( msg.wParam )
{
switch( msg.wParam )
{
case JIntellitypeHandler::INITIALIZE_CODE:
l_handler = (JIntellitypeHandler*) msg.lParam;
l_this->m_handlerCount++;
l_handler->doInitialize();
break;
case JIntellitypeHandler::REGISTER_HOTKEY_CODE:
l_handler = ((JIntellitypeHandlerCallback*) msg.lParam)->handler;
l_handler->doRegHotKey(msg.lParam);
break;
l_handler = (JIntellitypeHandler*) msg.lParam;
l_this->m_handlerCount++;
l_handler->doInitialize();
break;
case JIntellitypeHandler::REGISTER_HOTKEY_CODE:
l_handler = ((JIntellitypeHandlerCallback*) msg.lParam)->handler;
l_handler->doRegHotKey(msg.lParam);
break;
case JIntellitypeHandler::UNREGISTER_HOTKEY_CODE:
l_handler = ((JIntellitypeHandlerCallback*) msg.lParam)->handler;
l_handler->doUnregisterHotKey(msg.lParam);
break;
case JIntellitypeHandler::INTELLITYPE_CODE:
l_handler = ((JIntellitypeHandlerCallback*) msg.lParam)->handler;
l_handler->doIntellitype(msg.lParam);
break;
case JIntellitypeHandler::UNREGISTER_HOTKEY_CODE:
l_handler = ((JIntellitypeHandlerCallback*) msg.lParam)->handler;
l_handler->doUnregisterHotKey(msg.lParam);
break;
case JIntellitypeHandler::INTELLITYPE_CODE:
l_handler = ((JIntellitypeHandlerCallback*) msg.lParam)->handler;
l_handler->doIntellitype(msg.lParam);
break;
case JIntellitypeHandler::TERMINATE_CODE:
l_handler = (JIntellitypeHandler*) msg.lParam;
case JIntellitypeHandler::TERMINATE_CODE:
l_handler = (JIntellitypeHandler*) msg.lParam;
// Destroy it!
delete l_handler;
// Destroy it!
delete l_handler;
// No more handlers?
if( !--l_this->m_handlerCount )
{
l_this->m_thread = 0;
// No more handlers?
if( !--l_this->m_handlerCount )
{
l_this->m_thread = 0;
// Detach thread from VM
l_this->m_vm->DetachCurrentThread();
// Detach thread from VM
l_this->m_vm->DetachCurrentThread();
// Time to die
ExitThread( 0 );
}
break;
}
}
else
{
TranslateMessage( &msg );
DispatchMessage( &msg );
}
}
// Time to die
ExitThread( 0 );
}
break;
}
}
else
{
TranslateMessage( &msg );
DispatchMessage( &msg );
}
}
// Detach thread from VM
l_this->m_vm->DetachCurrentThread();
// Detach thread from VM
l_this->m_vm->DetachCurrentThread();
return 0;
return 0;
}

View File

@@ -1,6 +1,6 @@
// stdafx.cpp : source file that includes just the standard includes
// win32.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
// win32.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"

View File

@@ -1,8 +1,8 @@
/*
JIntellitype (http://www.melloware.com/)
Java JNI API for Windows Intellitype commands and global keystrokes.
JIntellitype (http://www.melloware.com/)
Java JNI API for Windows Intellitype commands and global keystrokes.
Copyright (C) 1999, 2008 Emil A. Lefkof III, info@melloware.com
Copyright (C) 1999, 2008 Emil A. Lefkof III, info@melloware.com
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -17,8 +17,8 @@
limitations under the License.
Compiled with Mingw port of GCC,
Bloodshed Dev-C++ IDE (http://www.bloodshed.net/devcpp.html)
Compiled with Mingw port of GCC,
Bloodshed Dev-C++ IDE (http://www.bloodshed.net/devcpp.html)
*/
#ifndef __JIntellitypeHandler_h__
#define __JIntellitypeHandler_h__
@@ -27,65 +27,65 @@
class JIntellitypeHandler
{
friend DWORD WINAPI JIntellitypeThread::ThreadProc( LPVOID lpParameter );
friend DWORD WINAPI JIntellitypeThread::ThreadProc( LPVOID lpParameter );
public:
static JIntellitypeHandler *extract( JNIEnv *env, jobject object );
static JIntellitypeHandler *extract( JNIEnv *env, jobject object );
JIntellitypeHandler( JNIEnv *env, jobject object );
JIntellitypeHandler( JNIEnv *env, jobject object );
void initialize( JNIEnv *env, HINSTANCE instance );
void regHotKey( jint identifier, jint modifier, jint keycode );
void unregHotKey( jint identifier );
void intellitype( jint commandId );
void terminate();
void initialize( JNIEnv *env, HINSTANCE instance );
void regHotKey( jint identifier, jint modifier, jint keycode );
void unregHotKey( jint identifier );
void intellitype( jint commandId );
void terminate();
private:
enum
{
INITIALIZE_CODE = 1,
enum
{
INITIALIZE_CODE = 1,
REGISTER_HOTKEY_CODE = 2,
UNREGISTER_HOTKEY_CODE = 3,
TERMINATE_CODE = 4,
INTELLITYPE_CODE = 5
};
UNREGISTER_HOTKEY_CODE = 3,
TERMINATE_CODE = 4,
INTELLITYPE_CODE = 5
};
~JIntellitypeHandler();
~JIntellitypeHandler();
void createHiddenWindow();
void doInitialize();
void doRegHotKey(LPARAM callback);
void doUnregisterHotKey(LPARAM callback);
void doIntellitype(LPARAM callback);
void fireHotKey(jint hotkeyId);
void fireIntellitype(jint commandId);
void createHiddenWindow();
void doInitialize();
void doRegHotKey(LPARAM callback);
void doUnregisterHotKey(LPARAM callback);
void doIntellitype(LPARAM callback);
void fireHotKey(jint hotkeyId);
void fireIntellitype(jint commandId);
HINSTANCE m_instance;
HWND m_window;
jobject m_object;
jmethodID m_fireHotKey;
jmethodID m_fireIntellitype;
HINSTANCE m_instance;
HWND m_window;
jobject m_object;
jmethodID m_fireHotKey;
jmethodID m_fireIntellitype;
static LRESULT CALLBACK WndProc( HWND hWnd, UINT uMessage, WPARAM wParam, LPARAM lParam );
static DWORD WINAPI ThreadProc( LPVOID lpParameter );
static LRESULT CALLBACK WndProc( HWND hWnd, UINT uMessage, WPARAM wParam, LPARAM lParam );
static DWORD WINAPI ThreadProc( LPVOID lpParameter );
};
typedef struct {
JIntellitypeHandler *handler;
jint identifier;
jint modifier;
jint keycode;
jint command;
JIntellitypeHandler *handler;
jint identifier;
jint modifier;
jint keycode;
jint command;
} JIntellitypeHandlerCallback;
#ifndef WM_APPCOMMAND
#define WM_APPCOMMAND 0x319
#define FAPPCOMMAND_MASK 0x8000
#define WM_APPCOMMAND 0x319
#define FAPPCOMMAND_MASK 0x8000
#define GET_APPCOMMAND_LPARAM(lParam) ((short)(HIWORD(lParam) & ~FAPPCOMMAND_MASK))
#define HSHELL_APPCOMMAND 12
#define HSHELL_APPCOMMAND 12
#endif

View File

@@ -1,8 +1,8 @@
/*
JIntellitype (http://www.melloware.com/)
Java JNI API for Windows Intellitype commands and global keystrokes.
JIntellitype (http://www.melloware.com/)
Java JNI API for Windows Intellitype commands and global keystrokes.
Copyright (C) 1999, 2008 Emil A. Lefkof III, info@melloware.com
Copyright (C) 1999, 2008 Emil A. Lefkof III, info@melloware.com
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -17,8 +17,8 @@
limitations under the License.
Compiled with Mingw port of GCC,
Bloodshed Dev-C++ IDE (http://www.bloodshed.net/devcpp.html)
Compiled with Mingw port of GCC,
Bloodshed Dev-C++ IDE (http://www.bloodshed.net/devcpp.html)
*/
#ifndef __JIntellitypeThread_h__
#define __JIntellitypeThread_h__
@@ -28,22 +28,22 @@ class JIntellitypeThread
{
public:
JIntellitypeThread();
JIntellitypeThread();
void MakeSureThreadIsUp( JNIEnv *env );
void MakeSureThreadIsUp( JNIEnv *env );
JNIEnv *m_env;
static DWORD WINAPI ThreadProc( LPVOID lpParameter );
JNIEnv *m_env;
static DWORD WINAPI ThreadProc( LPVOID lpParameter );
operator DWORD ();
operator DWORD ();
private:
DWORD m_thread;
JavaVM *m_vm;
int m_handlerCount;
DWORD m_thread;
JavaVM *m_vm;
int m_handlerCount;
};
extern JIntellitypeThread g_JIntellitypeThread;

View File

@@ -5,19 +5,19 @@
#define JINTELLITYPE_PRIVATE_H
/* VERSION DEFINITIONS */
#define VER_STRING "1.0.0.465"
#define VER_MAJOR 1
#define VER_MINOR 0
#define VER_RELEASE 0
#define VER_BUILD 465
#define COMPANY_NAME "Melloware Inc (www.melloware.com)"
#define FILE_VERSION "1.0"
#define FILE_DESCRIPTION "Java JNI bridge to MS Intellitype commands"
#define INTERNAL_NAME ""
#define LEGAL_COPYRIGHT "Copyright 2006 Melloware Inc"
#define LEGAL_TRADEMARKS "Copyright 2006 Melloware Inc"
#define ORIGINAL_FILENAME ""
#define PRODUCT_NAME "JIntellitype"
#define PRODUCT_VERSION "1.0"
#define VER_STRING "1.0.0.465"
#define VER_MAJOR 1
#define VER_MINOR 0
#define VER_RELEASE 0
#define VER_BUILD 465
#define COMPANY_NAME "Melloware Inc (www.melloware.com)"
#define FILE_VERSION "1.0"
#define FILE_DESCRIPTION "Java JNI bridge to MS Intellitype commands"
#define INTERNAL_NAME ""
#define LEGAL_COPYRIGHT "Copyright 2006 Melloware Inc"
#define LEGAL_TRADEMARKS "Copyright 2006 Melloware Inc"
#define ORIGINAL_FILENAME ""
#define PRODUCT_NAME "JIntellitype"
#define PRODUCT_VERSION "1.0"
#endif /*JINTELLITYPE_PRIVATE_H*/

View File

@@ -11,7 +11,7 @@
#endif // _MSC_VER > 1000
// Insert your headers here
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#include <windows.h>
#include <shellapi.h>

View File

@@ -36,11 +36,11 @@ package com.melloware.jintellitype;
*/
public interface HotkeyListener
{
/**
* Event fired when a WM_HOTKEY message is received that was initiated
* by this application.
* <p>
* @param identifier the unique Identifer the Hotkey was assigned
*/
void onHotKey( int identifier );
/**
* Event fired when a WM_HOTKEY message is received that was initiated
* by this application.
* <p>
* @param identifier the unique Identifer the Hotkey was assigned
*/
void onHotKey( int identifier );
}

View File

@@ -41,11 +41,11 @@ package com.melloware.jintellitype;
*/
public interface IntellitypeListener
{
/**
* Event fired when a WM_APPCOMMAND message is received that was initiated
* by this application.
* <p>
* @param command the WM_APPCOMMAND that was pressed
*/
void onIntellitype( int command );
/**
* Event fired when a WM_APPCOMMAND message is received that was initiated
* by this application.
* <p>
* @param command the WM_APPCOMMAND that was pressed
*/
void onIntellitype( int command );
}

View File

@@ -92,9 +92,9 @@ public final class JIntellitype implements JIntellitypeConstants {
* calling.
*/
private JIntellitype() {
Native.load("com.github.boukefalos", "jlibintellitype");
initializeLibrary();
this.keycodeMap = getKey2KeycodeMapping();
Native.load("com.github.boukefalos", "jlibintellitype");
initializeLibrary();
this.keycodeMap = getKey2KeycodeMapping();
}
/**

View File

@@ -35,148 +35,148 @@ package com.melloware.jintellitype;
public interface JIntellitypeConstants {
public static final String ERROR_MESSAGE = "JIntellitype DLL Error";
// Modifier keys, can be added together
/**
* ALT key for registering Hotkeys.
*/
public static final int MOD_ALT = 1;
/**
* CONTROL key for registering Hotkeys.
*/
public static final int MOD_CONTROL = 2;
/**
* SHIFT key for registering Hotkeys.
*/
public static final int MOD_SHIFT = 4;
/**
* WINDOWS key for registering Hotkeys.
*/
public static final int MOD_WIN = 8;
// Intellitype Virtual Key Constants from MSDN
/**
* Browser Navigate backward
*/
public static final int APPCOMMAND_BROWSER_BACKWARD = 1;
/**
* Browser Navigate forward
*/
public static final int APPCOMMAND_BROWSER_FORWARD = 2;
/**
* Browser Refresh page
*/
public static final int APPCOMMAND_BROWSER_REFRESH = 3;
/**
* Browser Stop download
*/
public static final int APPCOMMAND_BROWSER_STOP = 4;
/**
* Browser Open search
*/
public static final int APPCOMMAND_BROWSER_SEARCH = 5;
/**
* Browser Open favorites
*/
public static final int APPCOMMAND_BROWSER_FAVOURITES = 6;
/**
* Browser Navigate home
*/
public static final int APPCOMMAND_BROWSER_HOME = 7;
/**
* Mute the volume
*/
public static final int APPCOMMAND_VOLUME_MUTE = 8;
/**
* Lower the volume
*/
public static final int APPCOMMAND_VOLUME_DOWN = 9;
/**
* Raise the volume
*/
public static final int APPCOMMAND_VOLUME_UP = 10;
/**
* Media application go to next track.
*/
public static final int APPCOMMAND_MEDIA_NEXTTRACK = 11;
/**
* Media application Go to previous track.
*/
public static final int APPCOMMAND_MEDIA_PREVIOUSTRACK = 12;
/**
* Media application Stop playback.
*/
public static final int APPCOMMAND_MEDIA_STOP = 13;
/**
* Media application Play or pause playback.
*/
public static final int APPCOMMAND_MEDIA_PLAY_PAUSE = 14;
/**
* Open mail application
*/
public static final int APPCOMMAND_LAUNCH_MAIL = 15;
/**
* Go to Media Select mode.
*/
public static final int APPCOMMAND_LAUNCH_MEDIA_SELECT = 16;
/**
* Start App1.
*/
public static final int APPCOMMAND_LAUNCH_APP1 = 17;
/**
* Start App2.
*/
public static final int APPCOMMAND_LAUNCH_APP2 = 18;
public static final int APPCOMMAND_BASS_DOWN = 19;
public static final int APPCOMMAND_BASS_BOOST = 20;
public static final int APPCOMMAND_BASS_UP = 21;
public static final int APPCOMMAND_TREBLE_DOWN = 22;
public static final int APPCOMMAND_TREBLE_UP = 23;
public static final int APPCOMMAND_MICROPHONE_VOLUME_MUTE = 24;
public static final int APPCOMMAND_MICROPHONE_VOLUME_DOWN = 25;
public static final int APPCOMMAND_MICROPHONE_VOLUME_UP = 26;
public static final int APPCOMMAND_HELP = 27;
public static final int APPCOMMAND_FIND = 28;
public static final int APPCOMMAND_NEW = 29;
public static final int APPCOMMAND_OPEN = 30;
public static final int APPCOMMAND_CLOSE = 31;
public static final int APPCOMMAND_SAVE = 32;
public static final int APPCOMMAND_PRINT = 33;
public static final int APPCOMMAND_UNDO = 34;
public static final int APPCOMMAND_REDO = 35;
public static final int APPCOMMAND_COPY = 36;
public static final int APPCOMMAND_CUT = 37;
public static final int APPCOMMAND_PASTE = 38;
public static final int APPCOMMAND_REPLY_TO_MAIL = 39;
public static final int APPCOMMAND_FORWARD_MAIL = 40;
public static final int APPCOMMAND_SEND_MAIL = 41;
public static final int APPCOMMAND_SPELL_CHECK = 42;
public static final int APPCOMMAND_DICTATE_OR_COMMAND_CONTROL_TOGGLE = 43;
public static final int APPCOMMAND_MIC_ON_OFF_TOGGLE = 44;
public static final int APPCOMMAND_CORRECTION_LIST = 45;
// Modifier keys, can be added together
/**
* ALT key for registering Hotkeys.
*/
public static final int MOD_ALT = 1;
/**
* CONTROL key for registering Hotkeys.
*/
public static final int MOD_CONTROL = 2;
/**
* SHIFT key for registering Hotkeys.
*/
public static final int MOD_SHIFT = 4;
/**
* WINDOWS key for registering Hotkeys.
*/
public static final int MOD_WIN = 8;
// Intellitype Virtual Key Constants from MSDN
/**
* Browser Navigate backward
*/
public static final int APPCOMMAND_BROWSER_BACKWARD = 1;
/**
* Browser Navigate forward
*/
public static final int APPCOMMAND_BROWSER_FORWARD = 2;
/**
* Browser Refresh page
*/
public static final int APPCOMMAND_BROWSER_REFRESH = 3;
/**
* Browser Stop download
*/
public static final int APPCOMMAND_BROWSER_STOP = 4;
/**
* Browser Open search
*/
public static final int APPCOMMAND_BROWSER_SEARCH = 5;
/**
* Browser Open favorites
*/
public static final int APPCOMMAND_BROWSER_FAVOURITES = 6;
/**
* Browser Navigate home
*/
public static final int APPCOMMAND_BROWSER_HOME = 7;
/**
* Mute the volume
*/
public static final int APPCOMMAND_VOLUME_MUTE = 8;
/**
* Lower the volume
*/
public static final int APPCOMMAND_VOLUME_DOWN = 9;
/**
* Raise the volume
*/
public static final int APPCOMMAND_VOLUME_UP = 10;
/**
* Media application go to next track.
*/
public static final int APPCOMMAND_MEDIA_NEXTTRACK = 11;
/**
* Media application Go to previous track.
*/
public static final int APPCOMMAND_MEDIA_PREVIOUSTRACK = 12;
/**
* Media application Stop playback.
*/
public static final int APPCOMMAND_MEDIA_STOP = 13;
/**
* Media application Play or pause playback.
*/
public static final int APPCOMMAND_MEDIA_PLAY_PAUSE = 14;
/**
* Open mail application
*/
public static final int APPCOMMAND_LAUNCH_MAIL = 15;
/**
* Go to Media Select mode.
*/
public static final int APPCOMMAND_LAUNCH_MEDIA_SELECT = 16;
/**
* Start App1.
*/
public static final int APPCOMMAND_LAUNCH_APP1 = 17;
/**
* Start App2.
*/
public static final int APPCOMMAND_LAUNCH_APP2 = 18;
public static final int APPCOMMAND_BASS_DOWN = 19;
public static final int APPCOMMAND_BASS_BOOST = 20;
public static final int APPCOMMAND_BASS_UP = 21;
public static final int APPCOMMAND_TREBLE_DOWN = 22;
public static final int APPCOMMAND_TREBLE_UP = 23;
public static final int APPCOMMAND_MICROPHONE_VOLUME_MUTE = 24;
public static final int APPCOMMAND_MICROPHONE_VOLUME_DOWN = 25;
public static final int APPCOMMAND_MICROPHONE_VOLUME_UP = 26;
public static final int APPCOMMAND_HELP = 27;
public static final int APPCOMMAND_FIND = 28;
public static final int APPCOMMAND_NEW = 29;
public static final int APPCOMMAND_OPEN = 30;
public static final int APPCOMMAND_CLOSE = 31;
public static final int APPCOMMAND_SAVE = 32;
public static final int APPCOMMAND_PRINT = 33;
public static final int APPCOMMAND_UNDO = 34;
public static final int APPCOMMAND_REDO = 35;
public static final int APPCOMMAND_COPY = 36;
public static final int APPCOMMAND_CUT = 37;
public static final int APPCOMMAND_PASTE = 38;
public static final int APPCOMMAND_REPLY_TO_MAIL = 39;
public static final int APPCOMMAND_FORWARD_MAIL = 40;
public static final int APPCOMMAND_SEND_MAIL = 41;
public static final int APPCOMMAND_SPELL_CHECK = 42;
public static final int APPCOMMAND_DICTATE_OR_COMMAND_CONTROL_TOGGLE = 43;
public static final int APPCOMMAND_MIC_ON_OFF_TOGGLE = 44;
public static final int APPCOMMAND_CORRECTION_LIST = 45;
}

View File

@@ -32,24 +32,24 @@ package com.melloware.jintellitype;
*/
public class JIntellitypeException extends RuntimeException {
public JIntellitypeException() {
super();
}
public JIntellitypeException() {
super();
}
public JIntellitypeException(String aMessage, Throwable aCause) {
super(aMessage, aCause);
}
public JIntellitypeException(String aMessage, Throwable aCause) {
super(aMessage, aCause);
}
public JIntellitypeException(String aMessage) {
super(aMessage);
}
public JIntellitypeException(String aMessage) {
super(aMessage);
}
public JIntellitypeException(Throwable aCause) {
super(aCause);
}
public JIntellitypeException(Throwable aCause) {
super(aCause);
}
}