Re: Copy and Paste

Ally Rwegasira <[email protected]> Wed, 31 Aug 2005 01:50:14 -0700
Newsgroups gmane.comp.windows.devel.jawin
Message-ID <[email protected]>
Some one has told me that I can use SetWindowText API function but I should pass the handle of the edit I want to insert data or I can use SendMessage API of COM but I don't know how to use them in JAWIN

Josh Passenger <[email protected]> wrote:Hi Ally,

I think I understood that bit fine, but what is/are the native
application(s)?

Are these things you have the source code for? Are they written in VB or
are they exposed as COM components?

I don't think there is any code that will ever insert text into a focussed
text field in any arbitrary windows application.

My suggestion was probably only suitable if you had the source code to the
applications that you wanted to interface to and could make them listen for
UDP packets or watch a directory for files representing events from the Java
smart card reader.

If you don't have the source code and the native apps don't have type
libraries or don't have published APIs then you are probably out of luck.

The title of your email indicates that you might be interested in using copy
and paste and thus the clip board. I have previously integrated a Java
swing application with an Access database application by writing a row id to
the windows clipboard with a prefix eg:

SmartCardId:675454BT65

Then in the Access application, a timer was set up to poll the clip baord
and look to see if it started with: 'SmartCardId:'

Then the id was extracted from the clipboard string and work done to change
the UI, in your case, this would load a record for a student. This might
be another low tech solution to your problem. using the clipbaord is not
secure and getting access to another students account might be as easy as
copying an id to the clipboard from notepad so be careful. if you decide to
use the clipbaord, consider some form of encryption of the id while it is on
the clipboard, hashing in some expiry timestamp or something to make sure it
can't just be replayed

Josh

>
>Thanks Josh,
>I think you didn't understand my problem, my problem is that I need data to
>be placed at the possition of cursor in the native application which has
>focus like barcode reader does. So its means I want my application to act
>as input device. The real situation is that I am working with University of
>Dar es salaam, I have introduced the use of smartcard at the campus so now
>we want to integrate the exisiting Library application with this smartcard
>application. Library system takes an input by barcode reader and this input
>is the student identification number, Now we want the student's
>identification number to come direct from the chip of smartcard.
>In coming time will integrate all the University application with smartcard
>through this way.
>
>Josh Passenger wrote:
>Hi Ally,
>
>Your requirements are somewhat vague and the answer to your problem may
>very
>well not be in the use of Jawin to bridge java to native code.
>
>The generic type of interaction you discuss where the applications reside
>locally might be better solved with a socket based approach, where the java
>app that interfaces the smart card broadcasts via UDP the announcement that
>something has happened on the card reader.
>
>The native applications could listen for the specified UDP packets and
>respond accordingly.
>
>TCPIP network based approaches have been used for years to bridge
>incompatible software components, nowadays, SOAP and webservices are just a
>prettying up of these with a standard communication framework and syntax.
>
>A lower tech solution might involve dropping a file in a directory and
>using
>something like the file system watcher functionality available under c# to
>react when the file is dropped from the native app?
>
>Jawin is about bridging java to existing COM components (and DLLs). Unless
>you already have a COM component system (sounds like you don't) then
>probably best to put something simple and reliable in yourself.
>
>COM is just plain ugly anyway =]
>
>Josh
>
>
> >
> > I still remaind every one in the group to help me.
> >
> >I need 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 native application on position of cursor.
> >
> >This is a scenario:
> >some number will be stored in the javacard smartcard. when card inserted
> >take this number from the card to java application and then to native
> >application which currently has fucus.java application will be all the
> >time running on the back like any service in the system.
> >I managed to do all task except one of transferring data from java to any
> >native application.
> >I want my application to replace barcode reader apart from getting input
> >from the barcode in put will come from the card.
> >
> >
> >
> >
> >---------------------------------
> > Start your day with Yahoo! - make it your home page
>
>__________________________________________________
>Do You Yahoo!?
>Tired of spam? Yahoo! Mail has the best spam protection around
>http://mail.yahoo.com



Ali A. Rwegasira
Software Engineer, Jedi Development Limited
System Administrator, Smartcampus - University of Dar es salaam
P.O Box 65351
Tel: +255 (022) 2136601, +255 (022) 2410179
Fax: +255 (022) 2136602
Mobile: +255744274884
Other email: [email protected]
Dar es salaam
Tanzania






---------------------------------
Do you Yahoo!?
 Yahoo! Mail - You care about security. So do we.