Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Execute

Status
Not open for further replies.

zonetrap

Technical User
Jun 13, 2001
8
US
Okay, I can open up an application, but how do I close one?
method pushButton(var eventInfo Event)

execute("C:\\Program Files\\Microsoft Office\\Office\\WINWORD.EXE")

endmethod
 
Obviously, you can close it manually.
I don't think you can do it with ObjectPAL.
It's been a while, you can use Win API, I think.
Can't remember the syntax.
May be someone here knows.
 
I think you would have to use DDE and sendkeys.

Mac
:)
mailto:langley_mckelvy@cd4.co.harris.tx.us
 
Since Word uses "OpusApp" as its window classname, you can close any running instances using something like this:

Code:
method pushButton(var eventInfo Event)
var
   datHandles  Dynarray[] AnyType
   handle string
endVar

const
   WM_CLOSE = 16
endConst

   enumWindowHandles( datHandles, "OpusApp" )

   if datHandles.size() = 0 then
      msgStop( "Sorry", "No instances of Word were found" )
   else

      forEach handle in datHandles
         winSendMessage( longInt( handle ), WM_CLOSE, 0, 0 )
      endForEach

   endIf
endmethod

Hope this helps...

-- Lance
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top