Re: Persistent Process Kill

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



yes, do you have the object installed and registered??


"Mark Withers" <BSDjunkie@xxxxxxxxxxxxx> wrote in message
news:slrne90ic6.lsl.BSDjunkie@xxxxxxxxxxxxxxxxxxxxxxxxx
I receive the following error:

ActiveX component can't create object: 'DynamicWrapper'

Mark

On 2006-06-14, mr_unreliable <kindlyReplyToNewsgroup@xxxxxxxxxxx> wrote:
Mark, if you are courageous enough (or foolhardy enough)
to consider calling a system api from script, then
"BlockInput" could do what you want. That is, it could
stop that uncooperative user from restarting his/her app.

Like it says, "BlockInput" will block all keyboard and
mouse input.

Here is a demo script:

--- <snip> ---
' test "sleep" api call, using DynaWrap, ca 2000, jw
' 25Jan05: revised to show elapsed time explicitly...
' 11May05: revised to show blockinput rather than sleep...

Const CPP_TRUE = 1 ' c++ (i.e., system values - NOT vb values)
Const CPP_FALSE = 0

Dim oDW : Set oDW = CreateObject("DynamicWrapper") ' instantiate
dynawrap
oDW.Register "USER32.DLL", "BlockInput", "i=l", "f=s" ' declare api
(no return value)

MsgBox("Click OK to start blocking keyboard and mouse input")

Call oDW.BlockInput(CPP_TRUE) ' block any keybd or mouse input...

WScript.Sleep 5000 ' wait-a-bit (5 sec) to allow for testing

Call oDW.BlockInput(CPP_FALSE)

MsgBox("input blocking cleared")

Set oDW = nothing ' clean up
WScript.Quit
--- </snip> ---

Note that if you and your user are ever to remain to speaking
terms, you must remember to UN-blockinput when you are done.

cheers, jw
____________________________________________________________

You got questions? WE GOT ANSWERS!!! ..(but,
no guarantee the answers will be applicable to the questions)



--- <DynaWrap Boilerplate> ---
It is possible to declare-and-call an api from script,
but you must use a third-party control to do so,
or else write one yourself.

It has already been correctly pointed out that there
is no api-capability in "pure" script.

If you are willing to use a third-party control, then
one such control, called "DynaWrap", can be found on
Guenter Born's website (note: Guenter refers to it as
"DynaCall"). Here is the link to it:

http://people.freenet.de/gborn/WSHBazaar/WSHDynaCall.htm

On that page you will find a download for the control,
plus some code samples.

Note: you may find additional sample code by searching
the archives of the wsh and vbscript ng's.

Note also: DynaWrap does have its limitations. There are
certain things it can't do. For example, you can't call
api's which take typedefs as parameters, and you can't call
api's "by ordinal". But it will work for most of the
"usual suspects".

And finally, DynaWrap doesn't work entirely as advertised.
For example, it is supposed to allow for the declaration of
several api definitions in one instance of itself. I could
never get that to work (in win9x). You will need a new
instance of DynaWrap for every api, or else re-instantiate
the object for every api. Someday I'm going to learn enough
c++ to fix that...
--- </DynaWrap Boilerplate> ---



Mark Withers wrote:
To All:

I was wondering if there is anything such as a 'persistent process kill'
in VBScript?

Say that I am upgrading software, and the user decides (after I kill
their application) that they want to double-click on it and restart it
while the upgrade/install process is going?

That would prevent msiexec from being able to write the installation
files and the install may fail.

Has anyone else in this forum taken care of this problem?

Is there some sort of a while/do loop that can run or that the
installation can be sandwitched in between?

Thanks again for listening!

Mark Withers


.



Relevant Pages

  • Re: Persistent Process Kill
    ... "BlockInput" could do what you want. ... Here is a demo script: ... ' test "sleep" api call, using DynaWrap, ca 2000, jw ...
    (microsoft.public.scripting.vbscript)
  • Re: Persistent Process Kill
    ... "BlockInput" could do what you want. ... Here is a demo script: ... ' test "sleep" api call, using DynaWrap, ca 2000, jw ...
    (microsoft.public.scripting.vbscript)
  • Re: Message Box No Buttons with Timeout
    ... Our unique installation of Printers takes up to 60secs ... If a script can create a message box, I'm sure a script can be written to ... But even using the api is no guarantee. ...
    (microsoft.public.scripting.vbscript)
  • Re: Alert Window on top of all other windows - like Task Manager
    ... will scorn and dis-respect you if you do call api's from script. ... then call the api for you. ... Call timer after showing popup to get control back. ... Set oDW = nothing ' clear any previous instance ...
    (microsoft.public.scripting.vbscript)
  • Re: [Ann] wsh API Toolkit actX object, resurrected...
    ... With respect to calling api's, this wsh API Toolkit does it all: ... and you can even do subclassing from script -- if you ... The current wshATO is wrapped in the attached zip file for those with an ... There is something flagrantly missing from the demo script ...
    (microsoft.public.scripting.vbscript)