|
Hi Richard MacCutchan,
It would be better that i show you what i need bellow:
My final question is: get text under mouse pointer
As you know at the begining i wanna to do this with maximum support from winapi, but as your message winapi can not help all for this task. That's the reseon why I try to do this with one or some support from winapi (instead of thinking winapi can help me to do all for this). It makes me thinking about "how to get the rectangle from mouse point" and do OCR with this information.
I got some information from this link before i've post this question at Project.com:
http://stackoverflow.com/questions/3877762/get-the-word-under-the-mouse-cursor-in-windows/3877807#3877807
I see some dictionary software did this with click and see (Babylon, ...)
Can anybody explain me how they do that or any other solution to make thing posiple?
Thanks and Regards,
|
|
|
|
|
Look at it this way. The user clicks the mouse somewhere on the screen, which is displaying some text characters. Given that mouse position how can you figure out:
1. Where the mouse is in relation to the character; at the beginning, end, top ,bottom, to the left?
2. How big the character is; height, width, leading, overhang?
3. Has the character been rotated, is it bold or italic?
etc.
The best way to manage this would be to capture the entire visible portion of the window that the mouse is within and pass that image through some existing OCR package to try and convert it to text. However, this will still not guarantee that you will get the final result you are looking for.
The best things in life are not things.
|
|
|
|
|
Hi Richard MacCutchan
For sure your answer is correct but it is just only in theory. I need what api or sample code to do this.
"
1. Where the mouse is in relation to the character; at the beginning, end, top ,bottom, to the left?
2. How big the character is; height, width, leading, overhang?
3. Has the character been rotated, is it bold or italic?
etc.
The best way to manage this would be to capture the entire visible portion of the window that the mouse is within
"
Thanks and Regards,
|
|
|
|
|
sharkbc wrote: I need what api or sample code to do this.
Obviously I am not getting through to you. There is no API or sample code, you will have to write it for yourself. I have been trying to point out some of the issues you will need to solve in order to develop this application.
The best things in life are not things.
|
|
|
|
|
Hi Richard MacCutchan,
Thanks so much for our discussions so far.
I'm trying to do this.
Thanks again MacCutchan
Best regards,
|
|
|
|
|
Good day,
I am trying to get a third party DLL to work in java (FWIW, I am using Netbeans 7.0). I am aware that getting third party DLLS to work (especially if it's not a C/C++ type DLL), is not an easy feat, and that you should use JNI to accomplish this.
Like you guys know, following the JNI path will result in a wrapper for your DLL, which is exactly what I need.
I will provide my code for both the C++ section as well as the Java section, and then the error message I receive will follow that.
Please do note: I used javah to create the header file (see below) for the java file below.
TestVC_OmniIDE
#include <windows.h>;
#include <stdio.h>;
#include "TestProgram.h"
#pragma once
using namespace System;
namespace TestVC_OmniIDE {
BOOL WINAPI TestVC_OmniIDEMain(HANDLE hHandle, DWORD dwReason, LPVOID lpReserved)
{
return TRUE;
}
JNIEXPORT void JNICALL Java_TestProgram_UpdateTextFile(JNIEnv *, jclass)
{
printf("Hello world from VC++ DLL");
}
}
TestProgram.h
#include <jni.h>
#ifndef _Included_TestProgram
#define _Included_TestProgram
#ifdef __cplusplus
extern "C" {
#endif
JNIEXPORT void JNICALL Java_TestProgram_UpdateTextFile
(JNIEnv *, jclass);
#ifdef __cplusplus
}
#endif
#endif
TestProgram.java
class TestProgram
{
public static native void UpdateTextFile();
public static void main(String args[])
{
System.out.println("Hallo from main");
}
}
Java Code to Call JNI Wrapper
public class OmniText {
static
{
System.loadLibrary("TestVC_OmniIDE");
}
public native void UpdateTextFile();
}
Here is where I call the native method
OmniText omni = new OmniText();
omni.UpdateTextFile();
As you can see, this is only a test, but as soon as this will be successful, I will create a production version taking parameters and returning a value.
I know that the wrapper can be found, because, if I change the name of the wrapper file, it tells me that the file cannot be found.
Now for the error (which can be identified from the post subject):
Exception in thread "AWT-EventQueue-0" java.lang.UnsatisfiedLinkError: OmniDLLS.OmniText.UpdateTextFile()V
Now, this is the part I am troubling to find out. I have looked at other sources, but the majority of cases, they do not talk about the signature, that's the
<br />
OmniDLLS.OmniText.UpdateTextFile()V<br />
part. Both methods are exactly the same inside the wrapper and the way it is called, so I am stumped on this one.
If you could point out my mistake(s), I would highly appreciate this!
Kind regards,
Rossouw de Bruin
modified on Wednesday, July 20, 2011 1:27 AM
|
|
|
|
|
Where is the DLL? Make sure it is in the same folder as the .jar.
Alternatively make sure you declare it in the JVM launch arguments[^].
Panic, Chaos, Destruction. My work here is done.
Drink. Get drunk. Fall over - P O'H
OK, I will win to day or my name isn't Ethel Crudacre! - DD Ethel Crudacre
I cannot live by bread alone. Bacon and ketchup are needed as well. - Trollslayer
Have a bit more patience with newbies. Of course some of them act dumb - they're often *students*, for heaven's sake - Terry Pratchett
|
|
|
|
|
1. I don't think you should be putting your native code inside namespaces.
2. You have defined your native method in TestProgram.java inside the TestProgram class, but then you have a second definition inside OmniText class. You do not actually call the native code anywhere in the code samples you have shown.
The best things in life are not things.
|
|
|
|
|
Yes the namespace is wrong.
|
|
|
|
|
I have a feeling point 2 is also significant.
The best things in life are not things.
|
|
|
|
|
In the posted code but since they posted a link error from the native method the real code is calling it.
|
|
|
|
|
See the messages below; this is fixed now.
The best things in life are not things.
|
|
|
|
|
I have included point 2 in my question (I accidentally omitted this when I was writing the question), but thanks for pointing that out.
I should add that I used VC++ to create the header, which would explain the namespace and the pragma.
Also, I have numerous packages inside this application, and I have read that you should make the package of the wrapper to be the same as your package, which is a bit confusing, since I have quite a lot of packages.
PS, I have just now removed the System namespace, and still gives the same error as described in the question.
|
|
|
|
|
I still do not think that your CPP code should be included in a namespace; also you have a #pragma statement in your source which should be removed. You have defined your C function inside two different classes in your java source, and then tried to call it from the wrong class (it belongs to class TestProgram ).
RossouwDB wrote: I should add that I used VC++ to create the header, which would explain the namespace and the pragma.
I don't see how this statement holds true; the header file should be created by the javah command. I just tried a sample and it did not include any namespace information.
The best things in life are not things.
|
|
|
|
|
Richard MacCutchan wrote: I don't see how this statement holds true;
Your quite right. TestVC_OmniIDE was done using VC++, thus giving the pragma and namespaces.
Richard MacCutchan wrote: it belongs to class TestProgram
This seems to have been the problem.
I have found a fix, thanks to your help.
This is what I had done that resulted in the error
I created this "TestProgam" to test everything out, and have immediately put the code into my big application (which is not TestProgram).
This explained the error that I have received. After reading what you said above, I ran TestProgram.java and it worked.
Now, I will convert this "TestProgram" to a class (or maybe a separate .jar) and use this within my big application, which should work.
Thanks again for your help, it is much appreciated!
Kind regards,
Rossouw
|
|
|
|
|
Happy to help, and glad you found a solution. Good luck with your main project.
The best things in life are not things.
|
|
|
|
|
how do i enhance web service security using java netbeans
|
|
|
|
|
Please, ask your question once only.
Software rusts. Simon Stephenson, ca 1994.
|
|
|
|
|
|
Apart from the basics of providing a link - it's easy just clickity - this site is 7 years old and out of date. There's a much more reliable source of Java goodness here[^].
Panic, Chaos, Destruction. My work here is done.
Drink. Get drunk. Fall over - P O'H
OK, I will win to day or my name isn't Ethel Crudacre! - DD Ethel Crudacre
I cannot live by bread alone. Bacon and ketchup are needed as well. - Trollslayer
Have a bit more patience with newbies. Of course some of them act dumb - they're often *students*, for heaven's sake - Terry Pratchett
|
|
|
|
|
is here. web services in java netbeans[^]
And please - I know that complete sentences also exist in the English language. Try to at least explain on what you're working and what your goal is.
You will have to build your Services and Applications after development to deploy them to a Webserver.
Netbeans is your IDE, the Webserver a complete separated thing. You can secure the Webserver - but I won't recommend to secure the webservice you're using with Netbeans for development.
regards Torsten
I never finish anyth...
|
|
|
|
|
|
kindly help me how to lock a folder with java code
|
|
|
|
|
What do you mean by "lock"?
The best things in life are not things.
|
|
|
|
|
|