Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Closing other app. forms in windows
Message
From
10/04/2002 14:08:21
 
 
To
08/04/2002 04:39:45
Hisham Serry
Al-Bahar United Company
Kuwait, Kuwait
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00642066
Message ID:
00643368
Views:
22
Sorry about the other post Hisham, I got this from searching the UT and making some VERY MINOR changes to some of the examples I found (original posts were from Ed, Cetin, and Larry I think).

I believe this is what you are looking for (it checks to see if the calculator is running, and if so, closes it):
*!*See if Calculator is running, and if so, close it
DECLARE INTEGER ShowWindow IN win32api INTEGER,INTEGER
DECLARE INTEGER BringWindowToTop IN Win32API INTEGER hWnd

*!* To see if Outlook is running
*lnHand    =IsRunning("Outlook")
*!* To see if Calculator is running
lnHand=CheckWin("Calculator")

#DEFINE WM_QUIT 0x12

DECLARE SHORT PostMessage In USER32.DLL ;
   INTEGER hWnd, ;
   INTEGER uMsg, ;
   INTEGER wParam, ;
   INTEGER lParam

IF lnHand>0
	=PostMessage(lnHand,WM_QUIT,0,0)
ENDIF
RETURN

PROCEDURE CheckWin
	PARAMETER tcTitle

	* Routine which sees if an application is active by looking for its
	* Window title
	* expC1 Window title

	DECLARE INTEGER FindWindow in Win32API as FindWindow STRING, STRING
        lnhand=FindWindow(0,tcTitle)
        *!*Display the window handle to the screen
        ? lnhand
        *!*To return the window handle:
        RETURN lnhand
        *!*To return .t. or .f. it is open:
        *RETURN IIF(FindWindow(0,tcTitle)>0,.T.,.F.)
Tracy

>Dear All,
>
>I want to know how to capture the other windows app. forms and close them by sending the name of the form I do understand that there is an API funtion to do that but I forget it can some one reminde me.
>
>
>thanks guys
>
>Hisham
.·*´¨)
.·`TCH
(..·*

010000110101001101101000011000010111001001110000010011110111001001000010011101010111001101110100
"When the debate is lost, slander becomes the tool of the loser." - Socrates
Vita contingit, Vive cum eo. (Life Happens, Live With it.)
"Life is not measured by the number of breaths we take, but by the moments that take our breath away." -- author unknown
"De omnibus dubitandum"
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform