Well i can't seem to figure out what's causing this error. I've read through the code and tested specific parts of it multiple times, but have had little progress.
Error
Code :Exception in thread "AWT-EventQueue-3" java.lang.UnsatisfiedLinkError: exe.DLLfunz.getbrow(Ljava/lang/String;)I at exe.DLLfunz.getbrow(Native Method) at exe.MouseMotionExample.jgetbrow(Unknown Source) at exe.MouseMotionExample.paint(Unknown Source) at java.awt.Container.update(Unknown Source) at sun.awt.RepaintArea.updateComponent(Unknown Source) at sun.awt.RepaintArea.paint(Unknown Source) at sun.awt.windows.WComponentPeer.handleEvent(Unknown Source) at java.awt.Component.dispatchEventImpl(Unknown Source) at java.awt.Container.dispatchEventImpl(Unknown Source) at java.awt.Component.dispatchEvent(Unknown Source) at java.awt.EventQueue.dispatchEvent(Unknown Source) at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.run(Unknown Source)
DLLfunz.java
Code :package exe; class DLLfunz { public native int getbrow(String title); static {System.load(MouseMotionExample.sysdir+"/DLL/MyDLL.dll");}}
MouseMotionExample.java
Code :package exe; import java.applet.*; import java.awt.*; import java.awt.image.BufferedImage; import java.io.* ; import javax.imageio.*; import java.util.*; import java.util.zip.*; import java.net.*; public class MouseMotionExample extends Applet{ public static String sysdir=System.getProperty("user.home").charAt(0)+":/Program Files/Switchit001.com"; public void init(){ DLLfunz boring=new DLLfunz(); System.out.println("JAVA1000"+boring.getbrow("hu")); System.out.print("init"); }}
DLLfunz.h
Code :/* DO NOT EDIT THIS FILE - it is machine generated */ #include "jni.h" /* Header for class DLLfunz */ #ifndef _Included_DLLfunz #define _Included_DLLfunz #ifdef __cplusplus extern "C" { #endif /* * Class: DLLfunz * Method: getbrow * Signature: (Ljava/lang/String;)I */ JNIEXPORT jint JNICALL Java_exe_DLLfunz_getbrow (JNIEnv *, jobject, jstring); #ifdef __cplusplus } #endif #endif
Main.cpp
Code :#include <string> #include <windows.h> #include "DLLfunz.h" using namespace std; HWND prog;//browser handle //get browser handle (return false if cant) JNIEXPORT jint JNICALL Java_exe_DLLfunz_getbrow (JNIEnv *env, jobject obj, jstring title2temp) {printf("Loaded"); const char *title2 = env->GetStringUTFChars(title2temp, 0); int noh; int progN=0; HWND h = ::GetTopWindow(0); while ( h ) {TCHAR title[500]; GetWindowText(h,title,500); if (strstr(title,title2)!=0) {prog=h; h=NULL;} else {h = ::GetNextWindow( h , GW_HWNDNEXT);}} if (IsWindowVisible(prog)==1) {return 1;} return 0;}
