we use a terminal emulator called facetwin to run our main unix based applications
we want to attach a small document scanner and magnetic strip reader to the system this runs on
currently we have a magnetic reader that emulates a keyboard so it sends keystrokes back to the unix app. however the new scanner does not.

i can get around this by having the unix app send a special command that facetwin understands so it tells the local windows machine to run my vb application that controls the small document scanner
my vb app then sendkey's back the relevant info.

this is all great and works fine, yet i have a problem

there are 3 copies of facetwin running at anyone time all are logged in as the same user but maybe processing diferent things.

i need to find a way to know which open copy of facetwin just called my application so i can sendkeys back to the right one.

since thay logged in is the same user and the only thing the unix system knows thats unique i need a way for vb to know which facetwin windows called it, maybe fine it's pid or something

doesn anyone have any idea's how i might do something like this.


I have 2 idea's that might work to do what i want but there might be an easier way i dont know about.

1. Wrapper
I'm thinking that i could place some sort of wrapper arround the application as it runs.
then when it makes it's call i can intercept and know which open window make the call.
problem : never done anything remotly like it, not sure how to make the wrapper.

2. Background Application
Application that running in the background on the workstation all the time.
have the terminal windows make the call to the background app
have the app remain in the background and get the pid of the current window in focus on the workstation
pass the pid off to my scanner app.
problem : making sure the background app does not become in focus when it's called
problem 2 : finding the in focus window on the windows system (it's fairly easy to find it in your own app, but not sure how to find it when it's another app.)

thanks

DrkNite,

I am in tech support for FacetCorp. Maybe this info will help you.
If not, call or email us and we will try something else....

FacetWin sets these environment VARS for each session started:

[root@webinternal2 root]# printenv | grep FACET
FACETWINIPADDRPC=199.29.166.194
FACETWINNBNAME=JIMH-PC
FACETWINSLOT=1
FACETWININSTANCE=1
FACETWININFOSEQ=ENABLED
FACETPAGES=1
FACETTYPE=FacetWin
FACETWINPC=jimh-PC
FACETWINIPADDR=199.29.166.194

The FACETWININSTANCE is the session number of the PC
connecting to a Unix/Linux server. The first one will be 1,
the next one will be 2.

The FACETWNSLOT is the number of sessions the PC has
connected. If all sessions are going to the same Unix/Linux
box then INSTANCE's and SLOT's will be the same count.

You could also use the IP Var to tell which PC sent the message.

I hope this helps!

Jim Hutchins
FacetCorp

Thanks Jim

it's on the windows side i need to know which of up to 3 terminal all going to the same unix host ran FacetWin's PC command to call my scanner app
I think I've found a way to do it but you may have a better way.

what I've done is created a intermediate VB app that FacetWin calls
this app starts up minimized, none visible, starts a 10ms timer and is un-enabled
after 10ms the app looks for the windows in focus and gets it's pid
pass the pid to my scanner app and closes waiting for the next time it's run.
so far it's working pretty good i've had 3 facetwin windows open at one time and send the pc command from each of them in turn and it's always got the wright one.

if there is a better way I'd love to hear it.

Well if you already have a solution that is working for you its hard to argue with that. I was thinking you could use the VARS's that I mentioned to tell the application which session sent the command. The command going back to the PC can include command line args to pass important info. But, if you can grab the current window in focus, that should certainly be the same thing and get you the information that you need for your application. I am glad you have it working!

This question has already been answered. Start a new discussion instead.