Menu

#9 Jawin: FindWindowEx

open
nobody
None
5
2005-09-30
2005-09-30
alli Dubo
No

I seek help on how can I write some code using jawin to
do the
following task, I need my code to act as barcode reader
driver to take data from java
application to focused native application on position of
cursor. My aim is to integrate the
existing systems (Developed using native language and
neither source code
nor API are available) with my application developed
using java.
I want my application to replace barcode reader apart
from getting
input from the barcode in put will come from the card.

When I run code below it throws an exception the
problem is in envocation(entry point)

public void setText(String text) throws Exception {
FuncPtr wndText = null;
FuncPtr getWnd = null;
FuncPtr wndEx = null;
try {
//GetForegroundWindow API: Get the handle of the
window that currently has focus
getWnd = new FuncPtr
("USER32.DLL", "GetForegroundWindow");
//FindWindowExW API: Find the Edit inside the window
and returns the window handle for the edit box
wndEx = new FuncPtr
("USER32.DLL", "FindWindowExW");
//SetWindowTextW API: set the text to edit box of
native aplication
wndText = new FuncPtr
("USER32.DLL", "SetWindowTextW");

int focus = getWnd.invoke_I
(ReturnFlags.CHECK_FALSE);
int edit = wndEx.invoke_I
(focus,ReturnFlags.CHECK_FALSE); //help me on this
line if the rest are ok
wndText.invoke_I(edit, text,
ReturnFlags.CHECK_FALSE);
}
catch (COMException e) {
// handle exception
e.printStackTrace();
throw e;
}
finally {
if (wndText != null) {
try {
wndText.close();
}
catch (COMException e) {
// handle fatal exception
e.printStackTrace();
throw e;
}
}
}
}

Discussion


Log in to post a comment.

MongoDB Logo MongoDB