John,
Does this help? It closes a Named non VFP window. Perhaps you could put it
onto a timer or under operator control to close down the Adobe Reader as
required.
Hope that my Outlook doesn't screw up the spacing:
Dave Crozier
**********************
* This Program closes a named NON VFP Window
*
Public ctext
Private isfound
isfound = isrunning('temp.txt - Notepad') && insert windowName here
If isfound<>0
Declare Integer Sleep In Win32API Integer
WshShell = Createobject("WScript.Shell")
WshShell.AppActivate(Substr(ctext,1,At(Chr(0),ctext)-1))
WshShell.sendkeys ("%({f4})") &&sends the alt-f4 key sequence
Endif
*******************
* Generic routine to check if a given application is running on the user's
system
*
Function isrunning
Lparameter tcTitle && all or Part Of the App's window
title
Declare Integer GetActiveWindow ;
IN Win32API
* Current App's window
hNext = GetActiveWindow()
Declare Integer GetWindow In Win32API ;
INTEGER HWnd, Integer nType
Declare Integer GetWindowText In Win32API ;
INTEGER HWnd, String @cText, Integer nType
* iterate through the open windows
Do While hNext<>0
ctext = Replicate(Chr(0),80)
* Get Window Title
GetWindowText(hNext,@ctext,80)
* Parameter text is present in window title
If Upper(Alltrim(tcTitle)) $ Upper(ctext)
Return hNext
Endif
* Try next Window
hNext = GetWindow(hNext,2)
*
Enddo
* required window not found
Return 0
*
Endfunc
* End of Code
*************
Dave Crozier
The secret to staying young is to live honestly, eat slowly, and to lie
about your age
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
Of John Weller
Sent: 18 October 2006 13:48
To: [email protected]
Subject: RE: Setting Default Printer
Excellent!!!!
Unfortunately it generates another question :-( I seem to be going 2 steps
forward and 1 back with this project.
I can now set a printer to be the default and print a batch of PDF files on
that printer. If I then set another printer to be the default and try and
print a further batch without closing the Acrobat window which was opened by
the first batch they are printed to the first printer so obviously I need to
close Acrobat between printing batches. The solution appears to be to use
TerminateProcess however this needs the ProcessHandle which begs the
question - how do I find the process handle? I can't be certain whether the
user will have Acrobat Reader or the full version, nor can I be certain
which version as they may well upgrade in the fullness of time.
John Weller
Wessex Computer Solutions
01380 728880
07976 393631
>
> For others following this thread: Check out the OUTSTANDING
> www.news2news.com site - a collection of free and subscription based
> content about how to use the Win32 api's from VFP. Well written,
> accurate with 100's of fully documented copy and paste VFP code
> snippets. Highly, highly, HIGHLY recommended!
>
> The www.news2news.com site gets a "6 out of 5 stars" rating from me.
>
>
[excessive quoting removed by server]
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
** All postings, unless explicitly stated otherwise, are the opinions of the
author, and do not constitute legal or medical advice. This statement is added
to the messages for those lawyers who are too stupid to see the obvious.