Dont bother me I'm working (The exe that wont be left alone) 
Author Message
 Dont bother me I'm working (The exe that wont be left alone)

    Ok here's my situation.  I have an ActiveX exe that runs on our web
server to send faxes when incomming form data is saved.  How it works is the
exe grabs all records from the database that havn't been faxed and processes
these records to fax the required information.

    All works fine for the exception that when it's working I want to
prevent the com object that triggers its execution from using it.  Right now
I have an exposed property "Working" that I'm continuously testing so I'm
not telling it to get to work when it allready is.  Being an internet app I
really want to prevent having to allways test this value...I just want it to
do its work and not be bothered untill it's done.

    Anyone have a suggestion on how I can get my com object to realize that
the exe is busy without having to ask it?  I was told that the api has some
methods to hold execution of a process with means of triggering a release if
it's currently held.  I havnt been able to find such a thing but it would be
perfet.  Hold on to the process when it's not working and release it when it
needs to.  I was told that the api call will just ignore the call if the exe
isn't currecntly held.  If anyone has any info on these api methods that
would be awesome.  Either on these api methods or some other means to tackle
this problem.

My thanks in advance!

P.S.

I dont want to use a timer on the exe to trigger itself to look for
something needing to be sent.  When not in use I want it to be idle not
using any cpu.



Thu, 03 Apr 2003 10:46:33 GMT  
 Dont bother me I'm working (The exe that wont be left alone)
How about making your Server start from Sub Main, then make it sit
there (in a Sleep loop)  until you decide to make it start sending.
So you have a Server Thread kept alive.

You can pass data in to be posted via an exposed class, this then
calls a sub in a .BAS module which adds the data to a queue.
This will take place on the Client Thread so you need to have some
form of rudimentary locking.

The Server then picks up this data - stores it and - at intervals
performs a Fax Run.  Actually I would be tempted to use a second
ActiveX Server to do the faxing.

I use a similar approach for a CGI-WIN data Server - the WebServer
kicks off a tiny stub EXE which  passes the posted data over to an up
and running ActiveX EXE in which the job is queued, the Servers main
thread then picks up the job - here is the queuing snippet :-

'########################################################################
'
' Add a WebSvr Packet to Queue - DataIn$ is INI_File.Data
'
Sub AddInPacketToQueue(DataIn$, PacketNo%)

    Dim L9%, S$
    Static BusyFlag As Boolean
    While BusyFlag = True
          DoEvents
    Wend
    BusyFlag = True

    For L9 = 1 To UBound(cmnPacketSendData$)
        If cmnPacketSendData$(L9) = "" Then
           PacketNo = L9
           cmnPacketSendData$(L9) = DataIn$
           DataIn$ = ""
           cmnPacketReturnData$(L9) = ""
           S$ = "/" + Str$(PacketNo)
           Call AddInFileToQueue(S$)
           Call LogInf("RQ Packet: " + S$)
           Exit For
        End If
    Next

    BusyFlag = False
End Sub

The Sub Main is roughly

        Init
        While glb.TerminateFlag = False
                  Sleep
                  Check Queue
                  If Anything Then ProcessIt
        Wend



Quote:
>    Ok here's my situation.  I have an ActiveX exe that runs on our web
>server to send faxes when incomming form data is saved.  How it works is the
>exe grabs all records from the database that havn't been faxed and processes
>these records to fax the required information.

>    All works fine for the exception that when it's working I want to
>prevent the com object that triggers its execution from using it.  Right now
>I have an exposed property "Working" that I'm continuously testing so I'm
>not telling it to get to work when it allready is.  Being an internet app I
>really want to prevent having to allways test this value...I just want it to
>do its work and not be bothered untill it's done.

>    Anyone have a suggestion on how I can get my com object to realize that
>the exe is busy without having to ask it?  I was told that the api has some
>methods to hold execution of a process with means of triggering a release if
>it's currently held.  I havnt been able to find such a thing but it would be
>perfet.  Hold on to the process when it's not working and release it when it
>needs to.  I was told that the api call will just ignore the call if the exe
>isn't currecntly held.  If anyone has any info on these api methods that
>would be awesome.  Either on these api methods or some other means to tackle
>this problem.

>My thanks in advance!

>P.S.

>I dont want to use a timer on the exe to trigger itself to look for
>something needing to be sent.  When not in use I want it to be idle not
>using any cpu.



Wed, 18 Jun 1902 08:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. I am RILLY thick so pleez don't bother replying to this message :)

2. Why wont Right$ and Left$ work in VB5?

3. Stand alone Exe's?

4. Stand Alone .EXE's in VB5?

5. Stand-alone EXE's with Professional Edition

6. ActiveX EXE's in IIS (wont release handle)

7. Office dont't work after vb.net was installed

8. dotnetfx.exe bootstrapper example setup.exe doesn't work

9. Ambiguous Name 'Left' using Left$

10. ActiveX-Exe: .Value=True doesn't work while direct click on button works

11. String extract functions, left,right.mid don't work

12. My expressions won't work (simple left or between functions)

 

 
Powered by phpBB® Forum Software