Avatar of IT79637
IT79637Flag for United States of America

asked on 

Find Windows (.exe) handle in scripting languages

I'm obsessed in interfacing a web application to an ole server written in Delphi 2007!  The the direction of the flow works as follows:

HTML Page --> VBScript --> Delphi OLE Server --> VBScript --> HTML Page.  Starting at the HTML page works perfect.  I can execute methods on the server and get data back.

There are programs on the internet which if you enter a program name, it will return the handle to that program, provided it is running.   See picture below as an example.

My question is way Out-Of-The-Box.  If I have a Program Name and Handle, can I "somehow stuff" the Handle, Program Pame and DispInterface Name in a VBScript Object and have the VBS Object and have the VBS object work as if it were created this way:

Create the object in VBS          --> Set mySrvObj = CreateObject("ImageDisplaySrv.ImgDisp")
Call a server method from VBS -->   mySrvObj.WorkInvoice(vCompany, vInvType, vDocID, vStaus)

Would other scripting languages, such as PHP, Python, etc... that could do this?

What I want to do is something like this:

Dim myObject
myObject = handle of the object, Disp Interface Name, GUID, program name,  whatever is needed.  I want this for my ole Server

If you know of a resource, please point me in that direction.

Thanks.
I know, I don't want  toooo much!
LOL
Unfortunately, I'm serious.

Thanks much!!!

FindProcess.jpg
PHPPythonScripting Languages

Avatar of undefined
Last Comment
IT79637
Avatar of virmaior
virmaior
Flag of United States of America image

I think this is more a VB question than a PHP or Python question...

I believe what you are describing sounds like COM (component object model)

you can do that in PHP.  I don't think you can use PHP as a COM object in other languages and I severely doubt you can do that with Python.

What exactly is your question?
Avatar of IT79637
IT79637
Flag of United States of America image

ASKER

The problem is when a web page refreshes, I loose the BVS handle to the ole server. Consequently the server terminates and is relaunched  with every time the web page is refreshed.  In a high volume Accounts Payment invoice input process the server would he launching and closing down with each new invoice.   Whenever the web page refreshes, I have to recreate the ole server using vbs as follows:  Set mySrvObj = CreateObject("ImageDisplaySrv.ImgDisp"). I think that would be extremely irritating for the AP clerk.  I would prefer a persistent server between web pages.

I am attempting to find a way the server can be:
1.  Launched independently of the host application (web page), and most importantly,
2. I am trying to find web technology that can establish and reestablish communication with a persistent ole server given thatweb technology is mostly stateless.  

Hope this explain what I want do do technically.

Thank you.
Avatar of IT79637
IT79637
Flag of United States of America image

ASKER

This would need to be client side.  I wish I could store the VBS object between page refreshes, as in a cookie or file.
Avatar of virmaior
virmaior
Flag of United States of America image

It's not going to be possible using web technology to do this client-side.   By definition, as you note, the web is stateless and cannot maintain connections through new pages.


Properly speaking, the host application is IIS (or apache), a web page is just a product of the web server.
you should be able to keep a process running in IIS.  You need to write it to run as a service rather than as a called application.

(e.g. ISAPI and FastCGI are both things that IIS keeps running).

Avatar of IT79637
IT79637
Flag of United States of America image

ASKER

The automation server is written as an out-of-process (.exe) server, apartment threaded.
Avatar of IT79637
IT79637
Flag of United States of America image

ASKER

I am able to maintain state of the server by using a frameset and two frames.  One frame is my web page.  The second frame, which is hidden, holds the handle to the server.  Please see link below.

https://www.experts-exchange.com/questions/23622000/How-to-Control-Loading-of-frames.html
ASKER CERTIFIED SOLUTION
Avatar of IT79637
IT79637
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
PHP
PHP

PHP is a widely-used server-side scripting language especially suited for web development, powering tens of millions of sites from Facebook to personal WordPress blogs. PHP is often paired with the MySQL relational database, but includes support for most other mainstream databases. By utilizing different Server APIs, PHP can work on many different web servers as a server-side scripting language.

125K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo